Chromium Code Reviews| 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; |