OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_app_icon_loader.h" | 5 #include "chrome/browser/extensions/extension_app_icon_loader.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_util.h" | 9 #include "chrome/browser/extensions/extension_util.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/common/extensions/extension_constants.h" | 11 #include "chrome/common/extensions/extension_constants.h" |
12 #include "extensions/browser/extension_system.h" | 12 #include "extensions/browser/extension_system.h" |
13 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
14 #include "extensions/common/manifest_handlers/icons_handler.h" | 14 #include "extensions/common/manifest_handlers/icons_handler.h" |
15 #include "ui/gfx/color_utils.h" | 15 #include "ui/gfx/color_utils.h" |
16 #include "ui/gfx/image/image_skia_operations.h" | 16 #include "ui/gfx/image/image_skia_operations.h" |
17 | 17 |
18 #if defined(OS_CHROMEOS) | |
19 #include "chrome/browser/chromeos/extensions/gfx_utils.h" | |
20 #endif | |
21 | |
18 namespace { | 22 namespace { |
19 | 23 |
20 const extensions::Extension* GetExtensionByID(Profile* profile, | 24 const extensions::Extension* GetExtensionByID(Profile* profile, |
21 const std::string& id) { | 25 const std::string& id) { |
22 ExtensionService* service = | 26 ExtensionService* service = |
23 extensions::ExtensionSystem::Get(profile)->extension_service(); | 27 extensions::ExtensionSystem::Get(profile)->extension_service(); |
24 if (!service) | 28 if (!service) |
25 return nullptr; | 29 return nullptr; |
26 return service->GetInstalledExtension(id); | 30 return service->GetInstalledExtension(id); |
27 } | 31 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 return; | 89 return; |
86 } | 90 } |
87 } | 91 } |
88 // The image has been removed, do nothing. | 92 // The image has been removed, do nothing. |
89 } | 93 } |
90 | 94 |
91 void ExtensionAppIconLoader::BuildImage(const std::string& id, | 95 void ExtensionAppIconLoader::BuildImage(const std::string& id, |
92 const gfx::ImageSkia& icon) { | 96 const gfx::ImageSkia& icon) { |
93 gfx::ImageSkia image = icon; | 97 gfx::ImageSkia image = icon; |
94 | 98 |
99 #if defined(OS_CHROMEOS) | |
100 util::MaybeApplyChromeBadge(profile(), id, &image); | |
benwells
2016/06/16 07:45:43
Why do you have to do this here and in all the UI
xdai1
2016/06/16 17:00:13
From my understanding, this work is mostly for exp
| |
101 #endif | |
102 | |
95 if (!util::IsAppLaunchable(id, profile())) { | 103 if (!util::IsAppLaunchable(id, profile())) { |
96 const color_utils::HSL shift = {-1, 0, 0.6}; | 104 const color_utils::HSL shift = {-1, 0, 0.6}; |
97 image = gfx::ImageSkiaOperations::CreateHSLShiftedImage(image, shift); | 105 image = gfx::ImageSkiaOperations::CreateHSLShiftedImage(image, shift); |
98 } | 106 } |
99 | 107 |
100 delegate()->OnAppImageUpdated(id, image); | 108 delegate()->OnAppImageUpdated(id, image); |
101 } | 109 } |
102 | 110 |
103 } // namespace extensions | 111 } // namespace extensions |
OLD | NEW |