summaryrefslogtreecommitdiff
path: root/www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-custom-ntp.patch
diff options
context:
space:
mode:
Diffstat (limited to 'www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-custom-ntp.patch')
-rw-r--r--www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-custom-ntp.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-custom-ntp.patch b/www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-custom-ntp.patch
new file mode 100644
index 0000000..6bb52b8
--- /dev/null
+++ b/www/chromium-uc/patches/extra/ungoogled-chromium/add-flag-for-custom-ntp.patch
@@ -0,0 +1,41 @@
1--- chrome/browser/chrome_content_browser_client.cc.orig
2+++ chrome/browser/chrome_content_browser_client.cc
3@@ -743,6 +743,9 @@ bool HandleNewTabPageLocationOverride(
4 Profile* profile = Profile::FromBrowserContext(browser_context);
5 std::string ntp_location =
6 profile->GetPrefs()->GetString(prefs::kNewTabPageLocationOverride);
7+ if (base::CommandLine::ForCurrentProcess()->HasSwitch("custom-ntp"))
8+ ntp_location = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("custom-ntp");
9+ if (profile->IsOffTheRecord() && ntp_location.find("chrome://") != std::string::npos) return false;
10 if (ntp_location.empty())
11 return false;
12 url::Component scheme;
13--- chrome/browser/ungoogled_flag_entries.h.orig
14+++ chrome/browser/ungoogled_flag_entries.h
15@@ -84,4 +84,8 @@
16 "Close Confirmation",
17 "Show a warning prompt when closing the browser window. ungoogled-chromium flag",
18 kOsDesktop, MULTI_VALUE_TYPE(kCloseConfirmation)},
19+ {"custom-ntp",
20+ "Custom New Tab Page",
21+ "Allows setting a custom URL for the new tab page. Value can be internal (e.g. `about:blank`), external (e.g. `example.com`), or local (e.g. `file:///tmp/startpage.html`). This applies for incognito windows as well when not set to a `chrome://` internal page. ungoogled-chromium flag",
22+ kOsDesktop, ORIGIN_LIST_VALUE_TYPE("custom-ntp", "")},
23 #endif // CHROME_BROWSER_UNGOOGLED_FLAG_ENTRIES_H_
24--- components/flags_ui/flags_state.cc.orig
25+++ components/flags_ui/flags_state.cc
26@@ -231,6 +231,7 @@ std::string GetCombinedOriginListValue(c
27 command_line_switch);
28 const std::string new_value =
29 flags_storage.GetOriginListFlag(internal_entry_name);
30+ if (command_line_switch == "custom-ntp") return existing_value.empty() ? new_value : existing_value;
31 return CombineAndSanitizeOriginLists(existing_value, new_value);
32 }
33
34@@ -417,6 +418,7 @@ void FlagsState::SetOriginListFlag(const
35 const std::string& value,
36 FlagsStorage* flags_storage) {
37 const std::string new_value =
38+ internal_name == "custom-ntp" ? value :
39 CombineAndSanitizeOriginLists(std::string(), value);
40 flags_storage->SetOriginListFlag(internal_name, new_value);
41