2023-11-21 01:35:05 +01:00
|
|
|
diff --git chrome/browser/win/app_icon.cc chrome/browser/win/app_icon.cc
|
2023-11-21 17:24:20 +01:00
|
|
|
index db721b75aad6f..fac8b38c7dde7 100644
|
2023-11-21 01:35:05 +01:00
|
|
|
--- chrome/browser/win/app_icon.cc
|
|
|
|
+++ chrome/browser/win/app_icon.cc
|
2023-11-21 17:24:20 +01:00
|
|
|
@@ -18,13 +18,26 @@ int GetAppIconResourceId() {
|
|
|
|
return install_static::InstallDetails::Get().app_icon_resource_id();
|
|
|
|
}
|
|
|
|
|
|
|
|
+int g_exe_app_icon_resource_id = 0;
|
|
|
|
+
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
+void SetExeAppIconResourceId(int icon_id) {
|
|
|
|
+ g_exe_app_icon_resource_id = icon_id;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
HICON GetAppIcon() {
|
|
|
|
// TODO(mgiuca): Use GetAppIconImageFamily/CreateExact instead of LoadIcon, to
|
2023-11-21 01:35:05 +01:00
|
|
|
// get correct scaling. (See http://crbug.com/551256)
|
2023-11-21 17:24:20 +01:00
|
|
|
- const int icon_id = GetAppIconResourceId();
|
2023-11-21 01:35:05 +01:00
|
|
|
// HICON returned from LoadIcon do not leak and do not have to be destroyed.
|
2023-11-21 17:24:20 +01:00
|
|
|
+ if (g_exe_app_icon_resource_id > 0) {
|
|
|
|
+ // Try to load the icon from the exe first.
|
|
|
|
+ if (auto icon = LoadIcon(GetModuleHandle(NULL),
|
|
|
|
+ MAKEINTRESOURCE(g_exe_app_icon_resource_id))) {
|
|
|
|
+ return icon;
|
|
|
|
+ }
|
2023-11-21 01:35:05 +01:00
|
|
|
+ }
|
2023-11-21 17:24:20 +01:00
|
|
|
+ const int icon_id = GetAppIconResourceId();
|
2023-11-21 01:35:05 +01:00
|
|
|
return LoadIcon(GetModuleHandle(chrome::kBrowserResourcesDll),
|
|
|
|
MAKEINTRESOURCE(icon_id));
|
|
|
|
}
|
2023-11-21 17:24:20 +01:00
|
|
|
@@ -32,9 +45,18 @@ HICON GetAppIcon() {
|
|
|
|
HICON GetSmallAppIcon() {
|
|
|
|
// TODO(mgiuca): Use GetAppIconImageFamily/CreateExact instead of LoadIcon, to
|
|
|
|
// get correct scaling. (See http://crbug.com/551256)
|
|
|
|
- const int icon_id = GetAppIconResourceId();
|
2023-11-21 01:35:05 +01:00
|
|
|
gfx::Size size = GetSmallAppIconSize();
|
|
|
|
// HICON returned from LoadImage must be released using DestroyIcon.
|
2023-11-21 17:24:20 +01:00
|
|
|
+ if (g_exe_app_icon_resource_id > 0) {
|
|
|
|
+ // Try to load the icon from the exe first.
|
|
|
|
+ if (auto icon = static_cast<HICON>(LoadImage(
|
|
|
|
+ GetModuleHandle(NULL), MAKEINTRESOURCE(g_exe_app_icon_resource_id),
|
|
|
|
+ IMAGE_ICON, size.width(), size.height(),
|
|
|
|
+ LR_DEFAULTCOLOR | LR_SHARED))) {
|
|
|
|
+ return icon;
|
|
|
|
+ }
|
2023-11-21 01:35:05 +01:00
|
|
|
+ }
|
2023-11-21 17:24:20 +01:00
|
|
|
+ const int icon_id = GetAppIconResourceId();
|
2023-11-21 01:35:05 +01:00
|
|
|
return static_cast<HICON>(LoadImage(
|
|
|
|
GetModuleHandle(chrome::kBrowserResourcesDll), MAKEINTRESOURCE(icon_id),
|
|
|
|
IMAGE_ICON, size.width(), size.height(), LR_DEFAULTCOLOR | LR_SHARED));
|
2023-11-21 17:24:20 +01:00
|
|
|
@@ -50,15 +72,14 @@ gfx::Size GetSmallAppIconSize() {
|
|
|
|
}
|
2023-11-21 01:35:05 +01:00
|
|
|
|
|
|
|
std::unique_ptr<gfx::ImageFamily> GetAppIconImageFamily() {
|
2023-11-21 17:24:20 +01:00
|
|
|
+ if (g_exe_app_icon_resource_id > 0) {
|
|
|
|
+ // Try to load the icon from the exe first.
|
|
|
|
+ if (auto image_family = IconUtil::CreateImageFamilyFromIconResource(
|
|
|
|
+ GetModuleHandle(NULL), g_exe_app_icon_resource_id)) {
|
|
|
|
+ return image_family;
|
|
|
|
+ }
|
|
|
|
+ }
|
2023-11-21 01:35:05 +01:00
|
|
|
const int icon_id = GetAppIconResourceId();
|
|
|
|
- // Get the icon from chrome.dll (not chrome.exe, which has different resource
|
|
|
|
- // IDs). If chrome.dll is not loaded, we are probably in a unit test, so fall
|
|
|
|
- // back to getting the icon from the current module (assuming it is
|
|
|
|
- // unit_tests.exe, that has the same resource IDs as chrome.dll).
|
|
|
|
- HMODULE module = GetModuleHandle(chrome::kBrowserResourcesDll);
|
|
|
|
- if (!module)
|
|
|
|
- module = GetModuleHandle(nullptr);
|
|
|
|
- DCHECK(module);
|
|
|
|
-
|
|
|
|
- return IconUtil::CreateImageFamilyFromIconResource(module, icon_id);
|
|
|
|
+ return IconUtil::CreateImageFamilyFromIconResource(
|
|
|
|
+ GetModuleHandle(chrome::kBrowserResourcesDll), icon_id);
|
|
|
|
}
|
2023-11-21 17:24:20 +01:00
|
|
|
diff --git chrome/browser/win/app_icon.h chrome/browser/win/app_icon.h
|
|
|
|
index db8209bbcc214..b50bce7fae5b5 100644
|
|
|
|
--- chrome/browser/win/app_icon.h
|
|
|
|
+++ chrome/browser/win/app_icon.h
|
|
|
|
@@ -14,6 +14,8 @@ class ImageFamily;
|
|
|
|
class Size;
|
|
|
|
}
|
|
|
|
|
|
|
|
+void SetExeAppIconResourceId(int icon_id);
|
|
|
|
+
|
|
|
|
HICON GetAppIcon();
|
|
|
|
HICON GetSmallAppIcon();
|
|
|
|
|
2023-11-21 01:35:05 +01:00
|
|
|
diff --git chrome/common/chrome_constants.cc chrome/common/chrome_constants.cc
|
2023-11-21 20:17:55 +01:00
|
|
|
index 064cb8fef1f1b..fa8e50f8681a0 100644
|
2023-11-21 01:35:05 +01:00
|
|
|
--- chrome/common/chrome_constants.cc
|
|
|
|
+++ chrome/common/chrome_constants.cc
|
|
|
|
@@ -6,6 +6,7 @@
|
|
|
|
|
|
|
|
#include "build/branding_buildflags.h"
|
|
|
|
#include "build/build_config.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
#include "chrome/common/chrome_version.h"
|
|
|
|
|
|
|
|
#define FPL FILE_PATH_LITERAL
|
|
|
|
@@ -100,7 +101,12 @@ const char kMacHelperSuffixAlerts[] = " (Alerts)";
|
|
|
|
#endif // BUILDFLAG(IS_MAC)
|
|
|
|
|
|
|
|
#if BUILDFLAG(IS_WIN)
|
|
|
|
-const base::FilePath::CharType kBrowserResourcesDll[] = FPL("chrome.dll");
|
|
|
|
+const base::FilePath::CharType kBrowserResourcesDll[] =
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ FPL("libcef.dll");
|
|
|
|
+#else
|
|
|
|
+ FPL("chrome.dll");
|
|
|
|
+#endif
|
|
|
|
const base::FilePath::CharType kElfDll[] = FPL("chrome_elf.dll");
|
|
|
|
const base::FilePath::CharType kStatusTrayWindowClass[] =
|
|
|
|
FPL("Chrome_StatusTrayWindow");
|