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

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

Issue 2028593004: Add new InputDeviceManager interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_keyboard
Patch Set: Fix windows compile error. Created 4 years, 6 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
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_keyboard_handler.h" 5 #include "chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h"
6 6
7 #include "ash/new_window_delegate.h" 7 #include "ash/new_window_delegate.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chromeos/chromeos_switches.h" 13 #include "chromeos/chromeos_switches.h"
14 #include "content/public/browser/web_ui.h" 14 #include "content/public/browser/web_ui.h"
15 #include "ui/events/devices/device_data_manager.h" 15 #include "ui/events/devices/input_device_manager.h"
16 16
17 namespace { 17 namespace {
18 18
19 bool HasExternalKeyboard() { 19 bool HasExternalKeyboard() {
20 for (const ui::InputDevice& keyboard : 20 for (const ui::InputDevice& keyboard :
21 ui::DeviceDataManager::GetInstance()->keyboard_devices()) { 21 ui::InputDeviceManager::GetInstance()->GetKeyboardDevices()) {
22 if (keyboard.type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) 22 if (keyboard.type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)
23 return true; 23 return true;
24 } 24 }
25 25
26 return false; 26 return false;
27 } 27 }
28 28
29 } // namespace 29 } // namespace
30 30
31 namespace chromeos { 31 namespace chromeos {
(...skipping 10 matching lines...) Expand all
42 "initializeKeyboardSettings", 42 "initializeKeyboardSettings",
43 base::Bind(&KeyboardHandler::HandleInitialize, 43 base::Bind(&KeyboardHandler::HandleInitialize,
44 base::Unretained(this))); 44 base::Unretained(this)));
45 web_ui()->RegisterMessageCallback( 45 web_ui()->RegisterMessageCallback(
46 "showKeyboardShortcutsOverlay", 46 "showKeyboardShortcutsOverlay",
47 base::Bind(&KeyboardHandler::HandleShowKeyboardShortcutsOverlay, 47 base::Bind(&KeyboardHandler::HandleShowKeyboardShortcutsOverlay,
48 base::Unretained(this))); 48 base::Unretained(this)));
49 } 49 }
50 50
51 void KeyboardHandler::OnJavascriptAllowed() { 51 void KeyboardHandler::OnJavascriptAllowed() {
52 observer_.Add(ui::DeviceDataManager::GetInstance()); 52 observer_.Add(ui::InputDeviceManager::GetInstance());
53 } 53 }
54 54
55 void KeyboardHandler::OnJavascriptDisallowed() { 55 void KeyboardHandler::OnJavascriptDisallowed() {
56 observer_.RemoveAll(); 56 observer_.RemoveAll();
57 } 57 }
58 58
59 void KeyboardHandler::OnKeyboardDeviceConfigurationChanged() { 59 void KeyboardHandler::OnKeyboardDeviceConfigurationChanged() {
60 UpdateShowKeys(); 60 UpdateShowKeys();
61 } 61 }
62 62
(...skipping 12 matching lines...) Expand all
75 const base::FundamentalValue has_diamond_key( 75 const base::FundamentalValue has_diamond_key(
76 base::CommandLine::ForCurrentProcess()->HasSwitch( 76 base::CommandLine::ForCurrentProcess()->HasSwitch(
77 chromeos::switches::kHasChromeOSDiamondKey)); 77 chromeos::switches::kHasChromeOSDiamondKey));
78 CallJavascriptFunction("cr.webUIListenerCallback", 78 CallJavascriptFunction("cr.webUIListenerCallback",
79 base::StringValue("show-keys-changed"), has_caps_lock, 79 base::StringValue("show-keys-changed"), has_caps_lock,
80 has_diamond_key); 80 has_diamond_key);
81 } 81 }
82 82
83 } // namespace settings 83 } // namespace settings
84 } // namespace chromeos 84 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698