Browse Source

Add flag to popups-to-tabs patch

Blaise 3 years ago
parent
commit
eb88c10a15

+ 1 - 0
docs/flags.md

@@ -21,6 +21,7 @@ If a switch requires a value, you must specify it with an `=` sign; e.g. flag `-
   `--hide-crashed-bubble` | Hides the bubble box with the message "Restore Pages? Chromium didn't shut down correctly." that shows on startup after the browser did not exit cleanly.
   `--max-connections-per-host` | (from Bromite) Configure the maximum allowed connections per host. Valid values are `6` and `15`
   `--omnibox-autocomplete-filtering` | Restrict omnibox autocomplete results to a combination of search suggestions (if enabled), bookmarks, and internal chrome pages.  Accepts `search`, `search-bookmarks`, `search-chrome`, and `search-bookmarks-chrome`.
+  `--popups-to-tabs` | Makes popups open in new tabs.
 
 - ### Available only on desktop
 

+ 52 - 0
patches/extra/ungoogled-chromium/add-flag-to-convert-popups-to-tabs.patch

@@ -0,0 +1,52 @@
+# Make popups go to tabs instead
+
+--- a/chrome/browser/ungoogled_flag_entries.h
++++ b/chrome/browser/ungoogled_flag_entries.h
+@@ -56,4 +56,8 @@
+      "Close window with last tab",
+      "Determines whether a window should close once the last tab is closed.  ungoogled-chromium flag.",
+      kOsDesktop, MULTI_VALUE_TYPE(kCloseWindowWithLastTab)},
++    {"popups-to-tabs",
++     "Popups to tabs",
++     "Makes popups open in new tabs.  ungoogled-chromium flag",
++     kOsAll, SINGLE_VALUE_TYPE("popups-to-tabs")},
+ #endif  // CHROME_BROWSER_UNGOOGLED_FLAG_ENTRIES_H_
+--- a/content/renderer/render_view_impl.cc
++++ b/content/renderer/render_view_impl.cc
+@@ -82,6 +82,8 @@ WindowOpenDisposition RenderViewImpl::Na
+     case blink::kWebNavigationPolicyNewWindow:
+       return WindowOpenDisposition::NEW_WINDOW;
+     case blink::kWebNavigationPolicyNewPopup:
++      if (base::CommandLine::ForCurrentProcess()->HasSwitch("popups-to-tabs"))
++        return WindowOpenDisposition::NEW_FOREGROUND_TAB;
+       return WindowOpenDisposition::NEW_POPUP;
+     default:
+       NOTREACHED() << "Unexpected WebNavigationPolicy";
+--- a/ui/base/mojom/window_open_disposition_mojom_traits.h
++++ b/ui/base/mojom/window_open_disposition_mojom_traits.h
+@@ -5,6 +5,7 @@
+ #ifndef UI_BASE_MOJOM_WINDOW_OPEN_DISPOSITION_MOJOM_TRAITS_H_
+ #define UI_BASE_MOJOM_WINDOW_OPEN_DISPOSITION_MOJOM_TRAITS_H_
+ 
++#include "base/command_line.h"
+ #include "base/notreached.h"
+ #include "mojo/public/cpp/bindings/enum_traits.h"
+ #include "ui/base/mojom/window_open_disposition.mojom.h"
+@@ -28,6 +29,8 @@ struct EnumTraits<ui::mojom::WindowOpenD
+       case WindowOpenDisposition::NEW_BACKGROUND_TAB:
+         return ui::mojom::WindowOpenDisposition::NEW_BACKGROUND_TAB;
+       case WindowOpenDisposition::NEW_POPUP:
++        if (base::CommandLine::ForCurrentProcess()->HasSwitch("popups-to-tabs"))
++          return ui::mojom::WindowOpenDisposition::NEW_FOREGROUND_TAB;
+         return ui::mojom::WindowOpenDisposition::NEW_POPUP;
+       case WindowOpenDisposition::NEW_WINDOW:
+         return ui::mojom::WindowOpenDisposition::NEW_WINDOW;
+@@ -63,6 +66,8 @@ struct EnumTraits<ui::mojom::WindowOpenD
+         return true;
+       case ui::mojom::WindowOpenDisposition::NEW_POPUP:
+         *out = WindowOpenDisposition::NEW_POPUP;
++        if (base::CommandLine::ForCurrentProcess()->HasSwitch("popups-to-tabs"))
++          *out = WindowOpenDisposition::NEW_FOREGROUND_TAB;
+         return true;
+       case ui::mojom::WindowOpenDisposition::NEW_WINDOW:
+         *out = WindowOpenDisposition::NEW_WINDOW;

+ 0 - 33
patches/extra/ungoogled-chromium/popups-to-tabs.patch

@@ -1,33 +0,0 @@
-# Make popups go to tabs instead
-
---- a/content/renderer/render_view_impl.cc
-+++ b/content/renderer/render_view_impl.cc
-@@ -82,7 +82,7 @@ WindowOpenDisposition RenderViewImpl::Na
-     case blink::kWebNavigationPolicyNewWindow:
-       return WindowOpenDisposition::NEW_WINDOW;
-     case blink::kWebNavigationPolicyNewPopup:
--      return WindowOpenDisposition::NEW_POPUP;
-+      return WindowOpenDisposition::NEW_FOREGROUND_TAB;
-     default:
-       NOTREACHED() << "Unexpected WebNavigationPolicy";
-       return WindowOpenDisposition::IGNORE_ACTION;
---- a/ui/base/mojom/window_open_disposition_mojom_traits.h
-+++ b/ui/base/mojom/window_open_disposition_mojom_traits.h
-@@ -28,7 +28,7 @@ struct EnumTraits<ui::mojom::WindowOpenD
-       case WindowOpenDisposition::NEW_BACKGROUND_TAB:
-         return ui::mojom::WindowOpenDisposition::NEW_BACKGROUND_TAB;
-       case WindowOpenDisposition::NEW_POPUP:
--        return ui::mojom::WindowOpenDisposition::NEW_POPUP;
-+        return ui::mojom::WindowOpenDisposition::NEW_FOREGROUND_TAB;
-       case WindowOpenDisposition::NEW_WINDOW:
-         return ui::mojom::WindowOpenDisposition::NEW_WINDOW;
-       case WindowOpenDisposition::SAVE_TO_DISK:
-@@ -62,7 +62,7 @@ struct EnumTraits<ui::mojom::WindowOpenD
-         *out = WindowOpenDisposition::NEW_BACKGROUND_TAB;
-         return true;
-       case ui::mojom::WindowOpenDisposition::NEW_POPUP:
--        *out = WindowOpenDisposition::NEW_POPUP;
-+        *out = WindowOpenDisposition::NEW_FOREGROUND_TAB;
-         return true;
-       case ui::mojom::WindowOpenDisposition::NEW_WINDOW:
-         *out = WindowOpenDisposition::NEW_WINDOW;

+ 1 - 1
patches/series

@@ -57,7 +57,6 @@ extra/iridium-browser/browser-disable-profile-auto-import-on-first-run.patch
 extra/ungoogled-chromium/add-components-ungoogled.patch
 extra/ungoogled-chromium/add-ungoogled-flag-headers.patch
 extra/ungoogled-chromium/disable-formatting-in-omnibox.patch
-extra/ungoogled-chromium/popups-to-tabs.patch
 extra/ungoogled-chromium/add-ipv6-probing-option.patch
 extra/ungoogled-chromium/remove-disable-setuid-sandbox-as-bad-flag.patch
 extra/ungoogled-chromium/disable-intranet-redirect-detector.patch
@@ -84,6 +83,7 @@ extra/ungoogled-chromium/add-flag-for-omnibox-autocomplete-filtering.patch
 extra/ungoogled-chromium/disable-dial-repeating-discovery.patch
 extra/ungoogled-chromium/remove-uneeded-ui.patch
 extra/ungoogled-chromium/add-flag-to-close-window-with-last-tab.patch
+extra/ungoogled-chromium/add-flag-to-convert-popups-to-tabs.patch
 extra/bromite/fingerprinting-flags-client-rects-and-measuretext.patch
 extra/bromite/flag-max-connections-per-host.patch
 extra/bromite/flag-fingerprinting-canvas-image-data-noise.patch