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