mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
This fixes an `Unhandled chrome.send("getApps");` error when creating a new tab. Creating a new tab initially loads chrome://newtab which should then be rewritten to chrome://new-tab-page for normal profiles in HandleNewTabURLRewrite. Failure to rewrite the URL results in the loading of NewTabUI instead of the expected NewTabPageUI. NewTabUI loads different resources for normal vs incognito/guest profiles (new_tab.js vs incognito_tab.js), and new_tab.js calls chrome.send("getApps") via page_list_view.js. This then fails in WebUIImpl::ProcessWebUIMessage because the message is unhandled.
65 lines
2.6 KiB
Diff
65 lines
2.6 KiB
Diff
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
|
|
index 19c5989c8b67..659e6dbebea5 100644
|
|
--- chrome/browser/chrome_content_browser_client.cc
|
|
+++ chrome/browser/chrome_content_browser_client.cc
|
|
@@ -37,6 +37,7 @@
|
|
#include "base/threading/thread_task_runner_handle.h"
|
|
#include "build/build_config.h"
|
|
#include "build/chromeos_buildflags.h"
|
|
+#include "cef/libcef/features/features.h"
|
|
#include "chrome/browser/accessibility/accessibility_labels_service.h"
|
|
#include "chrome/browser/accessibility/accessibility_labels_service_factory.h"
|
|
#include "chrome/browser/accessibility/caption_util.h"
|
|
@@ -1067,10 +1068,6 @@ void LaunchURL(const GURL& url,
|
|
}
|
|
}
|
|
|
|
-std::string GetProduct() {
|
|
- return version_info::GetProductNameAndVersionForUserAgent();
|
|
-}
|
|
-
|
|
void MaybeAppendSecureOriginsAllowlistSwitch(base::CommandLine* cmdline) {
|
|
// |allowlist| combines pref/policy + cmdline switch in the browser process.
|
|
// For renderer and utility (e.g. NetworkService) processes the switch is the
|
|
@@ -1258,6 +1255,14 @@ const blink::UserAgentBrandList& GetBrandVersionList() {
|
|
return *greased_brand_version_list;
|
|
}
|
|
|
|
+std::string GetProduct() {
|
|
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
|
+ if (command_line->HasSwitch(switches::kProductVersion))
|
|
+ return command_line->GetSwitchValueASCII(switches::kProductVersion);
|
|
+
|
|
+ return version_info::GetProductNameAndVersionForUserAgent();
|
|
+}
|
|
+
|
|
std::string GetUserAgent() {
|
|
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
|
if (command_line->HasSwitch(switches::kUserAgent)) {
|
|
@@ -3610,9 +3615,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
|
|
&search::HandleNewTabURLReverseRewrite);
|
|
#endif // defined(OS_ANDROID)
|
|
|
|
+#if !BUILDFLAG(ENABLE_CEF)
|
|
// chrome: & friends.
|
|
handler->AddHandlerPair(&ChromeContentBrowserClient::HandleWebUI,
|
|
&ChromeContentBrowserClient::HandleWebUIReverse);
|
|
+#endif
|
|
}
|
|
|
|
base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() {
|
|
diff --git chrome/browser/chrome_content_browser_client.h chrome/browser/chrome_content_browser_client.h
|
|
index 3ef2329ac8a6..3e3ede99e042 100644
|
|
--- chrome/browser/chrome_content_browser_client.h
|
|
+++ chrome/browser/chrome_content_browser_client.h
|
|
@@ -108,7 +108,8 @@ class ChromeXrIntegrationClient;
|
|
}
|
|
#endif
|
|
|
|
-// Returns the user agent of Chrome.
|
|
+// Returns the product and user agent of Chrome.
|
|
+std::string GetProduct();
|
|
std::string GetUserAgent();
|
|
|
|
blink::UserAgentMetadata GetUserAgentMetadata();
|