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
3 // found in the LICENSE file.
5 #include "chrome/browser/app_icon_win.h"
7 #include "chrome/app/chrome_dll_resource.h"
8 #include "chrome/common/chrome_constants.h"
9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "ui/gfx/icon_util.h"
12 #if defined(GOOGLE_CHROME_BUILD)
13 #include "chrome/installer/util/install_util.h"
18 // Returns the resource id of the application icon.
19 int GetAppIconResourceId() {
20 int icon_id
= IDR_MAINFRAME
;
21 #if defined(GOOGLE_CHROME_BUILD)
22 if (InstallUtil::IsChromeSxSProcess())
31 const int icon_id
= GetAppIconResourceId();
32 return LoadIcon(GetModuleHandle(chrome::kBrowserResourcesDll
),
33 MAKEINTRESOURCE(icon_id
));
36 HICON
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
),
44 scoped_ptr
<SkBitmap
> GetAppIconForSize(int size
) {
45 const int icon_id
= GetAppIconResourceId();
46 return IconUtil::CreateSkBitmapFromIconResource(
47 GetModuleHandle(chrome::kBrowserResourcesDll
), icon_id
, size
);