diff options
Diffstat (limited to 'chrome/browser/extensions/speech_input')
4 files changed, 37 insertions, 34 deletions
diff --git a/chrome/browser/extensions/speech_input/extension_speech_input_api.cc b/chrome/browser/extensions/speech_input/extension_speech_input_api.cc index f18f911..33c5737 100644 --- a/chrome/browser/extensions/speech_input/extension_speech_input_api.cc +++ b/chrome/browser/extensions/speech_input/extension_speech_input_api.cc @@ -25,7 +25,7 @@ SpeechInputAsyncFunction::SpeechInputAsyncFunction( expecting_transition_(false), failed_(false) { registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_SPEECH_INPUT_FAILED, - Source<Profile>(profile())); + content::Source<Profile>(profile())); } SpeechInputAsyncFunction::~SpeechInputAsyncFunction() { @@ -49,7 +49,7 @@ void SpeechInputAsyncFunction::Run() { // Register before RunImpl to ensure it's received if generated. if (state_before_call == start_state_) { registrar_.Add(this, transition_notification_, - Source<Profile>(profile())); + content::Source<Profile>(profile())); AddRef(); // Balanced in Observe(). } @@ -76,14 +76,16 @@ void SpeechInputAsyncFunction::Run() { SendResponse(true); } -void SpeechInputAsyncFunction::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { - DCHECK_EQ(profile(), Source<Profile>(source).ptr()); +void SpeechInputAsyncFunction::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { + DCHECK_EQ(profile(), content::Source<Profile>(source).ptr()); if (type == chrome::NOTIFICATION_EXTENSION_SPEECH_INPUT_FAILED) { ExtensionSpeechInputManager::ExtensionError* error_details = - Details<ExtensionSpeechInputManager::ExtensionError>(details).ptr(); + content::Details<ExtensionSpeechInputManager::ExtensionError>( + details).ptr(); if (error_details->extension_id_ != extension_id()) return; @@ -91,7 +93,7 @@ void SpeechInputAsyncFunction::Observe(int type, failed_ = true; } else { DCHECK_EQ(type, transition_notification_); - if (*Details<std::string>(details).ptr() != extension_id()) + if (*content::Details<std::string>(details).ptr() != extension_id()) return; DCHECK(expecting_transition_); } diff --git a/chrome/browser/extensions/speech_input/extension_speech_input_api.h b/chrome/browser/extensions/speech_input/extension_speech_input_api.h index bf09bb6..fffbc1b 100644 --- a/chrome/browser/extensions/speech_input/extension_speech_input_api.h +++ b/chrome/browser/extensions/speech_input/extension_speech_input_api.h @@ -14,7 +14,7 @@ class ExtensionSpeechInputManager; // Handles asynchronous operations such as starting or stopping speech // recognition in the framework of the extension API state machine. class SpeechInputAsyncFunction : public AsyncExtensionFunction, - public NotificationObserver { + public content::NotificationObserver { protected: SpeechInputAsyncFunction(int start_state, int transition_state, int end_state, int transition_notification); @@ -24,10 +24,10 @@ class SpeechInputAsyncFunction : public AsyncExtensionFunction, virtual bool RunImpl() = 0; private: - // NotificationObserver. + // content::NotificationObserver. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; // To be defined on construction by derived classes. int start_state_; @@ -35,7 +35,7 @@ class SpeechInputAsyncFunction : public AsyncExtensionFunction, int end_state_; int transition_notification_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; bool expecting_transition_; bool failed_; }; diff --git a/chrome/browser/extensions/speech_input/extension_speech_input_manager.cc b/chrome/browser/extensions/speech_input/extension_speech_input_manager.cc index a26bde87..b67f276 100644 --- a/chrome/browser/extensions/speech_input/extension_speech_input_manager.cc +++ b/chrome/browser/extensions/speech_input/extension_speech_input_manager.cc @@ -118,7 +118,7 @@ ExtensionSpeechInputManager::ExtensionSpeechInputManager(Profile* profile) state_(kIdle), speech_interface_(NULL) { registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, - Source<Profile>(profile_)); + content::Source<Profile>(profile_)); } ExtensionSpeechInputManager::~ExtensionSpeechInputManager() { @@ -138,12 +138,14 @@ void ExtensionSpeechInputManager::InitializeFactory() { } void ExtensionSpeechInputManager::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { - if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) - ExtensionUnloaded(Details<UnloadedExtensionInfo>(details)->extension->id()); - else + const content::NotificationSource& source, + const content::NotificationDetails& details) { + if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { + ExtensionUnloaded( + content::Details<UnloadedExtensionInfo>(details)->extension->id()); + } else { NOTREACHED(); + } } void ExtensionSpeechInputManager::ShutdownOnUIThread() { @@ -272,8 +274,8 @@ void ExtensionSpeechInputManager::DidStartReceivingAudioOnUIThread() { VLOG(1) << "Sending start notification"; NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_SPEECH_INPUT_RECORDING_STARTED, - Source<Profile>(profile_), - Details<std::string>(&extension_id_in_use_)); + content::Source<Profile>(profile_), + content::Details<std::string>(&extension_id_in_use_)); } void ExtensionSpeechInputManager::OnRecognizerError( @@ -405,8 +407,8 @@ void ExtensionSpeechInputManager::DispatchError( ExtensionError details(extension_id, error); NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_SPEECH_INPUT_FAILED, - Source<Profile>(profile_), - Details<ExtensionError>(&details)); + content::Source<Profile>(profile_), + content::Details<ExtensionError>(&details)); } // Used for errors that are also reported via the onError event. @@ -604,6 +606,7 @@ void ExtensionSpeechInputManager::StopSucceededOnUIThread() { NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_SPEECH_INPUT_RECORDING_STOPPED, - Source<Profile>(profile_), // Guarded by the state_ == kShutdown check. - Details<std::string>(&extension_id)); + // Guarded by the state_ == kShutdown check. + content::Source<Profile>(profile_), + content::Details<std::string>(&extension_id)); } diff --git a/chrome/browser/extensions/speech_input/extension_speech_input_manager.h b/chrome/browser/extensions/speech_input/extension_speech_input_manager.h index c7b196b..1bda889 100644 --- a/chrome/browser/extensions/speech_input/extension_speech_input_manager.h +++ b/chrome/browser/extensions/speech_input/extension_speech_input_manager.h @@ -9,14 +9,12 @@ #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" #include "content/browser/speech/speech_recognizer.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" #include "content/common/speech_input_result.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" #include <string> class Extension; -class NotificationDetails; -class NotificationSource; class Profile; namespace net { @@ -56,7 +54,7 @@ class ExtensionSpeechInterface { class ExtensionSpeechInputManager : public base::RefCountedThreadSafe<ExtensionSpeechInputManager>, public speech_input::SpeechRecognizerDelegate, - public NotificationObserver, + public content::NotificationObserver, private ExtensionSpeechInterface { public: enum State { @@ -105,10 +103,10 @@ class ExtensionSpeechInputManager // Called by internal ProfileKeyedService class. void ShutdownOnUIThread(); - // Methods from NotificationObserver. + // Methods from content::NotificationObserver. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; // Methods from SpeechRecognizerDelegate. virtual void SetRecognitionResult( @@ -188,7 +186,7 @@ class ExtensionSpeechInputManager std::string extension_id_in_use_; // Used in the UI thread. - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; ExtensionSpeechInterface* speech_interface_; }; |