blob: d8b3628c4920a649e92d38c2b1b13b83cdcdde0b [file] [log] [blame]
[email protected]4b7a2aa2011-12-06 03:46:221// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]f7be2197b2010-04-23 00:20:442// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/app_icon_win.h"
6
7#include "chrome/app/chrome_dll_resource.h"
8#include "chrome/common/chrome_constants.h"
[email protected]be74fb52013-01-14 19:45:349#include "third_party/skia/include/core/SkBitmap.h"
10#include "ui/gfx/icon_util.h"
[email protected]f7be2197b2010-04-23 00:20:4411
12#if defined(GOOGLE_CHROME_BUILD)
[email protected]4b7a2aa2011-12-06 03:46:2213#include "chrome/installer/util/install_util.h"
[email protected]f7be2197b2010-04-23 00:20:4414#endif
15
[email protected]be74fb52013-01-14 19:45:3416namespace {
17
18// Returns the resource id of the application icon.
19int GetAppIconResourceId() {
[email protected]f7be2197b2010-04-23 00:20:4420 int icon_id = IDR_MAINFRAME;
21#if defined(GOOGLE_CHROME_BUILD)
[email protected]4b7a2aa2011-12-06 03:46:2222 if (InstallUtil::IsChromeSxSProcess())
[email protected]fc8a93c2010-05-03 17:55:1123 icon_id = IDR_SXS;
[email protected]f7be2197b2010-04-23 00:20:4424#endif
[email protected]be74fb52013-01-14 19:45:3425 return icon_id;
26}
27
28} // namespace
29
30HICON GetAppIcon() {
31 const int icon_id = GetAppIconResourceId();
[email protected]f7be2197b2010-04-23 00:20:4432 return LoadIcon(GetModuleHandle(chrome::kBrowserResourcesDll),
33 MAKEINTRESOURCE(icon_id));
34}
[email protected]4b7a2aa2011-12-06 03:46:2235
tmoniuszkocd5b3ee2014-12-15 08:51:0436HICON GetSmallAppIcon() {
37 const int icon_id = GetAppIconResourceId();
38 return static_cast<HICON>(LoadImage(
39 GetModuleHandle(chrome::kBrowserResourcesDll), MAKEINTRESOURCE(icon_id),
40 IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
41 LR_DEFAULTCOLOR));
42}
43
[email protected]be74fb52013-01-14 19:45:3444scoped_ptr<SkBitmap> GetAppIconForSize(int size) {
45 const int icon_id = GetAppIconResourceId();
46 return IconUtil::CreateSkBitmapFromIconResource(
47 GetModuleHandle(chrome::kBrowserResourcesDll), icon_id, size);
[email protected]4b7a2aa2011-12-06 03:46:2248}