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" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 449 |
450 void SpeechInputExtensionManager::DispatchEventToExtension( | 450 void SpeechInputExtensionManager::DispatchEventToExtension( |
451 const std::string& extension_id, const std::string& event, | 451 const std::string& extension_id, const std::string& event, |
452 scoped_ptr<ListValue> event_args) { | 452 scoped_ptr<ListValue> event_args) { |
453 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 453 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
454 | 454 |
455 base::AutoLock auto_lock(state_lock_); | 455 base::AutoLock auto_lock(state_lock_); |
456 if (state_ == kShutdown) | 456 if (state_ == kShutdown) |
457 return; | 457 return; |
458 | 458 |
459 if (profile_ && profile_->GetExtensionEventRouter()) { | 459 if (profile_ && extensions::ExtensionSystem::Get(profile_)->event_router()) { |
460 profile_->GetExtensionEventRouter()->DispatchEventToExtension( | 460 extensions::ExtensionSystem::Get(profile_)->event_router()-> |
461 extension_id, event, event_args.Pass(), profile_, GURL()); | 461 DispatchEventToExtension(extension_id, event, event_args.Pass(), |
| 462 profile_, GURL()); |
462 } | 463 } |
463 } | 464 } |
464 | 465 |
465 void SpeechInputExtensionManager::DispatchError( | 466 void SpeechInputExtensionManager::DispatchError( |
466 const std::string& error, bool dispatch_event) { | 467 const std::string& error, bool dispatch_event) { |
467 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 468 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
468 | 469 |
469 std::string extension_id; | 470 std::string extension_id; |
470 { | 471 { |
471 base::AutoLock auto_lock(state_lock_); | 472 base::AutoLock auto_lock(state_lock_); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 content::NotificationService::current()->Notify( | 750 content::NotificationService::current()->Notify( |
750 chrome::NOTIFICATION_EXTENSION_SPEECH_INPUT_RECORDING_STOPPED, | 751 chrome::NOTIFICATION_EXTENSION_SPEECH_INPUT_RECORDING_STOPPED, |
751 // Guarded by the state_ == kShutdown check. | 752 // Guarded by the state_ == kShutdown check. |
752 content::Source<Profile>(profile_), | 753 content::Source<Profile>(profile_), |
753 content::Details<std::string>(&extension_id)); | 754 content::Details<std::string>(&extension_id)); |
754 } | 755 } |
755 | 756 |
756 void SpeechInputExtensionManager::OnAudioLevelsChange(int session_id, | 757 void SpeechInputExtensionManager::OnAudioLevelsChange(int session_id, |
757 float volume, | 758 float volume, |
758 float noise_volume) {} | 759 float noise_volume) {} |
OLD | NEW |