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

Unified Diff: chrome/browser/dom_ui/app_launcher_handler.cc

Issue 6297013: [NTP] Allow reordering of apps via drag and drop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/app_launcher_handler.h ('k') | chrome/browser/extensions/extension_prefs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/app_launcher_handler.cc
diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc
index f1679c744118aa9641027c901e13bf9e9fb127c7..b5c9142b27e723992b21e598d71387865db9c55c 100644
--- a/chrome/browser/dom_ui/app_launcher_handler.cc
+++ b/chrome/browser/dom_ui/app_launcher_handler.cc
@@ -157,6 +157,8 @@ void AppLauncherHandler::RegisterMessages() {
NewCallback(this, &AppLauncherHandler::HandleHideAppsPromo));
dom_ui_->RegisterMessageCallback("createAppShortcut",
NewCallback(this, &AppLauncherHandler::HandleCreateAppShortcut));
+ dom_ui_->RegisterMessageCallback("reorderApps",
+ NewCallback(this, &AppLauncherHandler::HandleReorderApps));
}
void AppLauncherHandler::Observe(NotificationType type,
@@ -168,6 +170,7 @@ void AppLauncherHandler::Observe(NotificationType type,
switch (type.value) {
case NotificationType::EXTENSION_LOADED:
case NotificationType::EXTENSION_UNLOADED:
+ case NotificationType::EXTENSION_LAUNCHER_REORDERED:
if (dom_ui_->tab_contents())
HandleGetApps(NULL);
break;
@@ -257,6 +260,8 @@ void AppLauncherHandler::HandleGetApps(const ListValue* args) {
NotificationService::AllSources());
registrar_.Add(this, NotificationType::EXTENSION_UNLOADED,
NotificationService::AllSources());
+ registrar_.Add(this, NotificationType::EXTENSION_LAUNCHER_REORDERED,
+ NotificationService::AllSources());
}
if (pref_change_registrar_.IsEmpty()) {
pref_change_registrar_.Init(
@@ -387,6 +392,17 @@ void AppLauncherHandler::HandleCreateAppShortcut(const ListValue* args) {
browser->profile(), extension);
}
+void AppLauncherHandler::HandleReorderApps(const ListValue* args) {
+ std::vector<std::string> extension_ids;
+ for (size_t i = 0; i < args->GetSize(); ++i) {
+ std::string value;
+ if (args->GetString(i, &value))
+ extension_ids.push_back(value);
+ }
+
+ extensions_service_->extension_prefs()->SetAppLauncherOrder(extension_ids);
+}
+
// static
void AppLauncherHandler::RecordWebStoreLaunch(bool promo_active) {
if (!promo_active) return;
« no previous file with comments | « chrome/browser/dom_ui/app_launcher_handler.h ('k') | chrome/browser/extensions/extension_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698