| Index: chrome/browser/extensions/extension_app_icon_loader.cc
|
| diff --git a/chrome/browser/extensions/extension_app_icon_loader.cc b/chrome/browser/extensions/extension_app_icon_loader.cc
|
| index fb941e5d57302fc56e502d90fec16f02b6f074bb..1718f0a2b2d677a9a98d5775b52fb34c66b1a18a 100644
|
| --- a/chrome/browser/extensions/extension_app_icon_loader.cc
|
| +++ b/chrome/browser/extensions/extension_app_icon_loader.cc
|
| @@ -5,6 +5,8 @@
|
| #include "chrome/browser/extensions/extension_app_icon_loader.h"
|
|
|
| #include "base/stl_util.h"
|
| +#include "chrome/browser/extensions/extension_app_icon.h"
|
| +#include "chrome/browser/extensions/extension_app_icon_service.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| #include "chrome/browser/extensions/extension_util.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| @@ -58,15 +60,15 @@ void ExtensionAppIconLoader::FetchImage(const std::string& id) {
|
| if (!extension)
|
| return;
|
|
|
| - std::unique_ptr<extensions::IconImage> image(new extensions::IconImage(
|
| - profile(), extension, extensions::IconsInfo::GetIcons(extension),
|
| - icon_size(), extensions::util::GetDefaultAppIcon(), this));
|
| + std::unique_ptr<ExtensionAppIcon> icon =
|
| + ExtensionAppIconService::Get(profile())->CreateIcon(this, id,
|
| + icon_size());
|
|
|
| // Triggers image loading now instead of depending on paint message. This
|
| // makes the temp blank image be shown for shorter time and improves user
|
| // experience. See http://crbug.com/146114.
|
| - image->image_skia().EnsureRepsForSupportedScales();
|
| - map_[id] = std::move(image);
|
| + icon->EnsureRepsForSupportedScales();
|
| + map_[id] = std::move(icon);
|
| }
|
|
|
| void ExtensionAppIconLoader::ClearImage(const std::string& id) {
|
| @@ -78,34 +80,11 @@ void ExtensionAppIconLoader::UpdateImage(const std::string& id) {
|
| if (it == map_.end())
|
| return;
|
|
|
| - BuildImage(it->first, it->second->image_skia());
|
| + it->second->UpdateIcon();
|
| }
|
|
|
| -void ExtensionAppIconLoader::OnExtensionIconImageChanged(
|
| - extensions::IconImage* image) {
|
| - for (const auto& pair : map_) {
|
| - if (pair.second.get() == image) {
|
| - BuildImage(pair.first, pair.second->image_skia());
|
| - return;
|
| - }
|
| - }
|
| - // The image has been removed, do nothing.
|
| -}
|
| -
|
| -void ExtensionAppIconLoader::BuildImage(const std::string& id,
|
| - const gfx::ImageSkia& icon) {
|
| - gfx::ImageSkia image = icon;
|
| -
|
| -#if defined(OS_CHROMEOS)
|
| - util::MaybeApplyChromeBadge(profile(), id, &image);
|
| -#endif
|
| -
|
| - if (!util::IsAppLaunchable(id, profile())) {
|
| - const color_utils::HSL shift = {-1, 0, 0.6};
|
| - image = gfx::ImageSkiaOperations::CreateHSLShiftedImage(image, shift);
|
| - }
|
| -
|
| - delegate()->OnAppImageUpdated(id, image);
|
| +void ExtensionAppIconLoader::OnIconUpdated(ExtensionAppIcon* icon) {
|
| + delegate()->OnAppImageUpdated(icon->app_id(), icon->image_skia());
|
| }
|
|
|
| } // namespace extensions
|
|
|