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

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: rebase 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
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..edb0d423ba699b94764b0e79a6d436b04c7e794e 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:
Aaron Boodman 2011/01/22 23:42:57 Are you sure you need this? I believe that changin
jstritar 2011/01/24 01:00:42 I talked to akalin, and he suggested having a noti
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_->SetAppLauncherOrder(extension_ids);
+}
+
// static
void AppLauncherHandler::RecordWebStoreLaunch(bool promo_active) {
if (!promo_active) return;

Powered by Google App Engine
This is Rietveld 408576698