Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: chrome/browser/extensions/extension_icon_manager.cc

Issue 12578008: Move CrxFile, FileReader, ExtensionResource to src/extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/extensions/image_loader.h" 10 #include "chrome/browser/extensions/image_loader.h"
11 #include "chrome/common/extensions/api/icons/icons_handler.h" 11 #include "chrome/common/extensions/api/icons/icons_handler.h"
12 #include "chrome/common/extensions/extension.h" 12 #include "chrome/common/extensions/extension.h"
13 #include "chrome/common/extensions/extension_constants.h" 13 #include "chrome/common/extensions/extension_constants.h"
14 #include "chrome/common/extensions/extension_icon_set.h" 14 #include "chrome/common/extensions/extension_icon_set.h"
15 #include "chrome/common/extensions/extension_resource.h" 15 #include "extensions/common/extension_resource.h"
16 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
17 #include "skia/ext/image_operations.h" 17 #include "skia/ext/image_operations.h"
18 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/canvas.h" 19 #include "ui/gfx/canvas.h"
20 #include "ui/gfx/color_utils.h" 20 #include "ui/gfx/color_utils.h"
21 #include "ui/gfx/favicon_size.h" 21 #include "ui/gfx/favicon_size.h"
22 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
23 #include "ui/gfx/size.h" 23 #include "ui/gfx/size.h"
24 #include "ui/gfx/skbitmap_operations.h" 24 #include "ui/gfx/skbitmap_operations.h"
25 25
(...skipping 21 matching lines...) Expand all
47 ExtensionIconManager::ExtensionIconManager() 47 ExtensionIconManager::ExtensionIconManager()
48 : monochrome_(false), 48 : monochrome_(false),
49 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { 49 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
50 } 50 }
51 51
52 ExtensionIconManager::~ExtensionIconManager() { 52 ExtensionIconManager::~ExtensionIconManager() {
53 } 53 }
54 54
55 void ExtensionIconManager::LoadIcon(Profile* profile, 55 void ExtensionIconManager::LoadIcon(Profile* profile,
56 const extensions::Extension* extension) { 56 const extensions::Extension* extension) {
57 ExtensionResource icon_resource = extensions::IconsInfo::GetIconResource( 57 extensions::ExtensionResource icon_resource =
58 extension, 58 extensions::IconsInfo::GetIconResource(
59 extension_misc::EXTENSION_ICON_BITTY, 59 extension,
60 ExtensionIconSet::MATCH_BIGGER); 60 extension_misc::EXTENSION_ICON_BITTY,
61 ExtensionIconSet::MATCH_BIGGER);
61 if (!icon_resource.extension_root().empty()) { 62 if (!icon_resource.extension_root().empty()) {
62 // Insert into pending_icons_ first because LoadImage can call us back 63 // Insert into pending_icons_ first because LoadImage can call us back
63 // synchronously if the image is already cached. 64 // synchronously if the image is already cached.
64 pending_icons_.insert(extension->id()); 65 pending_icons_.insert(extension->id());
65 extensions::ImageLoader* loader = extensions::ImageLoader::Get(profile); 66 extensions::ImageLoader* loader = extensions::ImageLoader::Get(profile);
66 loader->LoadImageAsync(extension, icon_resource, 67 loader->LoadImageAsync(extension, icon_resource,
67 gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize), 68 gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize),
68 base::Bind( 69 base::Bind(
69 &ExtensionIconManager::OnImageLoaded, 70 &ExtensionIconManager::OnImageLoaded,
70 weak_ptr_factory_.GetWeakPtr(), 71 weak_ptr_factory_.GetWeakPtr(),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (monochrome_) { 127 if (monochrome_) {
127 color_utils::HSL shift = {-1, 0, 0.6}; 128 color_utils::HSL shift = {-1, 0, 0.6};
128 result = SkBitmapOperations::CreateHSLShiftedBitmap(result, shift); 129 result = SkBitmapOperations::CreateHSLShiftedBitmap(result, shift);
129 } 130 }
130 131
131 if (!padding_.empty()) 132 if (!padding_.empty())
132 result = ApplyPadding(result, padding_); 133 result = ApplyPadding(result, padding_);
133 134
134 return result; 135 return result;
135 } 136 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_icon_image.cc ('k') | chrome/browser/extensions/extension_icon_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698