OLD | NEW |
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/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/lock.h" | |
13 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "base/synchronization/lock.h" |
14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/browser_thread.h" | 16 #include "chrome/browser/browser_thread.h" |
17 #include "chrome/browser/platform_util.h" | 17 #include "chrome/browser/platform_util.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/browser/speech/speech_input_bubble_controller.h" | 19 #include "chrome/browser/speech/speech_input_bubble_controller.h" |
20 #include "chrome/browser/speech/speech_recognizer.h" | 20 #include "chrome/browser/speech/speech_recognizer.h" |
21 #include "chrome/browser/tab_contents/infobar_delegate.h" | 21 #include "chrome/browser/tab_contents/infobar_delegate.h" |
22 #include "chrome/browser/tab_contents/tab_util.h" | 22 #include "chrome/browser/tab_contents/tab_util.h" |
23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
(...skipping 29 matching lines...) Expand all Loading... |
53 if (g_browser_process->local_state()->GetBoolean( | 53 if (g_browser_process->local_state()->GetBoolean( |
54 prefs::kMetricsReportingEnabled)) { | 54 prefs::kMetricsReportingEnabled)) { |
55 // Access potentially slow OS calls from the FILE thread. | 55 // Access potentially slow OS calls from the FILE thread. |
56 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 56 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
57 NewRunnableMethod(this, &HardwareInfo::GetHardwareInfo)); | 57 NewRunnableMethod(this, &HardwareInfo::GetHardwareInfo)); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 void GetHardwareInfo() { | 61 void GetHardwareInfo() { |
62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
63 AutoLock lock(lock_); | 63 base::AutoLock lock(lock_); |
64 value_ = UTF16ToUTF8( | 64 value_ = UTF16ToUTF8( |
65 installer::WMIComputerSystem::GetModel() + L"|" + | 65 installer::WMIComputerSystem::GetModel() + L"|" + |
66 AudioManager::GetAudioManager()->GetAudioInputDeviceModel()); | 66 AudioManager::GetAudioManager()->GetAudioInputDeviceModel()); |
67 } | 67 } |
68 | 68 |
69 std::string value() { | 69 std::string value() { |
70 AutoLock lock(lock_); | 70 base::AutoLock lock(lock_); |
71 return value_; | 71 return value_; |
72 } | 72 } |
73 | 73 |
74 private: | 74 private: |
75 Lock lock_; | 75 base::Lock lock_; |
76 std::string value_; | 76 std::string value_; |
77 | 77 |
78 #else // defined(OS_WIN) | 78 #else // defined(OS_WIN) |
79 void Refresh() {} | 79 void Refresh() {} |
80 std::string value() { return std::string(); } | 80 std::string value() { return std::string(); } |
81 #endif // defined(OS_WIN) | 81 #endif // defined(OS_WIN) |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(HardwareInfo); | 83 DISALLOW_COPY_AND_ASSIGN(HardwareInfo); |
84 }; | 84 }; |
85 | 85 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 // to the user, abort it since user has switched focus. Otherwise | 333 // 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 | 334 // recognition has started and keep that going so user can start speaking to |
335 // another element while this gets the results in parallel. | 335 // another element while this gets the results in parallel. |
336 if (recording_caller_id_ == caller_id || !requests_[caller_id].is_active) { | 336 if (recording_caller_id_ == caller_id || !requests_[caller_id].is_active) { |
337 CancelRecognitionAndInformDelegate(caller_id); | 337 CancelRecognitionAndInformDelegate(caller_id); |
338 } | 338 } |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 } // namespace speech_input | 342 } // namespace speech_input |
OLD | NEW |