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/device_pointer_handler.h" | 5 #include "chrome/browser/ui/webui/settings/chromeos/device_pointer_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "content/public/browser/web_ui.h" | 9 #include "content/public/browser/web_ui.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 pointer_device_observer_->AddObserver(this); | 30 pointer_device_observer_->AddObserver(this); |
31 pointer_device_observer_->CheckDevices(); | 31 pointer_device_observer_->CheckDevices(); |
32 } | 32 } |
33 | 33 |
34 void PointerHandler::OnJavascriptDisallowed() { | 34 void PointerHandler::OnJavascriptDisallowed() { |
35 pointer_device_observer_->RemoveObserver(this); | 35 pointer_device_observer_->RemoveObserver(this); |
36 } | 36 } |
37 | 37 |
38 void PointerHandler::TouchpadExists(bool exists) { | 38 void PointerHandler::TouchpadExists(bool exists) { |
39 CallJavascriptFunction("cr.webUIListenerCallback", | 39 FireWebUIListener("has-touchpad-changed", base::Value(exists)); |
40 base::Value("has-touchpad-changed"), | |
41 base::Value(exists)); | |
42 } | 40 } |
43 | 41 |
44 void PointerHandler::MouseExists(bool exists) { | 42 void PointerHandler::MouseExists(bool exists) { |
45 CallJavascriptFunction("cr.webUIListenerCallback", | 43 FireWebUIListener("has-mouse-changed", base::Value(exists)); |
46 base::Value("has-mouse-changed"), base::Value(exists)); | |
47 } | 44 } |
48 | 45 |
49 void PointerHandler::HandleInitialize(const base::ListValue* args) { | 46 void PointerHandler::HandleInitialize(const base::ListValue* args) { |
50 AllowJavascript(); | 47 AllowJavascript(); |
51 } | 48 } |
52 | 49 |
53 } // namespace settings | 50 } // namespace settings |
54 } // namespace chromeos | 51 } // namespace chromeos |
OLD | NEW |