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 f12ad5b23e75c..0f07abc1b85f5 100644 --- chrome/browser/ui/webui/version/version_ui.cc +++ chrome/browser/ui/webui/version/version_ui.cc @@ -22,6 +22,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" @@ -69,6 +70,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 { @@ -89,6 +94,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}, @@ -126,6 +135,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() { @@ -246,6 +259,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. +
+