OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/device_stylus_handler.h" | 5 #include "chrome/browser/ui/webui/settings/chromeos/device_stylus_handler.h" |
6 | 6 |
7 #include "ash/common/system/chromeos/palette/palette_utils.h" | 7 #include "ash/common/system/chromeos/palette/palette_utils.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "chrome/browser/chromeos/arc/arc_util.h" | 9 #include "chrome/browser/chromeos/arc/arc_util.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 dict->SetString(kAppIdKey, info.app_id); | 78 dict->SetString(kAppIdKey, info.app_id); |
79 dict->SetBoolean(kAppPreferredKey, info.preferred); | 79 dict->SetBoolean(kAppPreferredKey, info.preferred); |
80 apps_list.Append(std::move(dict)); | 80 apps_list.Append(std::move(dict)); |
81 | 81 |
82 note_taking_app_ids_.insert(info.app_id); | 82 note_taking_app_ids_.insert(info.app_id); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 AllowJavascript(); | 86 AllowJavascript(); |
87 CallJavascriptFunction("cr.webUIListenerCallback", | 87 CallJavascriptFunction("cr.webUIListenerCallback", |
88 base::StringValue("onNoteTakingAppsUpdated"), | 88 base::Value("onNoteTakingAppsUpdated"), apps_list, |
89 apps_list, base::Value(waiting_for_android)); | 89 base::Value(waiting_for_android)); |
90 } | 90 } |
91 | 91 |
92 void StylusHandler::RequestApps(const base::ListValue* unused_args) { | 92 void StylusHandler::RequestApps(const base::ListValue* unused_args) { |
93 UpdateNoteTakingApps(); | 93 UpdateNoteTakingApps(); |
94 } | 94 } |
95 | 95 |
96 void StylusHandler::SetPreferredNoteTakingApp(const base::ListValue* args) { | 96 void StylusHandler::SetPreferredNoteTakingApp(const base::ListValue* args) { |
97 std::string app_id; | 97 std::string app_id; |
98 CHECK(args->GetString(0, &app_id)); | 98 CHECK(args->GetString(0, &app_id)); |
99 | 99 |
(...skipping 10 matching lines...) Expand all Loading... |
110 | 110 |
111 void StylusHandler::HandleInitialize(const base::ListValue* args) { | 111 void StylusHandler::HandleInitialize(const base::ListValue* args) { |
112 if (ui::InputDeviceManager::GetInstance()->AreDeviceListsComplete()) | 112 if (ui::InputDeviceManager::GetInstance()->AreDeviceListsComplete()) |
113 SendHasStylus(); | 113 SendHasStylus(); |
114 } | 114 } |
115 | 115 |
116 void StylusHandler::SendHasStylus() { | 116 void StylusHandler::SendHasStylus() { |
117 DCHECK(ui::InputDeviceManager::GetInstance()->AreDeviceListsComplete()); | 117 DCHECK(ui::InputDeviceManager::GetInstance()->AreDeviceListsComplete()); |
118 AllowJavascript(); | 118 AllowJavascript(); |
119 CallJavascriptFunction("cr.webUIListenerCallback", | 119 CallJavascriptFunction("cr.webUIListenerCallback", |
120 base::StringValue("has-stylus-changed"), | 120 base::Value("has-stylus-changed"), |
121 base::Value(ash::palette_utils::HasStylusInput())); | 121 base::Value(ash::palette_utils::HasStylusInput())); |
122 } | 122 } |
123 | 123 |
124 void StylusHandler::ShowPlayStoreApps(const base::ListValue* args) { | 124 void StylusHandler::ShowPlayStoreApps(const base::ListValue* args) { |
125 std::string apps_url; | 125 std::string apps_url; |
126 args->GetString(0, &apps_url); | 126 args->GetString(0, &apps_url); |
127 Profile* profile = Profile::FromWebUI(web_ui()); | 127 Profile* profile = Profile::FromWebUI(web_ui()); |
128 if (!arc::IsArcAllowedForProfile(profile)) { | 128 if (!arc::IsArcAllowedForProfile(profile)) { |
129 VLOG(1) << "ARC is not enabled for this profile"; | 129 VLOG(1) << "ARC is not enabled for this profile"; |
130 return; | 130 return; |
131 } | 131 } |
132 | 132 |
133 arc::LaunchPlayStoreWithUrl(apps_url); | 133 arc::LaunchPlayStoreWithUrl(apps_url); |
134 } | 134 } |
135 | 135 |
136 } // namespace settings | 136 } // namespace settings |
137 } // namespace chromeos | 137 } // namespace chromeos |
OLD | NEW |