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

Side by Side Diff: ui/keyboard/keyboard_util.cc

Issue 1319523003: add audio (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « ui/keyboard/keyboard.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "grit/keyboard_resources.h" 15 #include "grit/keyboard_resources.h"
16 #include "grit/keyboard_resources_map.h" 16 #include "grit/keyboard_resources_map.h"
17 #include "media/audio/audio_manager.h"
18 #include "ui/aura/client/aura_constants.h"
17 #include "ui/aura/window_tree_host.h" 19 #include "ui/aura/window_tree_host.h"
18 #include "ui/base/ime/input_method.h" 20 #include "ui/base/ime/input_method.h"
19 #include "ui/base/ime/text_input_client.h" 21 #include "ui/base/ime/text_input_client.h"
20 #include "ui/events/event_processor.h" 22 #include "ui/events/event_processor.h"
21 #include "ui/events/event_utils.h" 23 #include "ui/events/event_utils.h"
22 #include "ui/events/keycodes/dom/dom_code.h" 24 #include "ui/events/keycodes/dom/dom_code.h"
23 #include "ui/events/keycodes/dom/dom_key.h" 25 #include "ui/events/keycodes/dom/dom_key.h"
24 #include "ui/events/keycodes/dom/keycode_converter.h" 26 #include "ui/events/keycodes/dom/keycode_converter.h"
25 #include "ui/events/keycodes/keyboard_code_conversion.h" 27 #include "ui/events/keycodes/keyboard_code_conversion.h"
26 #include "ui/keyboard/keyboard_controller.h" 28 #include "ui/keyboard/keyboard_controller.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 179 }
178 180
179 bool IsSmartDeployEnabled() { 181 bool IsSmartDeployEnabled() {
180 std::string keyboard_switch = 182 std::string keyboard_switch =
181 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 183 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
182 switches::kSmartVirtualKeyboard); 184 switches::kSmartVirtualKeyboard);
183 return keyboard_switch != switches::kSmartVirtualKeyboardDisabled; 185 return keyboard_switch != switches::kSmartVirtualKeyboardDisabled;
184 } 186 }
185 187
186 bool IsVoiceInputEnabled() { 188 bool IsVoiceInputEnabled() {
187 return !base::CommandLine::ForCurrentProcess()->HasSwitch( 189 return media::AudioManager::Get()->HasAudioInputDevices() &&
190 !base::CommandLine::ForCurrentProcess()->HasSwitch(
188 switches::kDisableVoiceInput); 191 switches::kDisableVoiceInput);
189 } 192 }
190 193
191 bool InsertText(const base::string16& text) { 194 bool InsertText(const base::string16& text) {
192 keyboard::KeyboardController* controller = KeyboardController::GetInstance(); 195 keyboard::KeyboardController* controller = KeyboardController::GetInstance();
193 if (!controller) 196 if (!controller)
194 return false; 197 return false;
195 198
196 ui::InputMethod* input_method = controller->proxy()->GetInputMethod(); 199 ui::InputMethod* input_method = controller->proxy()->GetInputMethod();
197 if (!input_method) 200 if (!input_method)
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 456 }
454 457
455 void LogKeyboardControlEvent(KeyboardControlEvent event) { 458 void LogKeyboardControlEvent(KeyboardControlEvent event) {
456 UMA_HISTOGRAM_ENUMERATION( 459 UMA_HISTOGRAM_ENUMERATION(
457 "VirtualKeyboard.KeyboardControlEvent", 460 "VirtualKeyboard.KeyboardControlEvent",
458 event, 461 event,
459 keyboard::KEYBOARD_CONTROL_MAX); 462 keyboard::KEYBOARD_CONTROL_MAX);
460 } 463 }
461 464
462 } // namespace keyboard 465 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/keyboard/keyboard.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698