OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef UI_GFX_ICON_UTIL_H_ | 5 #ifndef UI_GFX_ICON_UTIL_H_ |
6 #define UI_GFX_ICON_UTIL_H_ | 6 #define UI_GFX_ICON_UTIL_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/win/scoped_gdi_object.h" | 16 #include "base/win/scoped_gdi_object.h" |
17 #include "ui/gfx/geometry/point.h" | 17 #include "ui/gfx/geometry/point.h" |
18 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
19 #include "ui/gfx/gfx_export.h" | 19 #include "ui/gfx/gfx_export.h" |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class FilePath; | 22 class FilePath; |
23 } | 23 } |
24 | 24 |
25 namespace gfx { | 25 namespace gfx { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // the return value is NULL. | 96 // the return value is NULL. |
97 // | 97 // |
98 // The client owns the returned bitmap object and is responsible for deleting | 98 // The client owns the returned bitmap object and is responsible for deleting |
99 // it when it is no longer needed. | 99 // it when it is no longer needed. |
100 static SkBitmap* CreateSkBitmapFromHICON(HICON icon, const gfx::Size& s); | 100 static SkBitmap* CreateSkBitmapFromHICON(HICON icon, const gfx::Size& s); |
101 | 101 |
102 // Loads an icon resource as a SkBitmap for the specified |size| from a | 102 // Loads an icon resource as a SkBitmap for the specified |size| from a |
103 // loaded .dll or .exe |module|. Supports loading smaller icon sizes as well | 103 // loaded .dll or .exe |module|. Supports loading smaller icon sizes as well |
104 // as the Vista+ 256x256 PNG icon size. If the icon could not be loaded or | 104 // as the Vista+ 256x256 PNG icon size. If the icon could not be loaded or |
105 // found, returns a NULL scoped_ptr. | 105 // found, returns a NULL scoped_ptr. |
106 static scoped_ptr<gfx::ImageFamily> CreateImageFamilyFromIconResource( | 106 static std::unique_ptr<gfx::ImageFamily> CreateImageFamilyFromIconResource( |
107 HMODULE module, | 107 HMODULE module, |
108 int resource_id); | 108 int resource_id); |
109 | 109 |
110 // Given a valid HICON handle representing an icon, this function converts | 110 // Given a valid HICON handle representing an icon, this function converts |
111 // the icon into an SkBitmap object containing an ARGB bitmap using the | 111 // the icon into an SkBitmap object containing an ARGB bitmap using the |
112 // dimensions of HICON. If the function cannot convert the icon to a bitmap | 112 // dimensions of HICON. If the function cannot convert the icon to a bitmap |
113 // (most probably due to an invalid parameter), the return value is NULL. | 113 // (most probably due to an invalid parameter), the return value is NULL. |
114 // | 114 // |
115 // The client owns the returned bitmap object and is responsible for deleting | 115 // The client owns the returned bitmap object and is responsible for deleting |
116 // it when it is no longer needed. | 116 // it when it is no longer needed. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // A helper function of CreateSkBitmapFromHICON. | 265 // A helper function of CreateSkBitmapFromHICON. |
266 static SkBitmap CreateSkBitmapFromHICONHelper(HICON icon, | 266 static SkBitmap CreateSkBitmapFromHICONHelper(HICON icon, |
267 const gfx::Size& s); | 267 const gfx::Size& s); |
268 | 268 |
269 // Prevent clients from instantiating objects of that class by declaring the | 269 // Prevent clients from instantiating objects of that class by declaring the |
270 // ctor/dtor as private. | 270 // ctor/dtor as private. |
271 DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); | 271 DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); |
272 }; | 272 }; |
273 | 273 |
274 #endif // UI_GFX_ICON_UTIL_H_ | 274 #endif // UI_GFX_ICON_UTIL_H_ |
OLD | NEW |