cef/patch/patches/win_app_icon_3606.patch

78 lines
3.2 KiB
Diff
Raw Normal View History

diff --git chrome/browser/win/app_icon.cc chrome/browser/win/app_icon.cc
index db721b75aad6f..a4826e16dd43d 100644
--- chrome/browser/win/app_icon.cc
+++ chrome/browser/win/app_icon.cc
@@ -25,6 +25,10 @@ HICON GetAppIcon() {
// get correct scaling. (See http://crbug.com/551256)
const int icon_id = GetAppIconResourceId();
// HICON returned from LoadIcon do not leak and do not have to be destroyed.
+ // Try to load the icon from the exe first.
+ if (auto icon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(icon_id))) {
+ return icon;
+ }
return LoadIcon(GetModuleHandle(chrome::kBrowserResourcesDll),
MAKEINTRESOURCE(icon_id));
}
@@ -35,6 +39,13 @@ HICON GetSmallAppIcon() {
const int icon_id = GetAppIconResourceId();
gfx::Size size = GetSmallAppIconSize();
// HICON returned from LoadImage must be released using DestroyIcon.
+ // Try to load the icon from the exe first.
+ if (auto icon = static_cast<HICON>(LoadImage(
+ GetModuleHandle(NULL), MAKEINTRESOURCE(icon_id),
+ IMAGE_ICON, size.width(), size.height(),
+ LR_DEFAULTCOLOR | LR_SHARED))) {
+ return icon;
+ }
return static_cast<HICON>(LoadImage(
GetModuleHandle(chrome::kBrowserResourcesDll), MAKEINTRESOURCE(icon_id),
IMAGE_ICON, size.width(), size.height(), LR_DEFAULTCOLOR | LR_SHARED));
@@ -51,14 +62,11 @@ gfx::Size GetSmallAppIconSize() {
std::unique_ptr<gfx::ImageFamily> GetAppIconImageFamily() {
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);
+ // Try to load the icon from the exe first.
+ if (auto image_family = IconUtil::CreateImageFamilyFromIconResource(
+ GetModuleHandle(NULL), icon_id)) {
+ return image_family;
+ }
+ return IconUtil::CreateImageFamilyFromIconResource(
+ GetModuleHandle(chrome::kBrowserResourcesDll), icon_id);
}
diff --git chrome/common/chrome_constants.cc chrome/common/chrome_constants.cc
index 3a39e2bb7b608..27c6038cf7a47 100644
--- 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");