| OLD | NEW |
| 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/app_icon_win.h" | 5 #include "chrome/browser/app_icon_win.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_dll_resource.h" | 7 #include "chrome/app/chrome_dll_resource.h" |
| 8 #include "chrome/common/chrome_constants.h" | 8 #include "chrome/common/chrome_constants.h" |
| 9 #include "third_party/skia/include/core/SkBitmap.h" |
| 10 #include "ui/gfx/icon_util.h" |
| 9 | 11 |
| 10 #if defined(GOOGLE_CHROME_BUILD) | 12 #if defined(GOOGLE_CHROME_BUILD) |
| 11 #include "chrome/installer/util/install_util.h" | 13 #include "chrome/installer/util/install_util.h" |
| 12 #endif | 14 #endif |
| 13 | 15 |
| 14 HICON GetAppIcon() { | 16 namespace { |
| 17 |
| 18 // Returns the resource id of the application icon. |
| 19 int GetAppIconResourceId() { |
| 15 int icon_id = IDR_MAINFRAME; | 20 int icon_id = IDR_MAINFRAME; |
| 16 #if defined(GOOGLE_CHROME_BUILD) | 21 #if defined(GOOGLE_CHROME_BUILD) |
| 17 if (InstallUtil::IsChromeSxSProcess()) | 22 if (InstallUtil::IsChromeSxSProcess()) |
| 18 icon_id = IDR_SXS; | 23 icon_id = IDR_SXS; |
| 19 #endif | 24 #endif |
| 25 return icon_id; |
| 26 } |
| 27 |
| 28 } // namespace |
| 29 |
| 30 HICON GetAppIcon() { |
| 31 const int icon_id = GetAppIconResourceId(); |
| 20 return LoadIcon(GetModuleHandle(chrome::kBrowserResourcesDll), | 32 return LoadIcon(GetModuleHandle(chrome::kBrowserResourcesDll), |
| 21 MAKEINTRESOURCE(icon_id)); | 33 MAKEINTRESOURCE(icon_id)); |
| 22 } | 34 } |
| 23 | 35 |
| 24 HICON GetAppIconForSize(int size) { | 36 scoped_ptr<SkBitmap> GetAppIconForSize(int size) { |
| 25 int icon_id = IDR_MAINFRAME; | 37 const int icon_id = GetAppIconResourceId(); |
| 26 #if defined(GOOGLE_CHROME_BUILD) | 38 return IconUtil::CreateSkBitmapFromIconResource( |
| 27 if (InstallUtil::IsChromeSxSProcess()) | 39 GetModuleHandle(chrome::kBrowserResourcesDll), icon_id, size); |
| 28 icon_id = IDR_SXS; | |
| 29 #endif | |
| 30 return static_cast<HICON>( | |
| 31 LoadImage(GetModuleHandle(chrome::kBrowserResourcesDll), | |
| 32 MAKEINTRESOURCE(icon_id), | |
| 33 IMAGE_ICON, | |
| 34 size, | |
| 35 size, | |
| 36 LR_DEFAULTCOLOR | LR_DEFAULTSIZE)); | |
| 37 } | 40 } |
| OLD | NEW |