OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/settings/chromeos/android_apps_handler.h" | 5 #include "chrome/browser/ui/webui/settings/chromeos/android_apps_handler.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/chromeos/arc/arc_util.h" | 8 #include "chrome/browser/chromeos/arc/arc_util.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" // kSettingsAppId | 10 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" // kSettingsAppId |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 | 79 |
80 void AndroidAppsHandler::HandleRequestAndroidAppsInfo( | 80 void AndroidAppsHandler::HandleRequestAndroidAppsInfo( |
81 const base::ListValue* args) { | 81 const base::ListValue* args) { |
82 SendAndroidAppsInfo(); | 82 SendAndroidAppsInfo(); |
83 } | 83 } |
84 | 84 |
85 void AndroidAppsHandler::SendAndroidAppsInfo() { | 85 void AndroidAppsHandler::SendAndroidAppsInfo() { |
86 AllowJavascript(); | 86 AllowJavascript(); |
87 std::unique_ptr<base::DictionaryValue> info = BuildAndroidAppsInfo(); | 87 std::unique_ptr<base::DictionaryValue> info = BuildAndroidAppsInfo(); |
88 CallJavascriptFunction("cr.webUIListenerCallback", | 88 FireWebUIListener("android-apps-info-update", *info); |
89 base::Value("android-apps-info-update"), *info); | |
90 } | 89 } |
91 | 90 |
92 void AndroidAppsHandler::ShowAndroidAppsSettings(const base::ListValue* args) { | 91 void AndroidAppsHandler::ShowAndroidAppsSettings(const base::ListValue* args) { |
93 CHECK_EQ(1U, args->GetSize()); | 92 CHECK_EQ(1U, args->GetSize()); |
94 bool activated_from_keyboard = false; | 93 bool activated_from_keyboard = false; |
95 args->GetBoolean(0, &activated_from_keyboard); | 94 args->GetBoolean(0, &activated_from_keyboard); |
96 int flags = activated_from_keyboard ? ui::EF_NONE : ui::EF_LEFT_MOUSE_BUTTON; | 95 int flags = activated_from_keyboard ? ui::EF_NONE : ui::EF_LEFT_MOUSE_BUTTON; |
97 | 96 |
98 // Settings in secondary profile cannot access ARC. | 97 // Settings in secondary profile cannot access ARC. |
99 CHECK(arc::IsArcAllowedForProfile(profile_)); | 98 CHECK(arc::IsArcAllowedForProfile(profile_)); |
100 arc::LaunchAndroidSettingsApp(profile_, flags); | 99 arc::LaunchAndroidSettingsApp(profile_, flags); |
101 } | 100 } |
102 | 101 |
103 } // namespace settings | 102 } // namespace settings |
104 } // namespace chromeos | 103 } // namespace chromeos |
OLD | NEW |