Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: chrome/browser/win/app_icon.cc

Issue 2689233005: Move brand- and mode-specific app icon resource id into InstallConstants. (Closed)
Patch Set: sync to position 453103 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/install_static/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/win/app_icon.h" 5 #include "chrome/browser/win/app_icon.h"
6 6
7 #include "chrome/app/chrome_dll_resource.h"
8 #include "chrome/common/chrome_constants.h" 7 #include "chrome/common/chrome_constants.h"
8 #include "chrome/install_static/install_details.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "ui/gfx/geometry/size.h" 10 #include "ui/gfx/geometry/size.h"
11 #include "ui/gfx/icon_util.h" 11 #include "ui/gfx/icon_util.h"
12 #include "ui/gfx/image/image_family.h" 12 #include "ui/gfx/image/image_family.h"
13 13
14 #if defined(GOOGLE_CHROME_BUILD)
15 #include "chrome/installer/util/install_util.h"
16 #endif
17
18 namespace { 14 namespace {
19 15
20 // Returns the resource id of the application icon. 16 // Returns the resource id of the application icon.
21 int GetAppIconResourceId() { 17 int GetAppIconResourceId() {
22 int icon_id = IDR_MAINFRAME; 18 return install_static::InstallDetails::Get().app_icon_resource_id();
23 #if defined(GOOGLE_CHROME_BUILD)
24 if (InstallUtil::IsChromeSxSProcess())
25 icon_id = IDR_SXS;
26 #endif
27 return icon_id;
28 } 19 }
29 20
30 } // namespace 21 } // namespace
31 22
32 HICON GetAppIcon() { 23 HICON GetAppIcon() {
33 // TODO(mgiuca): Use GetAppIconImageFamily/CreateExact instead of LoadIcon, to 24 // TODO(mgiuca): Use GetAppIconImageFamily/CreateExact instead of LoadIcon, to
34 // get correct scaling. (See http://crbug.com/551256) 25 // get correct scaling. (See http://crbug.com/551256)
35 const int icon_id = GetAppIconResourceId(); 26 const int icon_id = GetAppIconResourceId();
36 // HICON returned from LoadIcon do not leak and do not have to be destroyed. 27 // HICON returned from LoadIcon do not leak and do not have to be destroyed.
37 return LoadIcon(GetModuleHandle(chrome::kBrowserResourcesDll), 28 return LoadIcon(GetModuleHandle(chrome::kBrowserResourcesDll),
(...skipping 26 matching lines...) Expand all
64 // IDs). If chrome.dll is not loaded, we are probably in a unit test, so fall 55 // IDs). If chrome.dll is not loaded, we are probably in a unit test, so fall
65 // back to getting the icon from the current module (assuming it is 56 // back to getting the icon from the current module (assuming it is
66 // unit_tests.exe, that has the same resource IDs as chrome.dll). 57 // unit_tests.exe, that has the same resource IDs as chrome.dll).
67 HMODULE module = GetModuleHandle(chrome::kBrowserResourcesDll); 58 HMODULE module = GetModuleHandle(chrome::kBrowserResourcesDll);
68 if (!module) 59 if (!module)
69 module = GetModuleHandle(nullptr); 60 module = GetModuleHandle(nullptr);
70 DCHECK(module); 61 DCHECK(module);
71 62
72 return IconUtil::CreateImageFamilyFromIconResource(module, icon_id); 63 return IconUtil::CreateImageFamilyFromIconResource(module, icon_id);
73 } 64 }
OLDNEW
« no previous file with comments | « no previous file | chrome/install_static/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698