Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / app_icon_win.cc
blob6f1424e4977b5c54e3ad1045be78dc010264c421
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"
14 #endif
16 namespace {
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())
23 icon_id = IDR_SXS;
24 #endif
25 return icon_id;
28 } // namespace
30 HICON GetAppIcon() {
31 const int icon_id = GetAppIconResourceId();
32 // HICON returned from LoadIcon do not leak and do not have to be destroyed.
33 return LoadIcon(GetModuleHandle(chrome::kBrowserResourcesDll),
34 MAKEINTRESOURCE(icon_id));
37 HICON GetSmallAppIcon() {
38 const int icon_id = GetAppIconResourceId();
39 // HICON returned from LoadImage must be released using DestroyIcon.
40 return static_cast<HICON>(LoadImage(
41 GetModuleHandle(chrome::kBrowserResourcesDll), MAKEINTRESOURCE(icon_id),
42 IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
43 LR_DEFAULTCOLOR | LR_SHARED));
46 scoped_ptr<SkBitmap> GetAppIconForSize(int size) {
47 const int icon_id = GetAppIconResourceId();
48 return IconUtil::CreateSkBitmapFromIconResource(
49 GetModuleHandle(chrome::kBrowserResourcesDll), icon_id, size);