Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: chrome/browser/ui/webui/settings/chromeos/device_pointer_handler.cc

Issue 2110833003: MD Settings: Add mouse settings, update pointer settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PointersFake
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/settings/chromeos/device_pointer_handler.h"
6
7 #include "base/bind.h"
8 #include "base/sys_info.h"
9 #include "base/values.h"
10 #include "content/public/browser/web_ui.h"
11
12 namespace chromeos {
13 namespace settings {
14
15 PointerHandler::PointerHandler() {}
16
17 PointerHandler::~PointerHandler() {}
18
19 void PointerHandler::RegisterMessages() {
20 web_ui()->RegisterMessageCallback(
21 "initializePointerSettings",
22 base::Bind(&PointerHandler::HandleInitialize, base::Unretained(this)));
23 }
24
25 void PointerHandler::OnJavascriptAllowed() {
26 if (!pointer_device_observer_) {
27 pointer_device_observer_.reset(new system::PointerDeviceObserver());
28 pointer_device_observer_->Init();
29 }
30
31 pointer_device_observer_->AddObserver(this);
32 pointer_device_observer_->CheckDevices();
33 }
34
35 void PointerHandler::OnJavascriptDisallowed() {
36 pointer_device_observer_->RemoveObserver(this);
37 }
38
39 void PointerHandler::TouchpadExists(bool exists) {
40 CallJavascriptFunction("cr.webUIListenerCallback",
41 base::StringValue("has-touchpad-changed"),
42 base::FundamentalValue(exists));
43 }
44
45 void PointerHandler::MouseExists(bool exists) {
46 CallJavascriptFunction("cr.webUIListenerCallback",
47 base::StringValue("has-mouse-changed"),
48 base::FundamentalValue(exists));
49 }
50
51 void PointerHandler::HandleInitialize(const base::ListValue* args) {
52 AllowJavascript();
53 }
54
55 } // namespace settings
56 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698