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

Side by Side Diff: chrome/browser/ui/app_list/search/extension_app_result.cc

Issue 2787693002: Remove more dead app list code. (Closed)
Patch Set: updated comment Created 3 years, 8 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 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 "base/metrics/user_metrics.h" 7 #include "base/metrics/user_metrics.h"
8 #include "chrome/browser/extensions/extension_util.h" 8 #include "chrome/browser/extensions/extension_util.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" 10 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
11 #include "chrome/browser/ui/app_list/extension_app_context_menu.h" 11 #include "chrome/browser/ui/app_list/extension_app_context_menu.h"
12 #include "chrome/browser/ui/app_list/search/search_util.h" 12 #include "chrome/browser/ui/app_list/search/search_util.h"
13 #include "chrome/browser/ui/extensions/extension_enable_flow.h" 13 #include "chrome/browser/ui/extensions/extension_enable_flow.h"
14 #include "chrome/common/extensions/extension_metrics.h" 14 #include "chrome/common/extensions/extension_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
27 #if defined(OS_CHROMEOS)
28 #include "chrome/browser/chromeos/extensions/gfx_utils.h" 26 #include "chrome/browser/chromeos/extensions/gfx_utils.h"
29 #endif
30 27
31 namespace app_list { 28 namespace app_list {
32 29
33 ExtensionAppResult::ExtensionAppResult(Profile* profile, 30 ExtensionAppResult::ExtensionAppResult(Profile* profile,
34 const std::string& app_id, 31 const std::string& app_id,
35 AppListControllerDelegate* controller, 32 AppListControllerDelegate* controller,
36 bool is_recommendation) 33 bool is_recommendation)
37 : AppResult(profile, app_id, controller, is_recommendation) { 34 : AppResult(profile, app_id, controller, is_recommendation) {
38 set_id(extensions::Extension::GetBaseURLFromExtensionId(app_id).spec()); 35 set_id(extensions::Extension::GetBaseURLFromExtensionId(app_id).spec());
39 36
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 profile(), app_id(), this)); 130 profile(), app_id(), this));
134 extension_enable_flow_->StartForNativeWindow( 131 extension_enable_flow_->StartForNativeWindow(
135 controller()->GetAppListWindow()); 132 controller()->GetAppListWindow());
136 } 133 }
137 return true; 134 return true;
138 } 135 }
139 136
140 void ExtensionAppResult::UpdateIcon() { 137 void ExtensionAppResult::UpdateIcon() {
141 gfx::ImageSkia icon = icon_->image_skia(); 138 gfx::ImageSkia icon = icon_->image_skia();
142 139
143 #if defined(OS_CHROMEOS)
144 extensions::util::MaybeApplyChromeBadge(profile(), app_id(), &icon); 140 extensions::util::MaybeApplyChromeBadge(profile(), app_id(), &icon);
145 #endif
146 141
147 if (!extensions::util::IsAppLaunchable(app_id(), profile())) { 142 if (!extensions::util::IsAppLaunchable(app_id(), profile())) {
148 const color_utils::HSL shift = {-1, 0, 0.6}; 143 const color_utils::HSL shift = {-1, 0, 0.6};
149 icon = gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift); 144 icon = gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift);
150 } 145 }
151 146
152 SetIcon(icon); 147 SetIcon(icon);
153 } 148 }
154 149
155 void ExtensionAppResult::OnExtensionIconImageChanged( 150 void ExtensionAppResult::OnExtensionIconImageChanged(
(...skipping 29 matching lines...) Expand all
185 const extensions::Extension* extension) { 180 const extensions::Extension* extension) {
186 UpdateIcon(); 181 UpdateIcon();
187 } 182 }
188 183
189 void ExtensionAppResult::OnShutdown(extensions::ExtensionRegistry* registry) { 184 void ExtensionAppResult::OnShutdown(extensions::ExtensionRegistry* registry) {
190 DCHECK_EQ(extension_registry_, registry); 185 DCHECK_EQ(extension_registry_, registry);
191 StopObservingExtensionRegistry(); 186 StopObservingExtensionRegistry();
192 } 187 }
193 188
194 } // namespace app_list 189 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698