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 #include "chrome/browser/extensions/extension_icon_manager.h" | 5 #include "chrome/browser/extensions/extension_icon_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
| 10 #include "chrome/common/extensions/extension_constants.h" |
10 #include "chrome/common/extensions/extension_icon_set.h" | 11 #include "chrome/common/extensions/extension_icon_set.h" |
11 #include "chrome/common/extensions/extension_resource.h" | 12 #include "chrome/common/extensions/extension_resource.h" |
12 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
13 #include "skia/ext/image_operations.h" | 14 #include "skia/ext/image_operations.h" |
14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
16 #include "ui/gfx/color_utils.h" | 17 #include "ui/gfx/color_utils.h" |
17 #include "ui/gfx/favicon_size.h" | 18 #include "ui/gfx/favicon_size.h" |
18 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
19 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
(...skipping 23 matching lines...) Expand all Loading... |
43 ExtensionIconManager::ExtensionIconManager() | 44 ExtensionIconManager::ExtensionIconManager() |
44 : ALLOW_THIS_IN_INITIALIZER_LIST(image_tracker_(this)), | 45 : ALLOW_THIS_IN_INITIALIZER_LIST(image_tracker_(this)), |
45 monochrome_(false) { | 46 monochrome_(false) { |
46 } | 47 } |
47 | 48 |
48 ExtensionIconManager::~ExtensionIconManager() { | 49 ExtensionIconManager::~ExtensionIconManager() { |
49 } | 50 } |
50 | 51 |
51 void ExtensionIconManager::LoadIcon(const extensions::Extension* extension) { | 52 void ExtensionIconManager::LoadIcon(const extensions::Extension* extension) { |
52 ExtensionResource icon_resource = extension->GetIconResource( | 53 ExtensionResource icon_resource = extension->GetIconResource( |
53 ExtensionIconSet::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_BIGGER); | 54 extension_misc::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_BIGGER); |
54 if (!icon_resource.extension_root().empty()) { | 55 if (!icon_resource.extension_root().empty()) { |
55 // Insert into pending_icons_ first because LoadImage can call us back | 56 // Insert into pending_icons_ first because LoadImage can call us back |
56 // synchronously if the image is already cached. | 57 // synchronously if the image is already cached. |
57 pending_icons_.insert(extension->id()); | 58 pending_icons_.insert(extension->id()); |
58 image_tracker_.LoadImage(extension, | 59 image_tracker_.LoadImage(extension, |
59 icon_resource, | 60 icon_resource, |
60 gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize), | 61 gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize), |
61 ImageLoadingTracker::CACHE); | 62 ImageLoadingTracker::CACHE); |
62 } | 63 } |
63 } | 64 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 if (monochrome_) { | 118 if (monochrome_) { |
118 color_utils::HSL shift = {-1, 0, 0.6}; | 119 color_utils::HSL shift = {-1, 0, 0.6}; |
119 result = SkBitmapOperations::CreateHSLShiftedBitmap(result, shift); | 120 result = SkBitmapOperations::CreateHSLShiftedBitmap(result, shift); |
120 } | 121 } |
121 | 122 |
122 if (!padding_.empty()) | 123 if (!padding_.empty()) |
123 result = ApplyPadding(result, padding_); | 124 result = ApplyPadding(result, padding_); |
124 | 125 |
125 return result; | 126 return result; |
126 } | 127 } |
OLD | NEW |