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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialog.Launches", | 629 UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialog.Launches", |
630 AppInfoLaunchSource::FROM_APPS_PAGE, | 630 AppInfoLaunchSource::FROM_APPS_PAGE, |
631 AppInfoLaunchSource::NUM_LAUNCH_SOURCES); | 631 AppInfoLaunchSource::NUM_LAUNCH_SOURCES); |
632 | 632 |
633 ShowAppInfoInNativeDialog( | 633 ShowAppInfoInNativeDialog( |
634 web_ui()->GetWebContents(), GetAppInfoNativeDialogSize(), | 634 web_ui()->GetWebContents(), GetAppInfoNativeDialogSize(), |
635 Profile::FromWebUI(web_ui()), extension, base::Closure()); | 635 Profile::FromWebUI(web_ui()), extension, base::Closure()); |
636 } | 636 } |
637 | 637 |
638 void AppLauncherHandler::HandleReorderApps(const base::ListValue* args) { | 638 void AppLauncherHandler::HandleReorderApps(const base::ListValue* args) { |
639 CHECK(args->GetSize() == 2); | 639 CHECK(args->base::Value::GetList().size() == 2); |
640 | 640 std::string dragged_app_id = args->base::Value::GetList()[0].GetString(); |
641 std::string dragged_app_id; | 641 const base::ListValue* app_order = |
642 const base::ListValue* app_order; | 642 static_cast<const base::ListValue*>(&args->base::Value::GetList()[1]); |
643 CHECK(args->GetString(0, &dragged_app_id)); | |
644 CHECK(args->GetList(1, &app_order)); | |
645 | 643 |
646 std::string predecessor_to_moved_ext; | 644 std::string predecessor_to_moved_ext; |
647 std::string successor_to_moved_ext; | 645 std::string successor_to_moved_ext; |
648 for (size_t i = 0; i < app_order->GetSize(); ++i) { | 646 for (size_t i = 0; i < app_order->GetSize(); ++i) { |
649 std::string value; | 647 std::string value; |
650 if (app_order->GetString(i, &value) && value == dragged_app_id) { | 648 if (app_order->GetString(i, &value) && value == dragged_app_id) { |
651 if (i > 0) | 649 if (i > 0) |
652 CHECK(app_order->GetString(i - 1, &predecessor_to_moved_ext)); | 650 CHECK(app_order->GetString(i - 1, &predecessor_to_moved_ext)); |
653 if (i + 1 < app_order->GetSize()) | 651 if (i + 1 < app_order->GetSize()) |
654 CHECK(app_order->GetString(i + 1, &successor_to_moved_ext)); | 652 CHECK(app_order->GetString(i + 1, &successor_to_moved_ext)); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 base::Value(!extension_id_prompting_.empty())); | 881 base::Value(!extension_id_prompting_.empty())); |
884 } | 882 } |
885 | 883 |
886 bool AppLauncherHandler::ShouldShow(const Extension* extension) const { | 884 bool AppLauncherHandler::ShouldShow(const Extension* extension) const { |
887 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app()) | 885 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app()) |
888 return false; | 886 return false; |
889 | 887 |
890 Profile* profile = Profile::FromWebUI(web_ui()); | 888 Profile* profile = Profile::FromWebUI(web_ui()); |
891 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile); | 889 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile); |
892 } | 890 } |
OLD | NEW |