| 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/app_icon_loader_impl.h" | 5 #include "chrome/browser/extensions/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 28 matching lines...) Expand all Loading... |
| 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 profile_, | 58 profile_, |
| 58 extension, | 59 extension, |
| 59 extension->icons(), | 60 extensions::IconsInfo::GetIcons(extension), |
| 60 icon_size_, | 61 icon_size_, |
| 61 extensions::Extension::GetDefaultIcon(true), | 62 extensions::IconsInfo::GetDefaultAppIcon(), |
| 62 this); | 63 this); |
| 63 // |map_| takes ownership of |image|. | 64 // |map_| takes ownership of |image|. |
| 64 map_[image] = id; | 65 map_[image] = id; |
| 65 | 66 |
| 66 // Triggers image loading now instead of depending on paint message. This | 67 // Triggers image loading now instead of depending on paint message. This |
| 67 // makes the temp blank image be shown for shorter time and improves user | 68 // makes the temp blank image be shown for shorter time and improves user |
| 68 // experience. See http://crbug.com/146114. | 69 // experience. See http://crbug.com/146114. |
| 69 image->image_skia().EnsureRepsForSupportedScaleFactors(); | 70 image->image_skia().EnsureRepsForSupportedScaleFactors(); |
| 70 } | 71 } |
| 71 | 72 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 const bool enabled = service->IsExtensionEnabledForLauncher(id); | 109 const bool enabled = service->IsExtensionEnabledForLauncher(id); |
| 109 if (!enabled) { | 110 if (!enabled) { |
| 110 const color_utils::HSL shift = {-1, 0, 0.6}; | 111 const color_utils::HSL shift = {-1, 0, 0.6}; |
| 111 image = gfx::ImageSkiaOperations::CreateHSLShiftedImage(image, shift); | 112 image = gfx::ImageSkiaOperations::CreateHSLShiftedImage(image, shift); |
| 112 } | 113 } |
| 113 | 114 |
| 114 delegate_->SetAppImage(id, image); | 115 delegate_->SetAppImage(id, image); |
| 115 } | 116 } |
| 116 | 117 |
| 117 } // namespace extensions | 118 } // namespace extensions |
| OLD | NEW |