| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/keyboard/keyboard_util.h" | 5 #include "ui/keyboard/keyboard_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "media/audio/audio_manager.h" | |
| 15 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
| 16 #include "ui/aura/window_tree_host.h" | 15 #include "ui/aura/window_tree_host.h" |
| 17 #include "ui/base/ime/input_method.h" | 16 #include "ui/base/ime/input_method.h" |
| 18 #include "ui/base/ime/text_input_client.h" | 17 #include "ui/base/ime/text_input_client.h" |
| 19 #include "ui/events/event_processor.h" | 18 #include "ui/events/event_processor.h" |
| 20 #include "ui/events/event_utils.h" | 19 #include "ui/events/event_utils.h" |
| 21 #include "ui/events/keycodes/dom/dom_code.h" | 20 #include "ui/events/keycodes/dom/dom_code.h" |
| 22 #include "ui/events/keycodes/dom/dom_key.h" | 21 #include "ui/events/keycodes/dom/dom_key.h" |
| 23 #include "ui/events/keycodes/dom/keycode_converter.h" | 22 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 24 #include "ui/events/keycodes/keyboard_code_conversion.h" | 23 #include "ui/events/keycodes/keyboard_code_conversion.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 190 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 192 switches::kDisableGestureEditing); | 191 switches::kDisableGestureEditing); |
| 193 } | 192 } |
| 194 | 193 |
| 195 bool IsSmartDeployEnabled() { | 194 bool IsSmartDeployEnabled() { |
| 196 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 195 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 197 switches::kDisableSmartVirtualKeyboard); | 196 switches::kDisableSmartVirtualKeyboard); |
| 198 } | 197 } |
| 199 | 198 |
| 200 bool IsVoiceInputEnabled() { | 199 bool IsVoiceInputEnabled() { |
| 201 return media::AudioManager::Get()->HasAudioInputDevices() && | 200 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 202 !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 203 switches::kDisableVoiceInput); | 201 switches::kDisableVoiceInput); |
| 204 } | 202 } |
| 205 | 203 |
| 206 bool InsertText(const base::string16& text) { | 204 bool InsertText(const base::string16& text) { |
| 207 keyboard::KeyboardController* controller = KeyboardController::GetInstance(); | 205 keyboard::KeyboardController* controller = KeyboardController::GetInstance(); |
| 208 if (!controller) | 206 if (!controller) |
| 209 return false; | 207 return false; |
| 210 | 208 |
| 211 ui::InputMethod* input_method = controller->ui()->GetInputMethod(); | 209 ui::InputMethod* input_method = controller->ui()->GetInputMethod(); |
| 212 if (!input_method) | 210 if (!input_method) |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 } | 374 } |
| 377 | 375 |
| 378 void LogKeyboardControlEvent(KeyboardControlEvent event) { | 376 void LogKeyboardControlEvent(KeyboardControlEvent event) { |
| 379 UMA_HISTOGRAM_ENUMERATION( | 377 UMA_HISTOGRAM_ENUMERATION( |
| 380 "VirtualKeyboard.KeyboardControlEvent", | 378 "VirtualKeyboard.KeyboardControlEvent", |
| 381 event, | 379 event, |
| 382 keyboard::KEYBOARD_CONTROL_MAX); | 380 keyboard::KEYBOARD_CONTROL_MAX); |
| 383 } | 381 } |
| 384 | 382 |
| 385 } // namespace keyboard | 383 } // namespace keyboard |
| OLD | NEW |