OLD | NEW |
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/webui/ntp/app_launcher_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 Browser* browser = browser::FindBrowserWithWebContents( | 643 Browser* browser = browser::FindBrowserWithWebContents( |
644 web_ui()->GetWebContents()); | 644 web_ui()->GetWebContents()); |
645 browser->window()->ShowCreateChromeAppShortcutsDialog( | 645 browser->window()->ShowCreateChromeAppShortcutsDialog( |
646 browser->profile(), extension); | 646 browser->profile(), extension); |
647 } | 647 } |
648 | 648 |
649 void AppLauncherHandler::HandleReorderApps(const ListValue* args) { | 649 void AppLauncherHandler::HandleReorderApps(const ListValue* args) { |
650 CHECK(args->GetSize() == 2); | 650 CHECK(args->GetSize() == 2); |
651 | 651 |
652 std::string dragged_app_id; | 652 std::string dragged_app_id; |
653 ListValue* app_order; | 653 const ListValue* app_order; |
654 CHECK(args->GetString(0, &dragged_app_id)); | 654 CHECK(args->GetString(0, &dragged_app_id)); |
655 CHECK(args->GetList(1, &app_order)); | 655 CHECK(args->GetList(1, &app_order)); |
656 | 656 |
657 std::string predecessor_to_moved_ext; | 657 std::string predecessor_to_moved_ext; |
658 std::string successor_to_moved_ext; | 658 std::string successor_to_moved_ext; |
659 for (size_t i = 0; i < app_order->GetSize(); ++i) { | 659 for (size_t i = 0; i < app_order->GetSize(); ++i) { |
660 std::string value; | 660 std::string value; |
661 if (app_order->GetString(i, &value) && value == dragged_app_id) { | 661 if (app_order->GetString(i, &value) && value == dragged_app_id) { |
662 if (i > 0) | 662 if (i > 0) |
663 CHECK(app_order->GetString(i - 1, &predecessor_to_moved_ext)); | 663 CHECK(app_order->GetString(i - 1, &predecessor_to_moved_ext)); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 | 995 |
996 void AppLauncherHandler::UninstallDefaultApps() { | 996 void AppLauncherHandler::UninstallDefaultApps() { |
997 AppsPromo* apps_promo = extension_service_->apps_promo(); | 997 AppsPromo* apps_promo = extension_service_->apps_promo(); |
998 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 998 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
999 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); | 999 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); |
1000 iter != app_ids.end(); ++iter) { | 1000 iter != app_ids.end(); ++iter) { |
1001 if (extension_service_->GetExtensionById(*iter, true)) | 1001 if (extension_service_->GetExtensionById(*iter, true)) |
1002 extension_service_->UninstallExtension(*iter, false, NULL); | 1002 extension_service_->UninstallExtension(*iter, false, NULL); |
1003 } | 1003 } |
1004 } | 1004 } |
OLD | NEW |