| 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_icon_set.h" | 10 #include "chrome/common/extensions/extension_icon_set.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 ExtensionIconManager::ExtensionIconManager() | 41 ExtensionIconManager::ExtensionIconManager() |
| 42 : ALLOW_THIS_IN_INITIALIZER_LIST(image_tracker_(this)), | 42 : ALLOW_THIS_IN_INITIALIZER_LIST(image_tracker_(this)), |
| 43 monochrome_(false) { | 43 monochrome_(false) { |
| 44 } | 44 } |
| 45 | 45 |
| 46 ExtensionIconManager::~ExtensionIconManager() { | 46 ExtensionIconManager::~ExtensionIconManager() { |
| 47 } | 47 } |
| 48 | 48 |
| 49 void ExtensionIconManager::LoadIcon(const Extension* extension) { | 49 void ExtensionIconManager::LoadIcon(const extensions::Extension* extension) { |
| 50 ExtensionResource icon_resource = extension->GetIconResource( | 50 ExtensionResource icon_resource = extension->GetIconResource( |
| 51 ExtensionIconSet::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_BIGGER); | 51 ExtensionIconSet::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_BIGGER); |
| 52 if (!icon_resource.extension_root().empty()) { | 52 if (!icon_resource.extension_root().empty()) { |
| 53 // Insert into pending_icons_ first because LoadImage can call us back | 53 // Insert into pending_icons_ first because LoadImage can call us back |
| 54 // synchronously if the image is already cached. | 54 // synchronously if the image is already cached. |
| 55 pending_icons_.insert(extension->id()); | 55 pending_icons_.insert(extension->id()); |
| 56 image_tracker_.LoadImage(extension, | 56 image_tracker_.LoadImage(extension, |
| 57 icon_resource, | 57 icon_resource, |
| 58 gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize), | 58 gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize), |
| 59 ImageLoadingTracker::CACHE); | 59 ImageLoadingTracker::CACHE); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (monochrome_) { | 115 if (monochrome_) { |
| 116 color_utils::HSL shift = {-1, 0, 0.6}; | 116 color_utils::HSL shift = {-1, 0, 0.6}; |
| 117 result = SkBitmapOperations::CreateHSLShiftedBitmap(result, shift); | 117 result = SkBitmapOperations::CreateHSLShiftedBitmap(result, shift); |
| 118 } | 118 } |
| 119 | 119 |
| 120 if (!padding_.empty()) | 120 if (!padding_.empty()) |
| 121 result = ApplyPadding(result, padding_); | 121 result = ApplyPadding(result, padding_); |
| 122 | 122 |
| 123 return result; | 123 return result; |
| 124 } | 124 } |
| OLD | NEW |