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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/keyboard_handler.cc

Issue 2019413002: Remove KeyboardDevice class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes for comments. 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/options/chromeos/keyboard_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/keyboard_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "ash/new_window_delegate.h" 9 #include "ash/new_window_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
17 #include "chromeos/chromeos_switches.h" 17 #include "chromeos/chromeos_switches.h"
18 #include "content/public/browser/web_ui.h" 18 #include "content/public/browser/web_ui.h"
19 #include "ui/base/ime/chromeos/ime_keyboard.h" 19 #include "ui/base/ime/chromeos/ime_keyboard.h"
20 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/events/devices/device_data_manager.h" 21 #include "ui/events/devices/device_data_manager.h"
22 #include "ui/events/devices/keyboard_device.h"
23 22
24 namespace { 23 namespace {
25 const struct ModifierKeysSelectItem { 24 const struct ModifierKeysSelectItem {
26 int message_id; 25 int message_id;
27 chromeos::input_method::ModifierKey value; 26 chromeos::input_method::ModifierKey value;
28 } kModifierKeysSelectItems[] = { 27 } kModifierKeysSelectItems[] = {
29 { IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_SEARCH, 28 { IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_SEARCH,
30 chromeos::input_method::kSearchKey }, 29 chromeos::input_method::kSearchKey },
31 { IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_CTRL, 30 { IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_CTRL,
32 chromeos::input_method::kControlKey }, 31 chromeos::input_method::kControlKey },
(...skipping 11 matching lines...) Expand all
44 43
45 const char* kDataValuesNames[] = { 44 const char* kDataValuesNames[] = {
46 "remapSearchKeyToValue", 45 "remapSearchKeyToValue",
47 "remapControlKeyToValue", 46 "remapControlKeyToValue",
48 "remapAltKeyToValue", 47 "remapAltKeyToValue",
49 "remapCapsLockKeyToValue", 48 "remapCapsLockKeyToValue",
50 "remapDiamondKeyToValue", 49 "remapDiamondKeyToValue",
51 }; 50 };
52 51
53 bool HasExternalKeyboard() { 52 bool HasExternalKeyboard() {
54 for (const ui::KeyboardDevice& keyboard : 53 for (const ui::InputDevice& keyboard :
55 ui::DeviceDataManager::GetInstance()->keyboard_devices()) { 54 ui::DeviceDataManager::GetInstance()->keyboard_devices()) {
56 if (keyboard.type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) 55 if (keyboard.type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)
57 return true; 56 return true;
58 } 57 }
59 58
60 return false; 59 return false;
61 } 60 }
62 } // namespace 61 } // namespace
63 62
64 namespace chromeos { 63 namespace chromeos {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 180
182 void KeyboardHandler::UpdateCapsLockOptions() const { 181 void KeyboardHandler::UpdateCapsLockOptions() const {
183 const base::FundamentalValue show_caps_lock_options(HasExternalKeyboard()); 182 const base::FundamentalValue show_caps_lock_options(HasExternalKeyboard());
184 web_ui()->CallJavascriptFunction( 183 web_ui()->CallJavascriptFunction(
185 "options.KeyboardOverlay.showCapsLockOptions", 184 "options.KeyboardOverlay.showCapsLockOptions",
186 show_caps_lock_options); 185 show_caps_lock_options);
187 } 186 }
188 187
189 } // namespace options 188 } // namespace options
190 } // namespace chromeos 189 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/events/event_rewriter.cc ('k') | chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698