OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list/search/extension_app_result.h" | 5 #include "chrome/browser/ui/app_list/search/extension_app_result.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_util.h" | 7 #include "chrome/browser/extensions/extension_util.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 9 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
10 #include "chrome/browser/ui/app_list/extension_app_context_menu.h" | 10 #include "chrome/browser/ui/app_list/extension_app_context_menu.h" |
11 #include "chrome/browser/ui/app_list/search/search_util.h" | 11 #include "chrome/browser/ui/app_list/search/search_util.h" |
12 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 12 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
13 #include "chrome/common/extensions/extension_metrics.h" | 13 #include "chrome/common/extensions/extension_metrics.h" |
14 #include "content/public/browser/user_metrics.h" | 14 #include "content/public/browser/user_metrics.h" |
15 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
16 #include "extensions/browser/extension_system_provider.h" | 16 #include "extensions/browser/extension_system_provider.h" |
17 #include "extensions/browser/extensions_browser_client.h" | 17 #include "extensions/browser/extensions_browser_client.h" |
18 #include "extensions/common/constants.h" | 18 #include "extensions/common/constants.h" |
19 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
20 #include "extensions/common/extension_icon_set.h" | 20 #include "extensions/common/extension_icon_set.h" |
21 #include "extensions/common/manifest_handlers/icons_handler.h" | 21 #include "extensions/common/manifest_handlers/icons_handler.h" |
22 #include "ui/app_list/app_list_switches.h" | 22 #include "ui/app_list/app_list_switches.h" |
23 #include "ui/events/event_constants.h" | 23 #include "ui/events/event_constants.h" |
24 #include "ui/gfx/color_utils.h" | 24 #include "ui/gfx/color_utils.h" |
25 #include "ui/gfx/image/image_skia_operations.h" | 25 #include "ui/gfx/image/image_skia_operations.h" |
26 | 26 |
| 27 #if defined(OS_CHROMEOS) |
| 28 #include "chrome/browser/chromeos/extensions/gfx_utils.h" |
| 29 #endif |
| 30 |
27 namespace app_list { | 31 namespace app_list { |
28 | 32 |
29 ExtensionAppResult::ExtensionAppResult(Profile* profile, | 33 ExtensionAppResult::ExtensionAppResult(Profile* profile, |
30 const std::string& app_id, | 34 const std::string& app_id, |
31 AppListControllerDelegate* controller, | 35 AppListControllerDelegate* controller, |
32 bool is_recommendation) | 36 bool is_recommendation) |
33 : AppResult(profile, app_id, controller, is_recommendation) { | 37 : AppResult(profile, app_id, controller, is_recommendation) { |
34 set_id(extensions::Extension::GetBaseURLFromExtensionId(app_id).spec()); | 38 set_id(extensions::Extension::GetBaseURLFromExtensionId(app_id).spec()); |
35 | 39 |
36 const extensions::Extension* extension = | 40 const extensions::Extension* extension = |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 profile(), app_id(), this)); | 134 profile(), app_id(), this)); |
131 extension_enable_flow_->StartForNativeWindow( | 135 extension_enable_flow_->StartForNativeWindow( |
132 controller()->GetAppListWindow()); | 136 controller()->GetAppListWindow()); |
133 } | 137 } |
134 return true; | 138 return true; |
135 } | 139 } |
136 | 140 |
137 void ExtensionAppResult::UpdateIcon() { | 141 void ExtensionAppResult::UpdateIcon() { |
138 gfx::ImageSkia icon = icon_->image_skia(); | 142 gfx::ImageSkia icon = icon_->image_skia(); |
139 | 143 |
| 144 #if defined(OS_CHROMEOS) |
| 145 extensions::util::MaybeApplyChromeBadge(profile(), app_id(), &icon); |
| 146 #endif |
| 147 |
140 if (!extensions::util::IsAppLaunchable(app_id(), profile())) { | 148 if (!extensions::util::IsAppLaunchable(app_id(), profile())) { |
141 const color_utils::HSL shift = {-1, 0, 0.6}; | 149 const color_utils::HSL shift = {-1, 0, 0.6}; |
142 icon = gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift); | 150 icon = gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift); |
143 } | 151 } |
144 | 152 |
145 SetIcon(icon); | 153 SetIcon(icon); |
146 } | 154 } |
147 | 155 |
148 void ExtensionAppResult::OnExtensionIconImageChanged( | 156 void ExtensionAppResult::OnExtensionIconImageChanged( |
149 extensions::IconImage* image) { | 157 extensions::IconImage* image) { |
(...skipping 28 matching lines...) Expand all Loading... |
178 const extensions::Extension* extension) { | 186 const extensions::Extension* extension) { |
179 UpdateIcon(); | 187 UpdateIcon(); |
180 } | 188 } |
181 | 189 |
182 void ExtensionAppResult::OnShutdown(extensions::ExtensionRegistry* registry) { | 190 void ExtensionAppResult::OnShutdown(extensions::ExtensionRegistry* registry) { |
183 DCHECK_EQ(extension_registry_, registry); | 191 DCHECK_EQ(extension_registry_, registry); |
184 StopObservingExtensionRegistry(); | 192 StopObservingExtensionRegistry(); |
185 } | 193 } |
186 | 194 |
187 } // namespace app_list | 195 } // namespace app_list |
OLD | NEW |