| 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/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 void SetKeyboardOverscrollOverride(KeyboardOverscrolOverride override) { | 159 void SetKeyboardOverscrollOverride(KeyboardOverscrolOverride override) { |
| 160 g_keyboard_overscroll_override = override; | 160 g_keyboard_overscroll_override = override; |
| 161 } | 161 } |
| 162 | 162 |
| 163 void SetKeyboardShowOverride(KeyboardShowOverride override) { | 163 void SetKeyboardShowOverride(KeyboardShowOverride override) { |
| 164 g_keyboard_show_override = override; | 164 g_keyboard_show_override = override; |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool IsInputViewEnabled() { | 167 bool IsInputViewEnabled() { |
| 168 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 168 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 169 switches::kEnableInputView)) | 169 switches::kDisableInputView); |
| 170 return true; | |
| 171 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 172 switches::kDisableInputView)) | |
| 173 return false; | |
| 174 // Default value if no command line flags specified. | |
| 175 return true; | |
| 176 } | 170 } |
| 177 | 171 |
| 178 bool IsExperimentalInputViewEnabled() { | 172 bool IsExperimentalInputViewEnabled() { |
| 179 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 173 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 180 switches::kEnableExperimentalInputViewFeatures); | 174 switches::kEnableExperimentalInputViewFeatures); |
| 181 } | 175 } |
| 182 | 176 |
| 183 bool IsFloatingVirtualKeyboardEnabled() { | 177 bool IsFloatingVirtualKeyboardEnabled() { |
| 184 std::string floating_virtual_keyboard_switch = | 178 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 185 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 179 switches::kEnableFloatingVirtualKeyboard); |
| 186 switches::kFloatingVirtualKeyboard); | |
| 187 return floating_virtual_keyboard_switch == | |
| 188 switches::kFloatingVirtualKeyboardEnabled; | |
| 189 } | 180 } |
| 190 | 181 |
| 191 bool IsGestureTypingEnabled() { | 182 bool IsGestureTypingEnabled() { |
| 192 return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 183 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 193 switches::kGestureTyping) != switches::kGestureTypingDisabled; | 184 switches::kDisableGestureTyping); |
| 194 } | 185 } |
| 195 | 186 |
| 196 bool IsGestureEditingEnabled() { | 187 bool IsGestureEditingEnabled() { |
| 197 std::string keyboard_switch = | 188 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 198 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 189 switches::kDisableGestureEditing); |
| 199 switches::kGestureEditing); | |
| 200 return keyboard_switch != switches::kGestureEditingDisabled; | |
| 201 } | 190 } |
| 202 | 191 |
| 203 bool IsSmartDeployEnabled() { | 192 bool IsSmartDeployEnabled() { |
| 204 std::string keyboard_switch = | 193 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 205 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 194 switches::kDisableSmartVirtualKeyboard); |
| 206 switches::kSmartVirtualKeyboard); | |
| 207 return keyboard_switch != switches::kSmartVirtualKeyboardDisabled; | |
| 208 } | 195 } |
| 209 | 196 |
| 210 bool IsVoiceInputEnabled() { | 197 bool IsVoiceInputEnabled() { |
| 211 return media::AudioManager::Get()->HasAudioInputDevices() && | 198 return media::AudioManager::Get()->HasAudioInputDevices() && |
| 212 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 199 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 213 switches::kDisableVoiceInput); | 200 switches::kDisableVoiceInput); |
| 214 } | 201 } |
| 215 | 202 |
| 216 bool InsertText(const base::string16& text) { | 203 bool InsertText(const base::string16& text) { |
| 217 keyboard::KeyboardController* controller = KeyboardController::GetInstance(); | 204 keyboard::KeyboardController* controller = KeyboardController::GetInstance(); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 } | 373 } |
| 387 | 374 |
| 388 void LogKeyboardControlEvent(KeyboardControlEvent event) { | 375 void LogKeyboardControlEvent(KeyboardControlEvent event) { |
| 389 UMA_HISTOGRAM_ENUMERATION( | 376 UMA_HISTOGRAM_ENUMERATION( |
| 390 "VirtualKeyboard.KeyboardControlEvent", | 377 "VirtualKeyboard.KeyboardControlEvent", |
| 391 event, | 378 event, |
| 392 keyboard::KEYBOARD_CONTROL_MAX); | 379 keyboard::KEYBOARD_CONTROL_MAX); |
| 393 } | 380 } |
| 394 | 381 |
| 395 } // namespace keyboard | 382 } // namespace keyboard |
| OLD | NEW |