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

Side by Side Diff: chrome/browser/ui/app_list/extension_app_item.cc

Issue 1419823011: app_sorting() calls should go via ExtensionSystem intsead of prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 1 month 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 (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/ui/app_list/extension_app_item.h" 5 #include "chrome/browser/ui/app_list/extension_app_item.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/extensions/extension_util.h" 8 #include "chrome/browser/extensions/extension_util.h"
9 #include "chrome/browser/extensions/launch_util.h" 9 #include "chrome/browser/extensions/launch_util.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/app_list/app_context_menu.h" 11 #include "chrome/browser/ui/app_list/app_context_menu.h"
12 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" 12 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
13 #include "chrome/browser/ui/app_list/app_list_service.h" 13 #include "chrome/browser/ui/app_list/app_list_service.h"
14 #include "chrome/browser/ui/extensions/extension_enable_flow.h" 14 #include "chrome/browser/ui/extensions/extension_enable_flow.h"
15 #include "chrome/browser/ui/host_desktop.h" 15 #include "chrome/browser/ui/host_desktop.h"
16 #include "chrome/common/extensions/extension_constants.h" 16 #include "chrome/common/extensions/extension_constants.h"
17 #include "chrome/common/extensions/extension_metrics.h" 17 #include "chrome/common/extensions/extension_metrics.h"
18 #include "content/public/browser/user_metrics.h" 18 #include "content/public/browser/user_metrics.h"
19 #include "extensions/browser/app_sorting.h" 19 #include "extensions/browser/app_sorting.h"
20 #include "extensions/browser/extension_prefs.h" 20 #include "extensions/browser/extension_prefs.h"
21 #include "extensions/browser/extension_registry.h" 21 #include "extensions/browser/extension_registry.h"
22 #include "extensions/browser/extension_system.h"
22 #include "extensions/common/extension.h" 23 #include "extensions/common/extension.h"
23 #include "extensions/common/extension_icon_set.h" 24 #include "extensions/common/extension_icon_set.h"
24 #include "extensions/common/manifest_handlers/icons_handler.h" 25 #include "extensions/common/manifest_handlers/icons_handler.h"
25 #include "extensions/common/manifest_url_handlers.h" 26 #include "extensions/common/manifest_url_handlers.h"
26 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
27 #include "sync/api/string_ordinal.h" 28 #include "sync/api/string_ordinal.h"
28 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
29 #include "ui/gfx/canvas.h" 30 #include "ui/gfx/canvas.h"
30 #include "ui/gfx/color_utils.h" 31 #include "ui/gfx/color_utils.h"
31 #include "ui/gfx/geometry/rect.h" 32 #include "ui/gfx/geometry/rect.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 canvas->DrawImageInt( 95 canvas->DrawImageInt(
95 gfx::ImageSkia(masking_canvas->ExtractImageRep()), 0, 0, masking_paint); 96 gfx::ImageSkia(masking_canvas->ExtractImageRep()), 0, 0, masking_paint);
96 } 97 }
97 98
98 gfx::ImageSkia icon_; 99 gfx::ImageSkia icon_;
99 100
100 DISALLOW_COPY_AND_ASSIGN(RoundedCornersImageSource); 101 DISALLOW_COPY_AND_ASSIGN(RoundedCornersImageSource);
101 }; 102 };
102 103
103 extensions::AppSorting* GetAppSorting(Profile* profile) { 104 extensions::AppSorting* GetAppSorting(Profile* profile) {
104 return extensions::ExtensionPrefs::Get(profile)->app_sorting(); 105 return extensions::ExtensionSystem::Get(profile)->app_sorting();
105 } 106 }
106 107
107 gfx::ImageSkia CreateDisabledIcon(const gfx::ImageSkia& icon) { 108 gfx::ImageSkia CreateDisabledIcon(const gfx::ImageSkia& icon) {
108 const color_utils::HSL shift = {-1, 0, 0.6}; 109 const color_utils::HSL shift = {-1, 0, 0.6};
109 return gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift); 110 return gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift);
110 } 111 }
111 112
112 } // namespace 113 } // namespace
113 114
114 ExtensionAppItem::ExtensionAppItem( 115 ExtensionAppItem::ExtensionAppItem(
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 const syncer::StringOrdinal& launch = 355 const syncer::StringOrdinal& launch =
355 GetAppSorting(profile_)->GetAppLaunchOrdinal(extension_id_); 356 GetAppSorting(profile_)->GetAppLaunchOrdinal(extension_id_);
356 set_position(syncer::StringOrdinal( 357 set_position(syncer::StringOrdinal(
357 page.ToInternalValue() + launch.ToInternalValue())); 358 page.ToInternalValue() + launch.ToInternalValue()));
358 } 359 }
359 360
360 AppListControllerDelegate* ExtensionAppItem::GetController() { 361 AppListControllerDelegate* ExtensionAppItem::GetController() {
361 return AppListService::Get(chrome::GetActiveDesktop())-> 362 return AppListService::Get(chrome::GetActiveDesktop())->
362 GetControllerDelegate(); 363 GetControllerDelegate();
363 } 364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698