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

Side by Side Diff: chrome/browser/ui/ash/app_icon_loader_impl.cc

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: Created 7 years, 10 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
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/ui/ash/app_icon_loader_impl.h" 5 #include "chrome/browser/ui/ash/app_icon_loader_impl.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/common/extensions/api/icons/icons_handler.h"
11 #include "chrome/common/extensions/extension.h" 12 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/extensions/extension_constants.h" 13 #include "chrome/common/extensions/extension_constants.h"
13 #include "ui/gfx/color_utils.h" 14 #include "ui/gfx/color_utils.h"
14 #include "ui/gfx/image/image_skia_operations.h" 15 #include "ui/gfx/image/image_skia_operations.h"
15 16
16 namespace { 17 namespace {
17 18
18 const extensions::Extension* GetExtensionByID(Profile* profile, 19 const extensions::Extension* GetExtensionByID(Profile* profile,
19 const std::string& id) { 20 const std::string& id) {
20 ExtensionService* service = 21 ExtensionService* service =
(...skipping 27 matching lines...) Expand all
48 if (i->second == id) 49 if (i->second == id)
49 return; // Already loading the image. 50 return; // Already loading the image.
50 } 51 }
51 52
52 const extensions::Extension* extension = GetExtensionByID(profile_, id); 53 const extensions::Extension* extension = GetExtensionByID(profile_, id);
53 if (!extension) 54 if (!extension)
54 return; 55 return;
55 56
56 extensions::IconImage* image = new extensions::IconImage( 57 extensions::IconImage* image = new extensions::IconImage(
57 extension, 58 extension,
58 extension->icons(), 59 extensions::IconsInfo::GetIcons(extension),
59 icon_size_, 60 icon_size_,
60 extensions::Extension::GetDefaultIcon(true), 61 extensions::IconsInfo::GetDefaultAppIcon(),
61 this); 62 this);
62 // |map_| takes ownership of |image|. 63 // |map_| takes ownership of |image|.
63 map_[image] = id; 64 map_[image] = id;
64 65
65 // Triggers image loading now instead of depending on paint message. This 66 // Triggers image loading now instead of depending on paint message. This
66 // makes the temp blank image be shown for shorter time and improves user 67 // makes the temp blank image be shown for shorter time and improves user
67 // experience. See http://crbug.com/146114. 68 // experience. See http://crbug.com/146114.
68 image->image_skia().EnsureRepsForSupportedScaleFactors(); 69 image->image_skia().EnsureRepsForSupportedScaleFactors();
69 } 70 }
70 71
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const bool enabled = service->IsExtensionEnabledForLauncher(id); 108 const bool enabled = service->IsExtensionEnabledForLauncher(id);
108 if (!enabled) { 109 if (!enabled) {
109 const color_utils::HSL shift = {-1, 0, 0.6}; 110 const color_utils::HSL shift = {-1, 0, 0.6};
110 image = gfx::ImageSkiaOperations::CreateHSLShiftedImage(image, shift); 111 image = gfx::ImageSkiaOperations::CreateHSLShiftedImage(image, shift);
111 } 112 }
112 113
113 delegate_->SetAppImage(id, image); 114 delegate_->SetAppImage(id, image);
114 } 115 }
115 116
116 } // namespace ash 117 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698