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

Side by Side Diff: chrome/browser/speech/speech_input_manager.cc

Issue 6353005: Revert r70896 to move speech input back behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/speech/speech_input_manager.h ('k') | chrome/common/chrome_switches.h » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/speech/speech_input_manager.h" 5 #include "chrome/browser/speech/speech_input_manager.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
11 #include "base/command_line.h"
11 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
12 #include "base/lock.h" 13 #include "base/lock.h"
13 #include "base/ref_counted.h" 14 #include "base/ref_counted.h"
14 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
15 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/browser_thread.h" 17 #include "chrome/browser/browser_thread.h"
17 #include "chrome/browser/platform_util.h" 18 #include "chrome/browser/platform_util.h"
18 #include "chrome/browser/prefs/pref_service.h" 19 #include "chrome/browser/prefs/pref_service.h"
19 #include "chrome/browser/speech/speech_input_bubble_controller.h" 20 #include "chrome/browser/speech/speech_input_bubble_controller.h"
20 #include "chrome/browser/speech/speech_recognizer.h" 21 #include "chrome/browser/speech/speech_recognizer.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 scoped_refptr<HardwareInfo> hardware_info_; 146 scoped_refptr<HardwareInfo> hardware_info_;
146 }; 147 };
147 148
148 static ::base::LazyInstance<SpeechInputManagerImpl> g_speech_input_manager_impl( 149 static ::base::LazyInstance<SpeechInputManagerImpl> g_speech_input_manager_impl(
149 base::LINKER_INITIALIZED); 150 base::LINKER_INITIALIZED);
150 151
151 SpeechInputManager* SpeechInputManager::Get() { 152 SpeechInputManager* SpeechInputManager::Get() {
152 return g_speech_input_manager_impl.Pointer(); 153 return g_speech_input_manager_impl.Pointer();
153 } 154 }
154 155
156 bool SpeechInputManager::IsFeatureEnabled() {
157 bool enabled = true;
158 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
159
160 if (command_line.HasSwitch(switches::kDisableSpeechInput)) {
161 enabled = false;
162 #if defined(GOOGLE_CHROME_BUILD)
163 } else if (!command_line.HasSwitch(switches::kEnableSpeechInput)) {
164 // We need to evaluate whether IO is OK here. http://crbug.com/63335.
165 base::ThreadRestrictions::ScopedAllowIO allow_io;
166 // Official Chrome builds have speech input enabled by default only in the
167 // dev channel.
168 std::string channel = platform_util::GetVersionStringModifier();
169 enabled = (channel == "dev");
170 #endif
171 }
172
173 return enabled;
174 }
175
155 SpeechInputManagerImpl::SpeechInputManagerImpl() 176 SpeechInputManagerImpl::SpeechInputManagerImpl()
156 : recording_caller_id_(0), 177 : recording_caller_id_(0),
157 bubble_controller_(new SpeechInputBubbleController( 178 bubble_controller_(new SpeechInputBubbleController(
158 ALLOW_THIS_IN_INITIALIZER_LIST(this))) { 179 ALLOW_THIS_IN_INITIALIZER_LIST(this))) {
159 } 180 }
160 181
161 SpeechInputManagerImpl::~SpeechInputManagerImpl() { 182 SpeechInputManagerImpl::~SpeechInputManagerImpl() {
162 while (requests_.begin() != requests_.end()) 183 while (requests_.begin() != requests_.end())
163 CancelRecognition(requests_.begin()->first); 184 CancelRecognition(requests_.begin()->first);
164 } 185 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // to the user, abort it since user has switched focus. Otherwise 354 // to the user, abort it since user has switched focus. Otherwise
334 // recognition has started and keep that going so user can start speaking to 355 // recognition has started and keep that going so user can start speaking to
335 // another element while this gets the results in parallel. 356 // another element while this gets the results in parallel.
336 if (recording_caller_id_ == caller_id || !requests_[caller_id].is_active) { 357 if (recording_caller_id_ == caller_id || !requests_[caller_id].is_active) {
337 CancelRecognitionAndInformDelegate(caller_id); 358 CancelRecognitionAndInformDelegate(caller_id);
338 } 359 }
339 } 360 }
340 } 361 }
341 362
342 } // namespace speech_input 363 } // namespace speech_input
OLDNEW
« no previous file with comments | « chrome/browser/speech/speech_input_manager.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698