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