From 9b284ec8f746699b1094d9a2209b6639cfd48c60 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 3 Jul 2024 13:07:46 -0400 Subject: [PATCH] Remove custom chrome scheme handling (see #3685) - Add CEF info to existing chrome://version WebUI. - Move chrome://license handling to WebUI. - Remove chrome://webui-hosts; use chrome://chrome-urls instead. - Remove chrome://extension-support; navigate to docs directly instead. --- BUILD.gn | 2 - .../chrome_browser_main_extra_parts_cef.cc | 2 - .../chrome_content_browser_client_cef.cc | 13 - .../chrome_content_browser_client_cef.h | 2 - libcef/browser/net/chrome_scheme_handler.cc | 639 ------------------ libcef/browser/net/chrome_scheme_handler.h | 43 -- libcef/resources/about_version.html | 141 ---- libcef/resources/cef_resources.grd | 1 - patch/patch.cfg | 17 +- .../browser_web_ui_controller_factory.patch | 29 - patch/patches/chrome_browser_browser.patch | 21 +- .../chrome_browser_webui_license.patch | 120 ++++ .../chrome_browser_webui_version.patch | 381 +++++++++++ patch/patches/chrome_runtime.patch | 25 +- patch/patches/gn_config.patch | 9 +- tests/ceftests/webui_unittest.cc | 2 - 16 files changed, 536 insertions(+), 911 deletions(-) delete mode 100644 libcef/browser/net/chrome_scheme_handler.cc delete mode 100644 libcef/browser/net/chrome_scheme_handler.h delete mode 100644 libcef/resources/about_version.html delete mode 100644 patch/patches/browser_web_ui_controller_factory.patch create mode 100644 patch/patches/chrome_browser_webui_license.patch create mode 100644 patch/patches/chrome_browser_webui_version.patch diff --git a/BUILD.gn b/BUILD.gn index 1fdf2de5b..59010c3cc 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -601,8 +601,6 @@ source_set("libcef_static") { "libcef/browser/native/window_delegate_view.h", "libcef/browser/navigation_entry_impl.cc", "libcef/browser/navigation_entry_impl.h", - "libcef/browser/net/chrome_scheme_handler.cc", - "libcef/browser/net/chrome_scheme_handler.h", "libcef/browser/net/crlset_file_util_impl.cc", "libcef/browser/net/throttle_handler.cc", "libcef/browser/net/throttle_handler.h", diff --git a/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc b/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc index 5110df638..f04ee109c 100644 --- a/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc +++ b/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc @@ -10,7 +10,6 @@ #include "cef/libcef/browser/chrome/chrome_startup_browser_creator.h" #include "cef/libcef/browser/context.h" #include "cef/libcef/browser/file_dialog_runner.h" -#include "cef/libcef/browser/net/chrome_scheme_handler.h" #include "cef/libcef/browser/permission_prompt.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" @@ -68,7 +67,6 @@ void ChromeBrowserMainExtraPartsCef::PreMainMessageLoopRun() { {base::TaskPriority::USER_BLOCKING, base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()}); - scheme::RegisterWebUIControllerFactory(); context_menu::RegisterCallbacks(); file_dialog_runner::RegisterFactory(); permission_prompt::RegisterCreateCallback(); diff --git a/libcef/browser/chrome/chrome_content_browser_client_cef.cc b/libcef/browser/chrome/chrome_content_browser_client_cef.cc index f9ee142d3..5edbf46b9 100644 --- a/libcef/browser/chrome/chrome_content_browser_client_cef.cc +++ b/libcef/browser/chrome/chrome_content_browser_client_cef.cc @@ -16,7 +16,6 @@ #include "cef/libcef/browser/certificate_query.h" #include "cef/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h" #include "cef/libcef/browser/context.h" -#include "cef/libcef/browser/net/chrome_scheme_handler.h" #include "cef/libcef/browser/net/throttle_handler.h" #include "cef/libcef/browser/net_service/cookie_manager_impl.h" #include "cef/libcef/browser/net_service/login_delegate.h" @@ -466,18 +465,6 @@ ChromeContentBrowserClientCef::CreateLoginDelegate( std::move(auth_required_callback)); } -void ChromeContentBrowserClientCef::BrowserURLHandlerCreated( - content::BrowserURLHandler* handler) { - // Register the Chrome handlers first for proper URL rewriting. - ChromeContentBrowserClient::BrowserURLHandlerCreated(handler); - scheme::BrowserURLHandlerCreated(handler); -} - -bool ChromeContentBrowserClientCef::IsWebUIAllowedToMakeNetworkRequests( - const url::Origin& origin) { - return scheme::IsWebUIAllowedToMakeNetworkRequests(origin); -} - void ChromeContentBrowserClientCef::ExposeInterfacesToRenderer( service_manager::BinderRegistry* registry, blink::AssociatedInterfaceRegistry* associated_registry, diff --git a/libcef/browser/chrome/chrome_content_browser_client_cef.h b/libcef/browser/chrome/chrome_content_browser_client_cef.h index ad04adf4b..8a62d1200 100644 --- a/libcef/browser/chrome/chrome_content_browser_client_cef.h +++ b/libcef/browser/chrome/chrome_content_browser_client_cef.h @@ -121,8 +121,6 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient { scoped_refptr response_headers, bool first_auth_attempt, LoginAuthRequiredCallback auth_required_callback) override; - void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override; - bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) override; void ExposeInterfacesToRenderer( service_manager::BinderRegistry* registry, blink::AssociatedInterfaceRegistry* associated_registry, diff --git a/libcef/browser/net/chrome_scheme_handler.cc b/libcef/browser/net/chrome_scheme_handler.cc deleted file mode 100644 index f2eab4f1d..000000000 --- a/libcef/browser/net/chrome_scheme_handler.cc +++ /dev/null @@ -1,639 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. -// Portions copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cef/libcef/browser/net/chrome_scheme_handler.h" - -#include -#include -#include -#include - -#include "base/command_line.h" -#include "base/files/file_util.h" -#include "base/lazy_instance.h" -#include "base/logging.h" -#include "base/memory/ptr_util.h" -#include "base/memory/raw_ptr.h" -#include "base/memory/ref_counted_memory.h" -#include "base/path_service.h" -#include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "base/values.h" -#include "cef/grit/cef_resources.h" -#include "cef/include/cef_version.h" -#include "cef/libcef/browser/frame_host_impl.h" -#include "cef/libcef/browser/thread_util.h" -#include "cef/libcef/common/app_manager.h" -#include "chrome/browser/browser_about_handler.h" -#include "chrome/browser/devtools/devtools_ui_bindings.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/webui/chrome_untrusted_web_ui_configs.h" -#include "chrome/browser/ui/webui/chrome_web_ui_configs.h" -#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" -#include "chrome/browser/ui/webui/theme_source.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/url_constants.h" -#include "content/browser/renderer_host/debug_urls.h" -#include "content/public/browser/browser_url_handler.h" -#include "content/public/browser/content_browser_client.h" -#include "content/public/browser/url_data_source.h" -#include "content/public/browser/web_ui_controller.h" -#include "content/public/browser/webui_config_map.h" -#include "content/public/common/url_constants.h" -#include "content/public/common/url_utils.h" -#include "content/public/common/user_agent.h" -#include "ipc/ipc_channel.h" -#include "third_party/blink/public/common/chrome_debug_urls.h" -#include "ui/base/resource/resource_bundle.h" -#include "v8/include/v8.h" - -namespace scheme { - -const char kChromeURL[] = "chrome://"; - -namespace { - -const char kChromeUIExtensionsSupportHost[] = "extensions-support"; -const char kChromeUILicenseHost[] = "license"; -const char kChromeUIWebUIHostsHost[] = "webui-hosts"; - -// TODO(network): Consider handling content::kChromeDevToolsScheme via WebUI -// (DevToolsUI class) with the following changes: -// 1. Add an entry for content::kChromeDevToolsScheme in -// AlloyContentBrowserClient::GetAdditionalWebUISchemes. -// 2. Allow the scheme in CefWebUIControllerFactory::AllowWebUIForURL. -// 3. Add an entry for chrome::kChromeUIDevToolsHost in kAllowedWebUIHosts and -// kUnlistedHosts. -// 4. Remove scheme::RegisterInternalHandlers and related plumbing. - -// Chrome hosts implemented by WebUI. -// Some WebUI handlers have Chrome dependencies that may fail in CEF without -// additional changes. Do not add new hosts to this list without also manually -// testing all related functionality in CEF. -const char* kAllowedWebUIHosts[] = { - chrome::kChromeUIAccessibilityHost, - content::kChromeUIBlobInternalsHost, - chrome::kChromeUIChromeURLsHost, - chrome::kChromeUICreditsHost, - kChromeUIExtensionsSupportHost, - content::kChromeUIGpuHost, - content::kChromeUIHistogramHost, - content::kChromeUIIndexedDBInternalsHost, - kChromeUILicenseHost, - content::kChromeUIMediaInternalsHost, - chrome::kChromeUINetExportHost, - chrome::kChromeUINetInternalsHost, - content::kChromeUINetworkErrorHost, - content::kChromeUINetworkErrorsListingHost, - chrome::kChromeUIPrintHost, - content::kChromeUIProcessInternalsHost, - content::kChromeUIResourcesHost, -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) - chrome::kChromeUISandboxHost, -#endif - content::kChromeUIServiceWorkerInternalsHost, - chrome::kChromeUISystemInfoHost, - chrome::kChromeUIThemeHost, - content::kChromeUITracingHost, - chrome::kChromeUIVersionHost, - content::kChromeUIWebRTCInternalsHost, - kChromeUIWebUIHostsHost, -}; - -// Hosts that don't have useful output when linked directly. They'll be excluded -// from the "chrome://webui-hosts" listing. -const char* kUnlistedHosts[] = { - content::kChromeUINetworkErrorHost, - content::kChromeUIResourcesHost, - chrome::kChromeUIThemeHost, -}; - -enum ChromeHostId { - CHROME_UNKNOWN = 0, - CHROME_EXTENSIONS_SUPPORT, - CHROME_LICENSE, - CHROME_VERSION, - CHROME_WEBUI_HOSTS, -}; - -// Chrome hosts implemented by CEF. -const struct { - const char* host; - ChromeHostId host_id; -} kAllowedCefHosts[] = { - {chrome::kChromeUIChromeURLsHost, CHROME_WEBUI_HOSTS}, - {kChromeUIExtensionsSupportHost, CHROME_EXTENSIONS_SUPPORT}, - {kChromeUILicenseHost, CHROME_LICENSE}, - {chrome::kChromeUIVersionHost, CHROME_VERSION}, - {kChromeUIWebUIHostsHost, CHROME_WEBUI_HOSTS}, -}; - -ChromeHostId GetChromeHostId(const std::string& host) { - for (auto kAllowedCefHost : kAllowedCefHosts) { - if (base::EqualsCaseInsensitiveASCII(kAllowedCefHost.host, host.c_str())) { - return kAllowedCefHost.host_id; - } - } - - return CHROME_UNKNOWN; -} - -// Returns WebUI hosts. Does not include chrome debug hosts (for crashing, etc). -void GetAllowedHosts(std::vector* hosts) { - // Explicitly whitelisted WebUI hosts. - for (auto& kAllowedWebUIHost : kAllowedWebUIHosts) { - hosts->push_back(kAllowedWebUIHost); - } -} - -// Returns true if a host should not be listed on "chrome://webui-hosts". -bool IsUnlistedHost(const std::string& host) { - for (auto& kUnlistedHost : kUnlistedHosts) { - if (host == kUnlistedHost) { - return true; - } - } - return false; -} - -// Additional debug URLs that are not included in chrome::kChromeDebugURLs. -const char* kAllowedDebugURLs[] = { - blink::kChromeUIBrowserCrashURL, -}; - -void GetDebugURLs(std::vector* urls) { - for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) { - urls->push_back(chrome::kChromeDebugURLs[i]); - } - - for (auto& kAllowedDebugURL : kAllowedDebugURLs) { - urls->push_back(kAllowedDebugURL); - } -} - -std::string GetOSType() { -#if BUILDFLAG(IS_WIN) - return "Windows"; -#elif BUILDFLAG(IS_MAC) - return "Mac OS X"; -#elif BUILDFLAG(IS_LINUX) - return "Linux"; -#else - return "Unknown"; -#endif -} - -std::string GetCommandLine() { -#if BUILDFLAG(IS_WIN) - return base::WideToUTF8( - base::CommandLine::ForCurrentProcess()->GetCommandLineString()); -#elif BUILDFLAG(IS_POSIX) - std::string command_line = ""; - using ArgvList = std::vector; - const ArgvList& argv = base::CommandLine::ForCurrentProcess()->argv(); - for (ArgvList::const_iterator iter = argv.begin(); iter != argv.end(); - iter++) { - command_line += " " + *iter; - } - // TODO(viettrungluu): |command_line| could really have any encoding, whereas - // below we assumes it's UTF-8. - return command_line; -#endif -} - -std::string GetModulePath() { - base::FilePath path; - if (base::PathService::Get(base::FILE_MODULE, &path)) { - return CefString(path.value()); - } - return std::string(); -} - -class TemplateParser { - public: - TemplateParser() : ident_start_("$$"), ident_end_("$$") {} - - TemplateParser(const std::string& ident_start, const std::string& ident_end) - : ident_start_(ident_start), ident_end_(ident_end) {} - - void Add(const std::string& key, const std::string& value) { - values_.insert(std::make_pair(key, value)); - } - - void Parse(std::string* tmpl) { - int start_pos, end_pos = 0; - int ident_start_len = ident_start_.length(); - int ident_end_len = ident_end_.length(); - - while (true) { - start_pos = tmpl->find(ident_start_, end_pos); - if (start_pos >= 0) { - end_pos = tmpl->find(ident_end_, start_pos + ident_start_len); - if (end_pos >= 0) { - // Found an identifier. Check if a substitution exists. - std::string key = tmpl->substr(start_pos + ident_start_len, - end_pos - start_pos - ident_start_len); - KeyMap::const_iterator it = values_.find(key); - if (it != values_.end()) { - // Peform the substitution. - tmpl->replace(start_pos, end_pos + ident_end_len - start_pos, - it->second); - end_pos = start_pos + it->second.length(); - } else { - // Leave the unknown identifier in place. - end_pos += ident_end_len; - } - - if (end_pos >= static_cast(tmpl->length()) - ident_start_len - - ident_end_len) { - // Not enough room remaining for more identifiers. - break; - } - } else { - // No end identifier found. - break; - } - } else { - // No start identifier found. - break; - } - } - } - - private: - using KeyMap = std::map; - KeyMap values_; - std::string ident_start_; - std::string ident_end_; -}; - -bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) { - *mime_type = "text/html"; - - // Redirect to the Chrome documentation. - *output = - "\n" - "\n" - "\n"; - return true; -} - -bool OnLicenseUI(std::string* mime_type, std::string* output) { - std::string piece = - ui::ResourceBundle::GetSharedInstance().LoadDataResourceString( - IDR_CEF_LICENSE_TXT); - if (piece.empty()) { - DCHECK(false) << "Failed to load license txt resource."; - return false; - } - - *mime_type = "text/html"; - *output = "License
" + piece +
-            "
"; - - return true; -} - -bool OnVersionUI(Profile* profile, - std::string* mime_type, - std::string* output) { - std::string tmpl = - ui::ResourceBundle::GetSharedInstance().LoadDataResourceString( - IDR_CEF_VERSION_HTML); - if (tmpl.empty()) { - DCHECK(false) << "Failed to load version html resource."; - return false; - } - - base::FilePath user_data_dir = - base::PathService::CheckedGet(chrome::DIR_USER_DATA); - - TemplateParser parser; - parser.Add("YEAR", MAKE_STRING(COPYRIGHT_YEAR)); - parser.Add("CEF", CEF_VERSION); - parser.Add("CHROMIUM", - base::StringPrintf("%d.%d.%d.%d", CHROME_VERSION_MAJOR, - CHROME_VERSION_MINOR, CHROME_VERSION_BUILD, - CHROME_VERSION_PATCH)); - parser.Add("OS", GetOSType()); - parser.Add("WEBKIT", content::GetWebKitVersion()); - parser.Add("JAVASCRIPT", v8::V8::GetVersion()); - parser.Add( - "USERAGENT", - CefAppManager::Get()->GetContentClient()->browser()->GetUserAgent()); - parser.Add("COMMANDLINE", GetCommandLine()); - parser.Add("MODULEPATH", GetModulePath()); - parser.Add("ROOTCACHEPATH", CefString(user_data_dir.value())); - parser.Add("CACHEPATH", CefString(profile->GetPath().value())); - - parser.Parse(&tmpl); - - *mime_type = "text/html"; - *output = tmpl; - - return true; -} - -bool OnWebUIHostsUI(std::string* mime_type, std::string* output) { - std::string html = - "\nChrome URLs\n" - "

List of Chrome URLs

\n
    \n"; - - std::vector list; - GetAllowedHosts(&list); - std::sort(list.begin(), list.end()); - - for (const auto& i : list) { - if (IsUnlistedHost(i)) { - continue; - } - - html += "
  • chrome://" + i + "
  • \n"; - } - - list.clear(); - GetDebugURLs(&list); - std::sort(list.begin(), list.end()); - - html += - "
\n

For Debug

\n" - "

The following pages are for debugging purposes only. Because they " - "crash or hang the renderer, they're not linked directly; you can type " - "them into the address bar if you need them.

\n
    \n"; - for (const auto& i : list) { - html += "
  • " + std::string(i) + "
  • \n"; - } - html += "
\n"; - - html += "\n"; - - *mime_type = "text/html"; - *output = html; - - return true; -} - -const content::WebUI::TypeID kCefWebUITypeID = &kCefWebUITypeID; - -class CefURLDataSource : public content::URLDataSource { - public: - CefURLDataSource(const std::string& host, - ChromeHostId host_id, - Profile* profile) - : host_(host), host_id_(host_id), profile_(profile) { - CEF_REQUIRE_UIT(); - output_ = new base::RefCountedString(); - bool handled = false; - switch (host_id_) { - case CHROME_EXTENSIONS_SUPPORT: - handled = OnExtensionsSupportUI(&mime_type_, &output_->as_string()); - break; - case CHROME_LICENSE: - handled = OnLicenseUI(&mime_type_, &output_->as_string()); - break; - case CHROME_VERSION: - handled = OnVersionUI(profile_, &mime_type_, &output_->as_string()); - break; - case CHROME_WEBUI_HOSTS: - handled = OnWebUIHostsUI(&mime_type_, &output_->as_string()); - break; - default: - break; - } - DCHECK(handled) << "Unhandled WebUI host: " << host; - } - - CefURLDataSource(const CefURLDataSource&) = delete; - CefURLDataSource& operator=(const CefURLDataSource&) = delete; - - ~CefURLDataSource() override = default; - - // content::URLDataSource implementation. - std::string GetSource() override { return host_; } - - void StartDataRequest( - const GURL& path, - const content::WebContents::Getter& wc_getter, - content::URLDataSource::GotDataCallback callback) override { - std::move(callback).Run(output_); - } - - std::string GetMimeType(const GURL& url) override { return mime_type_; } - - bool AllowCaching() override { return false; } - - private: - const std::string host_; - const ChromeHostId host_id_; - const raw_ptr profile_; - - std::string mime_type_; - scoped_refptr output_; -}; - -class CefWebUIController : public content::WebUIController { - public: - CefWebUIController(content::WebUI* web_ui, - const std::string& host, - ChromeHostId host_id) - : content::WebUIController(web_ui) { - Profile* profile = Profile::FromWebUI(web_ui); - content::URLDataSource::Add( - profile, std::make_unique(host, host_id, profile)); - } - - CefWebUIController(const CefWebUIController&) = delete; - CefWebUIController& operator=(const CefWebUIController&) = delete; - - ~CefWebUIController() override = default; -}; - -// Intercepts all WebUI calls and either blocks them or forwards them to the -// Content or Chrome WebUI factory as appropriate. -class CefWebUIControllerFactory : public content::WebUIControllerFactory { - public: - CefWebUIControllerFactory(const CefWebUIControllerFactory&) = delete; - CefWebUIControllerFactory& operator=(const CefWebUIControllerFactory&) = - delete; - - // Returns true if WebUI is allowed to handle the specified |url|. - static bool AllowWebUIForURL(const GURL& url) { - if (url.SchemeIs(content::kChromeDevToolsScheme)) { - return DevToolsUIBindings::IsValidFrontendURL(url); - } - - if (!url.SchemeIs(content::kChromeUIScheme) && - !url.SchemeIs(content::kChromeUIUntrustedScheme)) { - return false; - } - - return true; - } - - // Returns true if WebUI is allowed to make network requests. - static bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) { - if (!AllowWebUIForURL(origin.GetURL())) { - return false; - } - - if (ChromeWebUIControllerFactory::IsWebUIAllowedToMakeNetworkRequests( - origin)) { - return true; - } - - return false; - } - - std::unique_ptr CreateWebUIControllerForURL( - content::WebUI* web_ui, - const GURL& url) override { - std::unique_ptr controller; - if (!AllowWebUIForURL(url)) { - return controller; - } - - // Set up the chrome://theme/ source. These URLs are referenced from many - // places (WebUI and chrome://resources which live in //ui). WebUI code - // can live in both //content and //chrome. Since ThemeSource lives in - // //chrome the WebUI from //content is not performing this setup despite - // the fact that it's needed for proper handling of theme resource requests. - // See https://crbug.com/1011280. - Profile* profile = Profile::FromWebUI(web_ui); - content::URLDataSource::Add(profile, - std::make_unique(profile)); - - const auto host_id = GetChromeHostId(url.host()); - if (host_id != CHROME_UNKNOWN) { - return std::make_unique(web_ui, url.host(), host_id); - } - - controller = content::WebUIConfigMap::GetInstance() - .controller_factory() - ->CreateWebUIControllerForURL(web_ui, url); - if (controller) { - return controller; - } - - return ChromeWebUIControllerFactory::GetInstance() - ->CreateWebUIControllerForURL(web_ui, url); - } - - content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context, - const GURL& url) override { - content::WebUI::TypeID type = content::WebUI::kNoWebUI; - if (!AllowWebUIForURL(url)) { - return type; - } - - const auto host_id = GetChromeHostId(url.host()); - if (host_id != CHROME_UNKNOWN) { - return kCefWebUITypeID; - } - - type = content::WebUIConfigMap::GetInstance() - .controller_factory() - ->GetWebUIType(browser_context, url); - if (type != content::WebUI::kNoWebUI) { - return type; - } - - type = ChromeWebUIControllerFactory::GetInstance()->GetWebUIType( - browser_context, url); - if (type != content::WebUI::kNoWebUI) { - return type; - } - - return content::WebUI::kNoWebUI; - } - - bool UseWebUIForURL(content::BrowserContext* browser_context, - const GURL& url) override { - if (!AllowWebUIForURL(url)) { - return false; - } - - const auto host_id = GetChromeHostId(url.host()); - if (host_id != CHROME_UNKNOWN) { - return true; - } - - if (content::WebUIConfigMap::GetInstance() - .controller_factory() - ->UseWebUIForURL(browser_context, url) || - ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL( - browser_context, url)) { - return true; - } - - return false; - } - - static void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) { - // chrome: & friends. The default registration is disabled is - // ChromeContentBrowserClient::BrowserURLHandlerCreated(). - handler->AddHandlerPair(&HandleWebUI, &HandleWebUIReverse); - } - - static CefWebUIControllerFactory* GetInstance(); - - protected: - CefWebUIControllerFactory() = default; - ~CefWebUIControllerFactory() override = default; - - private: - friend struct base::LazyInstanceTraitsBase; - - // From chrome/browser/chrome_content_browser_client.cc - - // Handles rewriting Web UI URLs. - static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { - if (!GetInstance()->UseWebUIForURL(browser_context, *url)) { - return false; - } - - return true; - } - - // Reverse URL handler for Web UI. - static bool HandleWebUIReverse(GURL* url, - content::BrowserContext* browser_context) { - // No need to actually reverse-rewrite the URL. - return false; - } -}; - -base::LazyInstance::Leaky - g_web_ui_controller_factory = LAZY_INSTANCE_INITIALIZER; - -// static -CefWebUIControllerFactory* CefWebUIControllerFactory::GetInstance() { - return &g_web_ui_controller_factory.Get(); -} - -} // namespace - -void RegisterWebUIControllerFactory() { - // Channel all WebUI handling through CefWebUIControllerFactory. - content::WebUIControllerFactory::UnregisterFactoryForTesting( - content::WebUIConfigMap::GetInstance().controller_factory()); - - content::WebUIControllerFactory::RegisterFactory( - CefWebUIControllerFactory::GetInstance()); - - RegisterChromeWebUIConfigs(); - RegisterChromeUntrustedWebUIConfigs(); -} - -void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) { - CefWebUIControllerFactory::BrowserURLHandlerCreated(handler); -} - -bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) { - return CefWebUIControllerFactory::IsWebUIAllowedToMakeNetworkRequests(origin); -} - -} // namespace scheme diff --git a/libcef/browser/net/chrome_scheme_handler.h b/libcef/browser/net/chrome_scheme_handler.h deleted file mode 100644 index 7b50fe2b2..000000000 --- a/libcef/browser/net/chrome_scheme_handler.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that can -// be found in the LICENSE file. - -#ifndef CEF_LIBCEF_BROWSER_NET_CHROME_SCHEME_HANDLER_H_ -#define CEF_LIBCEF_BROWSER_NET_CHROME_SCHEME_HANDLER_H_ -#pragma once - -#include - -#include "cef/include/cef_browser.h" -#include "cef/include/cef_frame.h" -#include "cef/include/cef_process_message.h" -#include "url/gurl.h" - -namespace base { -class ListValue; -} - -namespace content { -class BrowserURLHandler; -} - -namespace url { -class Origin; -} - -namespace scheme { - -extern const char kChromeURL[]; - -// Register the WebUI controller factory. -void RegisterWebUIControllerFactory(); - -// Register the WebUI handler. -void BrowserURLHandlerCreated(content::BrowserURLHandler* handler); - -// Returns true if WebUI is allowed to make network requests. -bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin); - -} // namespace scheme - -#endif // CEF_LIBCEF_BROWSER_CHROME_SCHEME_HANDLER_H_ diff --git a/libcef/resources/about_version.html b/libcef/resources/about_version.html deleted file mode 100644 index 7d479c0dc..000000000 --- a/libcef/resources/about_version.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - About Version - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CEF$$CEF$$
Chromium$$CHROMIUM$$
OS$$OS$$
WebKit$$WEBKIT$$
JavaScript$$JAVASCRIPT$$
User Agent$$USERAGENT$$
Command Line$$COMMANDLINE$$
Module Path$$MODULEPATH$$
Root Cache Path [1][2]$$ROOTCACHEPATH$$
Cache Path [1]$$CACHEPATH$$
-
[1] In Chromium terminology, - "Root Cache Path" (CefSettings.root_cache_path) - is the "User Data Directory" and "Cache Path" (CefSettings.cache_path) - is the "Profile Path". An empty "Cache Path" value means that the browser is using an Incognito Profile. - Even in Incognito mode, some per-installation data will still be written to the "Root Cache Path" directory. -

[2] Chromium's process singleton lock - protects against multiple app instances writing to the same "Root Cache Path" directory. - Implement CefBrowserProcessHandler:: OnAlreadyRunningAppRelaunch - to handle the case of app relaunch with the same directory. -
-
- - - - diff --git a/libcef/resources/cef_resources.grd b/libcef/resources/cef_resources.grd index 30a09710c..9cab7c5ca 100644 --- a/libcef/resources/cef_resources.grd +++ b/libcef/resources/cef_resources.grd @@ -10,7 +10,6 @@ - diff --git a/patch/patch.cfg b/patch/patch.cfg index c560e4e1d..453333f1b 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -332,6 +332,14 @@ patches = [ # Fix Jumbo/component build dependency issue. 'name': 'chrome_browser_safe_browsing', }, + { + # Support loading of chrome://license via WebUI. + 'name': 'chrome_browser_webui_license', + }, + { + # Support customization of chrome://version WebUI. + 'name': 'chrome_browser_webui_version', + }, { # Add BrowserPluginGuest::owner_web_contents() method. 'name': 'chrome_plugins', @@ -466,15 +474,6 @@ patches = [ # This crash was introduced by https://crrev.com/5f6212babf. 'name': 'browser_scheduler', }, - { - # Restore access to WebUIControllerFactory::UnregisterFactoryForTesting - # which was removed in https://crrev.com/5f183d6636. We can't use - # ScopedWebUIControllerFactoryRegistration because it pulls in GTest - # dependencies. - # - # Add accessor for WebUIConfigMap::webui_controller_factory_. - 'name': 'browser_web_ui_controller_factory', - }, { # Add support for OSR rendering with Viz. # https://github.com/chromiumembedded/cef/issues/2575 diff --git a/patch/patches/browser_web_ui_controller_factory.patch b/patch/patches/browser_web_ui_controller_factory.patch deleted file mode 100644 index 16b5185c5..000000000 --- a/patch/patches/browser_web_ui_controller_factory.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git content/public/browser/web_ui_controller_factory.h content/public/browser/web_ui_controller_factory.h -index 9d9c17ffd6474..4eb79c65369af 100644 ---- content/public/browser/web_ui_controller_factory.h -+++ content/public/browser/web_ui_controller_factory.h -@@ -47,9 +47,6 @@ class CONTENT_EXPORT WebUIControllerFactory { - virtual bool UseWebUIForURL(BrowserContext* browser_context, - const GURL& url) = 0; - -- private: -- friend class ScopedWebUIControllerFactoryRegistration; -- - static void UnregisterFactoryForTesting(WebUIControllerFactory* factory); - }; - -diff --git content/public/browser/webui_config_map.h content/public/browser/webui_config_map.h -index e7b6a9b841abb..1c98be86c0db1 100644 ---- content/public/browser/webui_config_map.h -+++ content/public/browser/webui_config_map.h -@@ -68,6 +68,10 @@ class CONTENT_EXPORT WebUIConfigMap { - std::vector GetWebUIConfigList( - BrowserContext* browser_context); - -+ WebUIControllerFactory* controller_factory() const { -+ return webui_controller_factory_.get(); -+ } -+ - private: - void AddWebUIConfigImpl(std::unique_ptr config); - diff --git a/patch/patches/chrome_browser_browser.patch b/patch/patches/chrome_browser_browser.patch index 805e07605..496ecf889 100644 --- a/patch/patches/chrome_browser_browser.patch +++ b/patch/patches/chrome_browser_browser.patch @@ -74,7 +74,7 @@ index 02ff1e580d3a7..7f51115896049 100644 } diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn -index 74460ac479210..8cf70c80a87ad 100644 +index 74460ac479210..c484be466eefb 100644 --- chrome/browser/ui/BUILD.gn +++ chrome/browser/ui/BUILD.gn @@ -8,6 +8,7 @@ import("//build/config/compiler/compiler.gni") @@ -104,7 +104,18 @@ index 74460ac479210..8cf70c80a87ad 100644 "//chrome:resources", "//chrome:strings", "//chrome/app:chrome_dll_resources", -@@ -3040,6 +3046,8 @@ static_library("ui") { +@@ -759,6 +765,10 @@ static_library("ui") { + deps += [ "//components/plus_addresses/resources:vector_icons" ] + } + ++ if (enable_cef) { ++ deps += [ "//cef:cef_resources" ] ++ } ++ + # TODO(crbug.com/41437292): Remove this circular dependency. + allow_circular_includes_from = [ + # TODO(crbug.com/40161499): Remove this circular dependency. +@@ -3040,6 +3050,8 @@ static_library("ui") { "views/apps/app_dialog/app_local_block_dialog_view.h", "views/apps/app_dialog/app_pause_dialog_view.cc", "views/apps/app_dialog/app_pause_dialog_view.h", @@ -113,7 +124,7 @@ index 74460ac479210..8cf70c80a87ad 100644 "views/apps/app_info_dialog/arc_app_info_links_panel.cc", "views/apps/app_info_dialog/arc_app_info_links_panel.h", "views/apps/chrome_app_window_client_views_chromeos.cc", -@@ -4249,8 +4257,6 @@ static_library("ui") { +@@ -4249,8 +4261,6 @@ static_library("ui") { "autofill/payments/webauthn_dialog_model.h", "autofill/payments/webauthn_dialog_model_observer.h", "autofill/payments/webauthn_dialog_state.h", @@ -122,7 +133,7 @@ index 74460ac479210..8cf70c80a87ad 100644 "incognito_clear_browsing_data_dialog_interface.h", "signin/signin_modal_dialog.cc", "signin/signin_modal_dialog.h", -@@ -5125,8 +5131,6 @@ static_library("ui") { +@@ -5125,8 +5135,6 @@ static_library("ui") { "views/accessibility/theme_tracking_non_accessible_image_view.h", "views/apps/app_dialog/app_dialog_view.cc", "views/apps/app_dialog/app_dialog_view.h", @@ -131,7 +142,7 @@ index 74460ac479210..8cf70c80a87ad 100644 "views/apps/app_info_dialog/app_info_dialog_container.cc", "views/apps/app_info_dialog/app_info_dialog_container.h", "views/apps/app_info_dialog/app_info_dialog_views.cc", -@@ -6908,6 +6912,7 @@ static_library("ui") { +@@ -6908,6 +6916,7 @@ static_library("ui") { if (enable_printing) { deps += [ "//components/printing/browser", diff --git a/patch/patches/chrome_browser_webui_license.patch b/patch/patches/chrome_browser_webui_license.patch new file mode 100644 index 000000000..417db6aeb --- /dev/null +++ b/patch/patches/chrome_browser_webui_license.patch @@ -0,0 +1,120 @@ +diff --git chrome/browser/ui/webui/about/about_ui.cc chrome/browser/ui/webui/about/about_ui.cc +index 7d04b86885167..b89b060efc9e0 100644 +--- chrome/browser/ui/webui/about/about_ui.cc ++++ chrome/browser/ui/webui/about/about_ui.cc +@@ -34,6 +34,7 @@ + #include "base/values.h" + #include "build/build_config.h" + #include "build/chromeos_buildflags.h" ++#include "cef/libcef/features/features.h" + #include "chrome/browser/about_flags.h" + #include "chrome/browser/browser_process.h" + #include "chrome/browser/profiles/profile.h" +@@ -91,6 +92,10 @@ + #include "chrome/common/webui_url_constants.h" + #endif // BUILDFLAG(IS_CHROMEOS) + ++#if BUILDFLAG(ENABLE_CEF) ++#include "cef/grit/cef_resources.h" ++#endif ++ + using content::BrowserThread; + + namespace { +@@ -692,6 +697,16 @@ void AboutUIHTMLSource::StartDataRequest( + IDS_TERMS_HTML); + #endif + } ++#if BUILDFLAG(ENABLE_CEF) ++ else if (source_name_ == chrome::kChromeUILicenseHost) { ++ response = ++ "CEF License" ++ "
" +
++        ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
++            IDR_CEF_LICENSE_TXT) +
++        "
"; ++ } ++#endif + + FinishDataRequest(response, std::move(callback)); + } +diff --git chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +index 7b61f43d8c72a..811d075966239 100644 +--- chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc ++++ chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +@@ -18,6 +18,7 @@ + #include "build/branding_buildflags.h" + #include "build/build_config.h" + #include "build/chromeos_buildflags.h" ++#include "cef/libcef/features/features.h" + #include "chrome/browser/about_flags.h" + #include "chrome/browser/buildflags.h" + #include "chrome/browser/commerce/shopping_service_factory.h" +@@ -391,6 +392,9 @@ bool IsAboutUI(const GURL& url) { + || url.host_piece() == chrome::kChromeUIOSCreditsHost || + url.host_piece() == chrome::kChromeUIBorealisCreditsHost || + url.host_piece() == chrome::kChromeUICrostiniCreditsHost ++#endif ++#if BUILDFLAG(ENABLE_CEF) ++ || url.host_piece() == chrome::kChromeUILicenseHost + #endif + ); // NOLINT + } +@@ -1019,6 +1023,9 @@ ChromeWebUIControllerFactory::GetListOfAcceptableURLs() { + GURL(chrome::kChromeUIGpuURL), + GURL(chrome::kChromeUIHistogramsURL), + GURL(chrome::kChromeUIInspectURL), ++#if BUILDFLAG(ENABLE_CEF) ++ GURL(chrome::kChromeUILicenseURL), ++#endif + GURL(chrome::kChromeUIManagementURL), + GURL(chrome::kChromeUINetExportURL), + GURL(chrome::kChromeUIPrefsInternalsURL), +diff --git chrome/common/webui_url_constants.cc chrome/common/webui_url_constants.cc +index 4604facee295e..acd8857875d6e 100644 +--- chrome/common/webui_url_constants.cc ++++ chrome/common/webui_url_constants.cc +@@ -131,6 +131,10 @@ const char kChromeUILauncherInternalsHost[] = "launcher-internals"; + const char kChromeUILauncherInternalsURL[] = "chrome://launcher-internals"; + const char kChromeUILensSearchBubbleHost[] = "lens-search-bubble"; + const char kChromeUILensSearchBubbleURL[] = "chrome://lens-search-bubble/"; ++#if BUILDFLAG(ENABLE_CEF) ++const char kChromeUILicenseHost[] = "license"; ++const char kChromeUILicenseURL[] = "chrome://license/"; ++#endif + const char kChromeUISensorInfoHost[] = "sensor-info"; + const char kChromeUISensorInfoURL[] = "chrome://sensor-info/"; + const char kChromeUILocalStateHost[] = "local-state"; +@@ -704,6 +708,9 @@ const char* const kChromeHostURLs[] = { + kChromeUIHumanPresenceInternalsHost, + #endif + kChromeUIInterstitialHost, ++#if BUILDFLAG(ENABLE_CEF) ++ kChromeUILicenseHost, ++#endif + kChromeUILocalStateHost, + #if !BUILDFLAG(IS_ANDROID) + kChromeUIManagementHost, +diff --git chrome/common/webui_url_constants.h chrome/common/webui_url_constants.h +index b1247ef8ad3ff..a4ebfe2d585a0 100644 +--- chrome/common/webui_url_constants.h ++++ chrome/common/webui_url_constants.h +@@ -15,6 +15,7 @@ + #include "build/branding_buildflags.h" + #include "build/build_config.h" + #include "build/chromeos_buildflags.h" ++#include "cef/libcef/features/features.h" + #include "chrome/common/buildflags.h" + #include "components/lens/buildflags.h" + #include "content/public/common/url_constants.h" +@@ -123,6 +124,10 @@ extern const char kChromeUILauncherInternalsHost[]; + extern const char kChromeUILauncherInternalsURL[]; + extern const char kChromeUILensSearchBubbleHost[]; + extern const char kChromeUILensSearchBubbleURL[]; ++#if BUILDFLAG(ENABLE_CEF) ++extern const char kChromeUILicenseHost[]; ++extern const char kChromeUILicenseURL[]; ++#endif + extern const char kChromeUISensorInfoURL[]; + extern const char kChromeUISensorInfoHost[]; + extern const char kChromeUILocalStateHost[]; diff --git a/patch/patches/chrome_browser_webui_version.patch b/patch/patches/chrome_browser_webui_version.patch new file mode 100644 index 000000000..6b1e504b5 --- /dev/null +++ b/patch/patches/chrome_browser_webui_version.patch @@ -0,0 +1,381 @@ +diff --git chrome/browser/ui/webui/version/version_handler.cc chrome/browser/ui/webui/version/version_handler.cc +index 55541159e5fc8..8021d1d963f59 100644 +--- chrome/browser/ui/webui/version/version_handler.cc ++++ chrome/browser/ui/webui/version/version_handler.cc +@@ -27,12 +27,23 @@ + #include "ui/base/l10n/l10n_util.h" + #include "url/gurl.h" + ++#if BUILDFLAG(ENABLE_CEF) ++#include "base/base_paths.h" ++#include "base/path_service.h" ++#include "chrome/common/chrome_paths.h" ++#endif ++ + namespace { + + // Retrieves the executable and profile paths on the FILE thread. + void GetFilePaths(const base::FilePath& profile_path, + std::u16string* exec_path_out, +- std::u16string* profile_path_out) { ++ std::u16string* profile_path_out ++#if BUILDFLAG(ENABLE_CEF) ++ , std::u16string* module_path_out, ++ std::u16string* user_data_path_out ++#endif ++ ) { + base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, + base::BlockingType::MAY_BLOCK); + +@@ -48,6 +59,19 @@ void GetFilePaths(const base::FilePath& profile_path, + *profile_path_out = profile_path.LossyDisplayName(); + else + *profile_path_out = l10n_util::GetStringUTF16(IDS_VERSION_UI_PATH_NOTFOUND); ++ ++#if BUILDFLAG(ENABLE_CEF) ++ base::FilePath module_path; ++ if (base::PathService::Get(base::FILE_MODULE, &module_path)) { ++ *module_path_out = module_path.LossyDisplayName(); ++ } else { ++ *module_path_out = l10n_util::GetStringUTF16(IDS_VERSION_UI_PATH_NOTFOUND); ++ } ++ ++ base::FilePath user_data_dir = ++ base::PathService::CheckedGet(chrome::DIR_USER_DATA); ++ *user_data_path_out = user_data_dir.LossyDisplayName(); ++#endif + } + + } // namespace +@@ -111,23 +135,46 @@ void VersionHandler::HandleRequestPathInfo(const base::Value::List& args) { + // OnGotFilePaths. + std::u16string* exec_path_buffer = new std::u16string; + std::u16string* profile_path_buffer = new std::u16string; ++#if BUILDFLAG(ENABLE_CEF) ++ std::u16string* module_path_buffer = new std::u16string; ++ std::u16string* user_data_path_buffer = new std::u16string; ++#endif + base::ThreadPool::PostTaskAndReply( + FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()}, + base::BindOnce(&GetFilePaths, Profile::FromWebUI(web_ui())->GetPath(), + base::Unretained(exec_path_buffer), +- base::Unretained(profile_path_buffer)), ++ base::Unretained(profile_path_buffer) ++#if BUILDFLAG(ENABLE_CEF) ++ , base::Unretained(module_path_buffer), ++ base::Unretained(user_data_path_buffer) ++#endif ++ ), + base::BindOnce(&VersionHandler::OnGotFilePaths, + weak_ptr_factory_.GetWeakPtr(), callback_id, + base::Owned(exec_path_buffer), +- base::Owned(profile_path_buffer))); ++ base::Owned(profile_path_buffer) ++#if BUILDFLAG(ENABLE_CEF) ++ , base::Owned(module_path_buffer), ++ base::Owned(user_data_path_buffer) ++#endif ++ )); + } + + void VersionHandler::OnGotFilePaths(std::string callback_id, + std::u16string* executable_path_data, +- std::u16string* profile_path_data) { ++ std::u16string* profile_path_data ++#if BUILDFLAG(ENABLE_CEF) ++ , std::u16string* module_path_data, ++ std::u16string* user_data_path_data ++#endif ++ ) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + base::Value::Dict response; + response.Set(version_ui::kKeyExecPath, *executable_path_data); + response.Set(version_ui::kKeyProfilePath, *profile_path_data); ++#if BUILDFLAG(ENABLE_CEF) ++ response.Set(version_ui::kKeyModulePath, *module_path_data); ++ response.Set(version_ui::kKeyUserDataPath, *user_data_path_data); ++#endif + ResolveJavascriptCallback(base::Value(callback_id), response); + } +diff --git chrome/browser/ui/webui/version/version_handler.h chrome/browser/ui/webui/version/version_handler.h +index 2f8162d7491d1..b00f0d5bf26ae 100644 +--- chrome/browser/ui/webui/version/version_handler.h ++++ chrome/browser/ui/webui/version/version_handler.h +@@ -9,6 +9,7 @@ + + #include "base/memory/weak_ptr.h" + #include "base/values.h" ++#include "cef/libcef/features/features.h" + #include "content/public/browser/web_ui_message_handler.h" + + // Handler class for Version page operations. +@@ -44,7 +45,12 @@ class VersionHandler : public content::WebUIMessageHandler { + // front end. + void OnGotFilePaths(std::string callback_id, + std::u16string* executable_path_data, +- std::u16string* profile_path_data); ++ std::u16string* profile_path_data ++#if BUILDFLAG(ENABLE_CEF) ++ , std::u16string* module_path_data, ++ std::u16string* user_data_path_data ++#endif ++ ); + + // Factory for the creating refs in callbacks. + base::WeakPtrFactory weak_ptr_factory_{this}; +diff --git chrome/browser/ui/webui/version/version_ui.cc chrome/browser/ui/webui/version/version_ui.cc +index 6e205bf700de2..c281769b5cb5c 100644 +--- chrome/browser/ui/webui/version/version_ui.cc ++++ chrome/browser/ui/webui/version/version_ui.cc +@@ -17,6 +17,7 @@ + #include "base/time/time.h" + #include "build/build_config.h" + #include "build/chromeos_buildflags.h" ++#include "cef/libcef/features/features.h" + #include "chrome/browser/browser_process_impl.h" + #include "chrome/browser/profiles/profile.h" + #include "chrome/browser/ui/webui/version/version_handler.h" +@@ -64,6 +65,10 @@ + #include "chrome/browser/ui/webui/version/version_util_win.h" + #endif + ++#if BUILDFLAG(ENABLE_CEF) ++#include "cef/include/cef_version.h" ++#endif ++ + using content::WebUIDataSource; + + namespace { +@@ -84,6 +89,10 @@ void CreateAndAddVersionUIDataSource(Profile* profile) { + {version_ui::kCommandLineName, IDS_VERSION_UI_COMMAND_LINE}, + {version_ui::kExecutablePathName, IDS_VERSION_UI_EXECUTABLE_PATH}, + {version_ui::kProfilePathName, IDS_VERSION_UI_PROFILE_PATH}, ++#if BUILDFLAG(ENABLE_CEF) ++ {version_ui::kModulePathName, IDS_VERSION_UI_MODULE_PATH}, ++ {version_ui::kUserDataPathName, IDS_VERSION_UI_USER_DATA_PATH}, ++#endif + {version_ui::kVariationsName, IDS_VERSION_UI_VARIATIONS}, + {version_ui::kVariationsCmdName, IDS_VERSION_UI_VARIATIONS_CMD}, + {version_ui::kVariationsSeedName, IDS_VERSION_UI_VARIATIONS_SEED_NAME}, +@@ -121,6 +130,10 @@ void CreateAndAddVersionUIDataSource(Profile* profile) { + IDR_PRODUCT_LOGO_WHITE); + #endif // BUILDFLAG(IS_ANDROID) + html_source->SetDefaultResource(IDR_VERSION_UI_ABOUT_VERSION_HTML); ++ ++#if BUILDFLAG(ENABLE_CEF) ++ html_source->AddString(version_ui::kCefVersion, CEF_VERSION); ++#endif + } + + std::string GetProductModifier() { +@@ -241,6 +254,10 @@ void VersionUI::AddVersionDetailStrings(content::WebUIDataSource* html_source) { + // blank. + html_source->AddString(version_ui::kExecutablePath, std::string()); + html_source->AddString(version_ui::kProfilePath, std::string()); ++#if BUILDFLAG(ENABLE_CEF) ++ html_source->AddString(version_ui::kModulePath, std::string()); ++ html_source->AddString(version_ui::kUserDataPath, std::string()); ++#endif + + #if BUILDFLAG(IS_MAC) + html_source->AddString(version_ui::kOSType, base::mac::GetOSDisplayName()); +diff --git components/version_ui/BUILD.gn components/version_ui/BUILD.gn +index 913cf913dca7a..d79c330989149 100644 +--- components/version_ui/BUILD.gn ++++ components/version_ui/BUILD.gn +@@ -2,6 +2,8 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//cef/libcef/features/features.gni") ++ + static_library("version_ui") { + sources = [ + "version_handler_helper.cc", +@@ -17,4 +19,8 @@ static_library("version_ui") { + "//components/variations/net", + "//components/variations/service", + ] ++ ++ if (enable_cef) { ++ configs += [ "//cef/libcef/features:config" ] ++ } + } +diff --git components/version_ui/resources/about_version.css components/version_ui/resources/about_version.css +index 6b753d716b55d..58d6419be0165 100644 +--- components/version_ui/resources/about_version.css ++++ components/version_ui/resources/about_version.css +@@ -135,3 +135,7 @@ body { + position: fixed; + width: 1px; + } ++ ++#footnote { ++ font-size: 0.8em; ++} +diff --git components/version_ui/resources/about_version.html components/version_ui/resources/about_version.html +index 508c4ecfd790f..fed6933908951 100644 +--- components/version_ui/resources/about_version.html ++++ components/version_ui/resources/about_version.html +@@ -62,9 +62,21 @@ about:version template page + + +
$i18n{company}
+- ++ + + ++ ++ ++ ++ ++ ++ + + + + +- ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -198,6 +218,17 @@ about:version template page + + +
CEF ++ $i18n{cef_version} ++
$i18n{application_label} + +@@ -171,7 +183,15 @@ about:version template page +
$i18n{executable_path_name}$i18n{executable_path}
$i18n{profile_path_name}
$i18n{module_path_name}$i18n{module_path}
$i18n{user_data_path_name} [*]$i18n{user_data_path}
$i18n{profile_path_name} [*]$i18n{profile_path}
$i18n{sanitizer}
++ ++
++
[*] In Chromium terminology, ++ CefSettings.root_cache_path ++ is the "$i18n{user_data_path_name}" and CefSettings.cache_path ++ is the "$i18n{profile_path_name}". Chromium's process singleton lock ++ protects against multiple app instances writing to the same "$i18n{user_data_path_name}" directory. ++ Implement CefBrowserProcessHandler:: OnAlreadyRunningAppRelaunch ++ to handle the case of app relaunch with the same directory. ++
++
+ + +