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

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/ntp/app_launcher_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index bebb610665706354bd90b5202e258a78f414d4c9..e4c3121d0b9a798792fe0d1e41934044361e3df6 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -73,6 +73,7 @@ using extensions::Extension;
using extensions::ExtensionPrefs;
using extensions::ExtensionRegistry;
using extensions::ExtensionSet;
+using extensions::ExtensionSystem;
namespace {
@@ -176,7 +177,7 @@ void AppLauncherHandler::CreateAppInfo(
value->SetBoolean("is_webstore",
extension->id() == extensions::kWebStoreAppId);
- AppSorting* sorting = prefs->app_sorting();
+ AppSorting* sorting = ExtensionSystem::Get(service->profile())->app_sorting();
syncer::StringOrdinal page_ordinal = sorting->GetPageOrdinal(extension->id());
if (!page_ordinal.IsValid()) {
// Make sure every app has a page ordinal (some predate the page ordinal).
@@ -439,10 +440,9 @@ void AppLauncherHandler::HandleGetApps(const base::ListValue* args) {
extension_pref_change_registrar_.Add(prefs::kNtpAppPageNames, callback);
ExtensionRegistry::Get(profile)->AddObserver(this);
- registrar_.Add(this,
- chrome::NOTIFICATION_APP_LAUNCHER_REORDERED,
+ registrar_.Add(this, chrome::NOTIFICATION_APP_LAUNCHER_REORDERED,
content::Source<AppSorting>(
- ExtensionPrefs::Get(profile)->app_sorting()));
+ ExtensionSystem::Get(profile)->app_sorting()));
registrar_.Add(this,
extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR,
content::Source<CrxInstaller>(NULL));
@@ -636,14 +636,15 @@ void AppLauncherHandler::HandleReorderApps(const base::ListValue* args) {
ExtensionPrefs* extension_prefs =
ExtensionPrefs::Get(extension_service_->GetBrowserContext());
extension_prefs->SetAppDraggedByUser(dragged_app_id);
- extension_prefs->app_sorting()->OnExtensionMoved(
- dragged_app_id, predecessor_to_moved_ext, successor_to_moved_ext);
+ ExtensionSystem::Get(extension_service_->GetBrowserContext())
+ ->app_sorting()
+ ->OnExtensionMoved(dragged_app_id, predecessor_to_moved_ext,
+ successor_to_moved_ext);
}
void AppLauncherHandler::HandleSetPageIndex(const base::ListValue* args) {
AppSorting* app_sorting =
- ExtensionPrefs::Get(extension_service_->profile())->app_sorting();
-
+ ExtensionSystem::Get(extension_service_->profile())->app_sorting();
std::string extension_id;
double page_index;
CHECK(args->GetString(0, &extension_id));
@@ -681,7 +682,7 @@ void AppLauncherHandler::HandleGenerateAppForLink(const base::ListValue* args) {
double page_index;
CHECK(args->GetDouble(2, &page_index));
AppSorting* app_sorting =
- ExtensionPrefs::Get(extension_service_->profile())->app_sorting();
+ ExtensionSystem::Get(extension_service_->profile())->app_sorting();
const syncer::StringOrdinal& page_ordinal =
app_sorting->PageIntegerAsStringOrdinal(static_cast<size_t>(page_index));
« no previous file with comments | « chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc ('k') | extensions/browser/extension_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698