mirror of
https://github.com/aphrody-labs/cef.git
synced 2026-10-14 05:09:23 +00:00
- Windows SDK 10.0.28000.2270 is now required - CefRegisterExtension is deprecated due to https://crbug.com/40347662
395 lines
17 KiB
Diff
395 lines
17 KiB
Diff
diff --git chrome/browser/ui/webui/version/version_handler.cc chrome/browser/ui/webui/version/version_handler.cc
|
|
index 410556c4bdeadc18c7f057e2ed08e8daba21d2a0..68613ed1b25745e226887a1c8457777519d660b9 100644
|
|
--- chrome/browser/ui/webui/version/version_handler.cc
|
|
+++ chrome/browser/ui/webui/version/version_handler.cc
|
|
@@ -28,12 +28,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);
|
|
|
|
@@ -51,6 +62,19 @@ void GetFilePaths(const base::FilePath& profile_path,
|
|
} 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
|
|
@@ -122,23 +146,46 @@ void VersionHandler::HandleRequestPathInfo(const base::ListValue& 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::DictValue 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 7d1beedfffbfdd34323cfb749bec83187b54778e..d4c79e26e51deb9a32fb9649a1c21a1874ea48c7 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<VersionHandler> weak_ptr_factory_{this};
|
|
diff --git chrome/browser/ui/webui/version/version_ui.cc chrome/browser/ui/webui/version/version_ui.cc
|
|
index 4c523d48d8f8537042a9483e4fd0c6d163c8de52..35a8e8de47893687e3a11a762c7101a358b252e0 100644
|
|
--- chrome/browser/ui/webui/version/version_ui.cc
|
|
+++ chrome/browser/ui/webui/version/version_ui.cc
|
|
@@ -19,6 +19,7 @@
|
|
#include "base/strings/utf_string_conversions.h"
|
|
#include "base/time/time.h"
|
|
#include "build/build_config.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::kCopyVariationsLabel, IDS_VERSION_UI_COPY_VARIATIONS_LABEL},
|
|
@@ -122,6 +131,10 @@ void CreateAndAddVersionUIDataSource(Profile* profile) {
|
|
html_source->AddResourcePath("images/product_logo_white.png",
|
|
IDR_PRODUCT_LOGO_WHITE);
|
|
#endif // BUILDFLAG(IS_ANDROID)
|
|
+
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+ html_source->AddString(version_ui::kCefVersion, CEF_VERSION);
|
|
+#endif
|
|
}
|
|
|
|
std::string GetProductModifier() {
|
|
@@ -269,6 +282,10 @@ void VersionUI::AddVersionDetailStrings(content::WebUIDataSource* html_source) {
|
|
// blank.
|
|
html_source->AddString(version_ui::kExecutablePath, std::string_view());
|
|
html_source->AddString(version_ui::kProfilePath, std::string_view());
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+ html_source->AddString(version_ui::kModulePath, std::string_view());
|
|
+ html_source->AddString(version_ui::kUserDataPath, std::string_view());
|
|
+#endif
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
|
html_source->AddString(version_ui::kOSType, base::mac::GetOSDisplayName());
|
|
diff --git components/version_ui_strings.grdp components/version_ui_strings.grdp
|
|
index 83e3e6aaa3d6308b0076c02e300237f88601e447..34516979ef9bdd62ead7507334f89654403540a4 100644
|
|
--- components/version_ui_strings.grdp
|
|
+++ components/version_ui_strings.grdp
|
|
@@ -78,6 +78,14 @@
|
|
<message name="IDS_VERSION_UI_PROFILE_PATH" desc="label for the profile path on the about:version page">
|
|
Profile Path
|
|
</message>
|
|
+ <if expr="enable_cef">
|
|
+ <message name="IDS_VERSION_UI_MODULE_PATH" desc="label for the module path on the about:version page">
|
|
+ Module Path
|
|
+ </message>
|
|
+ <message name="IDS_VERSION_UI_USER_DATA_PATH" desc="label for the user data path on the about:version page">
|
|
+ User Data Path
|
|
+ </message>
|
|
+ </if>
|
|
<message name="IDS_VERSION_UI_PATH_NOTFOUND" desc="label for the non-existent path on the about:version page">
|
|
No such file or directory
|
|
</message>
|
|
diff --git components/webui/version/BUILD.gn components/webui/version/BUILD.gn
|
|
index 2193019afd18eac09e7812737dc2de3533c2f404..42ec99b0a4673f9ba7c8bbd568a18fa888efe96e 100644
|
|
--- components/webui/version/BUILD.gn
|
|
+++ components/webui/version/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") {
|
|
sources = [
|
|
"version_handler_helper.cc",
|
|
@@ -16,4 +18,8 @@ static_library("version") {
|
|
"//components/variations/net",
|
|
"//components/variations/service",
|
|
]
|
|
+
|
|
+ if (enable_cef) {
|
|
+ configs += [ "//cef/libcef/features:config" ]
|
|
+ }
|
|
}
|
|
diff --git components/webui/version/resources/about_version.css components/webui/version/resources/about_version.css
|
|
index 5b7c6b03bf496988401e0b0d961f5beed5067563..b0f9216b789590395edeeba396c552e884cb7812 100644
|
|
--- components/webui/version/resources/about_version.css
|
|
+++ components/webui/version/resources/about_version.css
|
|
@@ -135,3 +135,7 @@ html[webui-rounded-icons] #copy-to-clipboard-icon {
|
|
position: fixed;
|
|
width: 1px;
|
|
}
|
|
+
|
|
+#footnote {
|
|
+ font-size: 0.8em;
|
|
+}
|
|
diff --git components/webui/version/resources/about_version.html components/webui/version/resources/about_version.html
|
|
index 950b0a5c4895e81eb5c7b3e5736a5d5610b32bd9..840c4baf591a40f7b4845a63ae72e5f1bb811ea1 100644
|
|
--- components/webui/version/resources/about_version.html
|
|
+++ components/webui/version/resources/about_version.html
|
|
@@ -49,9 +49,21 @@ about:version template page
|
|
</picture>
|
|
</if>
|
|
<div id="company">$i18n{company}</div>
|
|
- <div id="copyright">$i18n{copyright}</div>
|
|
+ <div id="copyright">$i18n{copyright}
|
|
+<if expr="enable_cef">
|
|
+ <br/><a href="chrome://license">license</a> | <a href="chrome://credits">credits</a>
|
|
+</if>
|
|
+ </div>
|
|
</div>
|
|
<table id="inner" cellpadding="0" cellspacing="0" border="0">
|
|
+<if expr="enable_cef">
|
|
+ <tr>
|
|
+ <td class="label">CEF</td>
|
|
+ <td class="version">
|
|
+ <span>$i18n{cef_version}</span>
|
|
+ </td>
|
|
+ </tr>
|
|
+</if>
|
|
<tr><td class="label">$i18n{application_label}</td>
|
|
<td class="version" id="version">
|
|
<span id="copy-content">
|
|
@@ -155,7 +167,15 @@ about:version template page
|
|
<tr><td class="label">$i18n{executable_path_name}</td>
|
|
<td class="version" id="executable_path">$i18n{executable_path}</td>
|
|
</tr>
|
|
- <tr><td class="label">$i18n{profile_path_name}</td>
|
|
+<if expr="enable_cef">
|
|
+ <tr><td class="label">$i18n{module_path_name}</td>
|
|
+ <td class="version" id="module_path">$i18n{module_path}</td>
|
|
+ </tr>
|
|
+ <tr><td class="label">$i18n{user_data_path_name} <sup><a href="#footnote">[*]</a></sup></td>
|
|
+ <td class="version" id="user_data_path">$i18n{user_data_path}</td>
|
|
+ </tr>
|
|
+</if>
|
|
+ <tr><td class="label">$i18n{profile_path_name} <sup><a href="#footnote">[*]</a></sup></td>
|
|
<td class="version" id="profile_path">$i18n{profile_path}</td>
|
|
</tr>
|
|
</if>
|
|
@@ -198,6 +218,17 @@ about:version template page
|
|
<td class="version" id="sanitizer">$i18n{sanitizer}</td>
|
|
</tr>
|
|
</table>
|
|
+<if expr="enable_cef">
|
|
+ <div id="footnote">
|
|
+ <br/><a name="footnote">[*] In <a href="https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md" target="_new">Chromium terminology</a>,
|
|
+ <a href="https://cef-builds.spotifycdn.com/docs/stable.html?structcef__settings__t.html#a2e2be03f34ddd93de90e1cf196757a19" target="_new">CefSettings.root_cache_path</a>
|
|
+ is the "$i18n{user_data_path_name}" and <a href="https://cef-builds.spotifycdn.com/docs/stable.html?structcef__settings__t.html#ad1644a7eb23cad969181db010f007710" target="_new">CefSettings.cache_path</a>
|
|
+ is the "$i18n{profile_path_name}". Chromium's <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/browser/process_singleton.h#35" target="_new">process singleton lock</a>
|
|
+ protects against multiple app instances writing to the same "$i18n{user_data_path_name}" directory.
|
|
+ Implement <a href="https://cef-builds.spotifycdn.com/docs/stable.html?classCefBrowserProcessHandler.html#a052a91639483467c0b546d57a05c2f06" target="_new">CefBrowserProcessHandler:: OnAlreadyRunningAppRelaunch</a>
|
|
+ to handle the case of app relaunch with the same directory.
|
|
+ </div>
|
|
+</if>
|
|
</div>
|
|
|
|
<div id="messages" role="alert" aria-live="polite" aria-relevant="additions">
|
|
diff --git components/webui/version/resources/about_version.ts components/webui/version/resources/about_version.ts
|
|
index 105c2e28e6ecdab82246a67cca35a512681c4a1d..e478b8c23ee7235091c1548100046eb7f46b772a 100644
|
|
--- components/webui/version/resources/about_version.ts
|
|
+++ components/webui/version/resources/about_version.ts
|
|
@@ -76,9 +76,21 @@ function handleVariationInfo(
|
|
* @param profilePath The profile path to display.
|
|
*/
|
|
function handlePathInfo(
|
|
- {execPath, profilePath}: {execPath: string, profilePath: string}) {
|
|
+ {execPath, profilePath
|
|
+// <if expr="enable_cef">
|
|
+ , modulePath, userDataPath
|
|
+// </if>
|
|
+ }: {execPath: string, profilePath: string
|
|
+// <if expr="enable_cef">
|
|
+ , modulePath: string, userDataPath: string
|
|
+// </if>
|
|
+ }) {
|
|
getRequiredElement('executable_path').textContent = execPath;
|
|
getRequiredElement('profile_path').textContent = profilePath;
|
|
+// <if expr="enable_cef">
|
|
+ getRequiredElement('module_path').textContent = modulePath;
|
|
+ getRequiredElement('user_data_path').textContent = userDataPath;
|
|
+// </if>
|
|
}
|
|
|
|
// <if expr="is_win">
|
|
@@ -196,7 +208,11 @@ function initialize() {
|
|
sendWithPromise<{variationsList: string[], variationsCmd: string}>(
|
|
'requestVariationInfo', includeVariationsCmd)
|
|
.then(handleVariationInfo);
|
|
- sendWithPromise<{execPath: string, profilePath: string}>('requestPathInfo')
|
|
+ sendWithPromise<{execPath: string, profilePath: string
|
|
+// <if expr="enable_cef">
|
|
+ , modulePath: string, userDataPath: string
|
|
+// </if>
|
|
+ }>('requestPathInfo')
|
|
.then(handlePathInfo);
|
|
|
|
if (getRequiredElement('variations-source').textContent !== '') {
|
|
diff --git components/webui/version/version_ui_constants.cc components/webui/version/version_ui_constants.cc
|
|
index 7b7be3eae6656d88030eb927f522de01550f8ff6..af7a2b21a8344e2089bb68fa0f8659b8558d6adf 100644
|
|
--- components/webui/version/version_ui_constants.cc
|
|
+++ components/webui/version/version_ui_constants.cc
|
|
@@ -5,6 +5,7 @@
|
|
#include "components/webui/version/version_ui_constants.h"
|
|
|
|
#include "build/build_config.h"
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
namespace version_ui {
|
|
|
|
@@ -92,4 +93,15 @@ const char kVersionSuffix[] = "version_suffix";
|
|
const char kVersionModifier[] = "version_modifier";
|
|
const char kVersionProcessorVariation[] = "version_processor_variation";
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+const char kKeyModulePath[] = "modulePath";
|
|
+const char kKeyUserDataPath[] = "userDataPath";
|
|
+
|
|
+const char kCefVersion[] = "cef_version";
|
|
+const char kModulePath[] = "module_path";
|
|
+const char kModulePathName[] = "module_path_name";
|
|
+const char kUserDataPath[] = "user_data_path";
|
|
+const char kUserDataPathName[] = "user_data_path_name";
|
|
+#endif
|
|
+
|
|
} // namespace version_ui
|
|
diff --git components/webui/version/version_ui_constants.h components/webui/version/version_ui_constants.h
|
|
index 775826ee0b02062373fb17beee17c471dfdcf19b..713173878f6486eb549dc2db44042662fc23e57f 100644
|
|
--- components/webui/version/version_ui_constants.h
|
|
+++ components/webui/version/version_ui_constants.h
|
|
@@ -6,6 +6,7 @@
|
|
#define COMPONENTS_WEBUI_VERSION_VERSION_UI_CONSTANTS_H_
|
|
|
|
#include "build/build_config.h"
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
namespace version_ui {
|
|
|
|
@@ -96,6 +97,17 @@ extern const char kVersionSuffix[];
|
|
extern const char kVersionModifier[];
|
|
extern const char kVersionProcessorVariation[];
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+extern const char kKeyModulePath[];
|
|
+extern const char kKeyUserDataPath[];
|
|
+
|
|
+extern const char kCefVersion[];
|
|
+extern const char kModulePath[];
|
|
+extern const char kModulePathName[];
|
|
+extern const char kUserDataPath[];
|
|
+extern const char kUserDataPathName[];
|
|
+#endif
|
|
+
|
|
} // namespace version_ui
|
|
|
|
#endif // COMPONENTS_WEBUI_VERSION_VERSION_UI_CONSTANTS_H_
|