OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_extension_manager.h" | 5 #include "chrome/browser/speech/speech_input_extension_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/extensions/extension_event_router.h" | 11 #include "chrome/browser/extensions/extension_event_router.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/profiles/profile_dependency_manager.h" | 15 #include "chrome/browser/profiles/profile_dependency_manager.h" |
16 #include "chrome/browser/profiles/profile_keyed_service.h" | 16 #include "chrome/browser/profiles/profile_keyed_service.h" |
17 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 17 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
18 #include "chrome/browser/speech/speech_input_extension_notification.h" | 18 #include "chrome/browser/speech/speech_input_extension_notification.h" |
19 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
20 #include "chrome/common/extensions/extension.h" | 20 #include "chrome/common/extensions/extension.h" |
21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 22 #include "content/browser/speech/speech_recognizer.h" |
22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/notification_registrar.h" | 24 #include "content/public/browser/notification_registrar.h" |
24 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/resource_context.h" | 26 #include "content/public/browser/resource_context.h" |
26 #include "content/public/common/speech_input_result.h" | 27 #include "content/public/common/speech_input_result.h" |
27 | 28 |
28 using content::BrowserThread; | 29 using content::BrowserThread; |
29 using speech_input::SpeechRecognizer; | 30 using speech_input::SpeechRecognizer; |
30 | 31 |
31 namespace { | 32 namespace { |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 } | 591 } |
591 | 592 |
592 void SpeechInputExtensionManager::IsRecordingOnUIThread( | 593 void SpeechInputExtensionManager::IsRecordingOnUIThread( |
593 const IsRecordingCallback& callback, | 594 const IsRecordingCallback& callback, |
594 bool result) { | 595 bool result) { |
595 BrowserThread::CurrentlyOn(BrowserThread::UI); | 596 BrowserThread::CurrentlyOn(BrowserThread::UI); |
596 callback.Run(result); | 597 callback.Run(result); |
597 } | 598 } |
598 | 599 |
599 void SpeechInputExtensionManager::StartRecording( | 600 void SpeechInputExtensionManager::StartRecording( |
600 speech_input::SpeechRecognizerDelegate* delegate, | 601 content::SpeechRecognizerDelegate* delegate, |
601 net::URLRequestContextGetter* context_getter, | 602 net::URLRequestContextGetter* context_getter, |
602 content::ResourceContext* resource_context, | 603 content::ResourceContext* resource_context, |
603 int caller_id, | 604 int caller_id, |
604 const std::string& language, | 605 const std::string& language, |
605 const std::string& grammar, | 606 const std::string& grammar, |
606 bool filter_profanities) { | 607 bool filter_profanities) { |
607 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 608 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
608 DCHECK(resource_context); | 609 DCHECK(resource_context); |
609 DCHECK(!recognizer_); | 610 DCHECK(!recognizer_); |
610 recognizer_ = new SpeechRecognizer(delegate, caller_id, language, grammar, | 611 recognizer_ = new SpeechRecognizer(delegate, caller_id, language, grammar, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 base::Bind(&SpeechInputExtensionManager::SetInputVolumeOnUIThread, | 716 base::Bind(&SpeechInputExtensionManager::SetInputVolumeOnUIThread, |
716 this, volume)); | 717 this, volume)); |
717 } | 718 } |
718 | 719 |
719 void SpeechInputExtensionManager::SetInputVolumeOnUIThread( | 720 void SpeechInputExtensionManager::SetInputVolumeOnUIThread( |
720 float volume) { | 721 float volume) { |
721 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 722 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
722 DCHECK(notification_.get()); | 723 DCHECK(notification_.get()); |
723 notification_->SetVUMeterVolume(volume); | 724 notification_->SetVUMeterVolume(volume); |
724 } | 725 } |
OLD | NEW |