summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/nibs/SpeechRecognitionBubble.xib (renamed from chrome/app/nibs/SpeechInputBubble.xib)6
-rw-r--r--chrome/browser/chrome_content_browser_client.cc8
-rw-r--r--chrome/browser/chrome_content_browser_client.h4
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.cc6
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.h3
-rw-r--r--chrome/browser/profiles/profile.cc4
-rw-r--r--chrome/browser/profiles/profile.h2
-rw-r--r--chrome/browser/profiles/profile_impl.cc22
-rw-r--r--chrome/browser/profiles/profile_impl.h8
-rw-r--r--chrome/browser/speech/chrome_speech_input_manager_delegate.h60
-rw-r--r--chrome/browser/speech/chrome_speech_input_preferences.h31
-rw-r--r--chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc (renamed from chrome/browser/speech/chrome_speech_input_manager_delegate.cc)73
-rw-r--r--chrome/browser/speech/chrome_speech_recognition_manager_delegate.h60
-rw-r--r--chrome/browser/speech/chrome_speech_recognition_preferences.cc (renamed from chrome/browser/speech/chrome_speech_input_preferences.cc)14
-rw-r--r--chrome/browser/speech/chrome_speech_recognition_preferences.h32
-rw-r--r--chrome/browser/speech/speech_input_extension_apitest.cc23
-rw-r--r--chrome/browser/speech/speech_input_extension_manager.cc37
-rw-r--r--chrome/browser/speech/speech_input_extension_manager.h10
-rw-r--r--chrome/browser/speech/speech_recognition_bubble.cc (renamed from chrome/browser/speech/speech_input_bubble.cc)60
-rw-r--r--chrome/browser/speech/speech_recognition_bubble.h (renamed from chrome/browser/speech/speech_input_bubble.h)56
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_browsertest.cc (renamed from chrome/browser/speech/speech_input_bubble_browsertest.cc)27
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_controller.cc (renamed from chrome/browser/speech/speech_input_bubble_controller.cc)86
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_controller.h (renamed from chrome/browser/speech/speech_input_bubble_controller.h)54
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc (renamed from chrome/browser/speech/speech_input_bubble_controller_unittest.cc)97
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_gtk.cc (renamed from chrome/browser/speech/speech_input_bubble_gtk.cc)64
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_mac.mm (renamed from chrome/browser/speech/speech_input_bubble_mac.mm)41
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_views.cc (renamed from chrome/browser/speech/speech_input_bubble_views.cc)116
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc10
-rw-r--r--chrome/browser/ui/cocoa/speech_recognition_window_controller.h (renamed from chrome/browser/ui/cocoa/speech_input_window_controller.h)30
-rw-r--r--chrome/browser/ui/cocoa/speech_recognition_window_controller.mm (renamed from chrome/browser/ui/cocoa/speech_input_window_controller.mm)33
-rw-r--r--chrome/chrome_browser.gypi32
-rw-r--r--chrome/chrome_dll.gypi2
-rw-r--r--chrome/chrome_tests.gypi6
-rw-r--r--chrome/common/pref_names.cc2
-rw-r--r--chrome/common/pref_names.h2
-rw-r--r--chrome/test/base/testing_profile.cc12
-rw-r--r--chrome/test/base/testing_profile.h8
37 files changed, 586 insertions, 555 deletions
diff --git a/chrome/app/nibs/SpeechInputBubble.xib b/chrome/app/nibs/SpeechRecognitionBubble.xib
index 8999b4f..8cc0dc2 100644
--- a/chrome/app/nibs/SpeechInputBubble.xib
+++ b/chrome/app/nibs/SpeechRecognitionBubble.xib
@@ -30,7 +30,7 @@
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1021">
- <string key="NSClassName">SpeechInputWindowController</string>
+ <string key="NSClassName">SpeechRecognitionWindowController</string>
</object>
<object class="NSCustomObject" id="1014">
<string key="NSClassName">FirstResponder</string>
@@ -674,7 +674,7 @@
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">SpeechInputWindowController</string>
+ <string key="className">SpeechRecognitionWindowController</string>
<string key="superclassName">BaseBubbleController</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -716,7 +716,7 @@
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">SpeechInputWindowController</string>
+ <string key="className">SpeechRecognitionWindowController</string>
<string key="superclassName">BaseBubbleController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">myOutlet1</string>
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 6697d68..901f43e 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -53,7 +53,7 @@
#include "chrome/browser/renderer_host/chrome_render_view_host_observer.h"
#include "chrome/browser/renderer_host/plugin_info_message_filter.h"
#include "chrome/browser/search_engines/search_provider_install_state_message_filter.h"
-#include "chrome/browser/speech/chrome_speech_input_manager_delegate.h"
+#include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
#include "chrome/browser/spellchecker/spellcheck_message_filter.h"
#include "chrome/browser/ssl/ssl_add_cert_handler.h"
#include "chrome/browser/ssl/ssl_blocking_page.h"
@@ -1275,9 +1275,9 @@ void ChromeContentBrowserClient::ResourceDispatcherHostCreated() {
return g_browser_process->ResourceDispatcherHostCreated();
}
-content::SpeechInputManagerDelegate*
- ChromeContentBrowserClient::GetSpeechInputManagerDelegate() {
- return new speech_input::ChromeSpeechInputManagerDelegate();
+content::SpeechRecognitionManagerDelegate*
+ ChromeContentBrowserClient::GetSpeechRecognitionManagerDelegate() {
+ return new speech::ChromeSpeechRecognitionManagerDelegate();
}
ui::Clipboard* ChromeContentBrowserClient::GetClipboard() {
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 12553d3..a38b6bb 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -144,8 +144,8 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
virtual std::string GetWorkerProcessTitle(
const GURL& url, content::ResourceContext* context) OVERRIDE;
virtual void ResourceDispatcherHostCreated() OVERRIDE;
- virtual content::SpeechInputManagerDelegate*
- GetSpeechInputManagerDelegate() OVERRIDE;
+ virtual content::SpeechRecognitionManagerDelegate*
+ GetSpeechRecognitionManagerDelegate() OVERRIDE;
virtual ui::Clipboard* GetClipboard() OVERRIDE;
virtual net::NetLog* GetNetLog() OVERRIDE;
virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index 480eb1b..5323f90 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -362,9 +362,9 @@ content::GeolocationPermissionContext*
return profile_->GetGeolocationPermissionContext();
}
-content::SpeechInputPreferences*
- OffTheRecordProfileImpl::GetSpeechInputPreferences() {
- return profile_->GetSpeechInputPreferences();
+content::SpeechRecognitionPreferences*
+ OffTheRecordProfileImpl::GetSpeechRecognitionPreferences() {
+ return profile_->GetSpeechRecognitionPreferences();
}
UserStyleSheetWatcher* OffTheRecordProfileImpl::GetUserStyleSheetWatcher() {
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h
index 1a65d56..cd7a9a2 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.h
+++ b/chrome/browser/profiles/off_the_record_profile_impl.h
@@ -116,7 +116,8 @@ class OffTheRecordProfileImpl : public Profile,
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
virtual content::GeolocationPermissionContext*
GetGeolocationPermissionContext() OVERRIDE;
- virtual content::SpeechInputPreferences* GetSpeechInputPreferences() OVERRIDE;
+ virtual content::SpeechRecognitionPreferences*
+ GetSpeechRecognitionPreferences() OVERRIDE;
virtual bool DidLastSessionExitCleanly() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index fffeb89..eea0472 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -96,10 +96,10 @@ void Profile::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterBooleanPref(prefs::kSafeBrowsingReportingEnabled,
false,
PrefService::UNSYNCABLE_PREF);
- // TODO(erg): kSpeechInputFilterProfanities should also be moved to
+ // TODO(erg): kSpeechRecognitionFilterProfanities should also be moved to
// speech_input_extension_manager.cc, but is more involved because of
// BrowserContext/Profile confusion because of ChromeSpeechInputPreferences.
- prefs->RegisterBooleanPref(prefs::kSpeechInputFilterProfanities,
+ prefs->RegisterBooleanPref(prefs::kSpeechRecognitionFilterProfanities,
true,
PrefService::UNSYNCABLE_PREF);
prefs->RegisterBooleanPref(prefs::kDisableExtensions,
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h
index 7407853..845e27f 100644
--- a/chrome/browser/profiles/profile.h
+++ b/chrome/browser/profiles/profile.h
@@ -60,7 +60,7 @@ class Predictor;
}
namespace content {
-class SpeechInputPreferences;
+class SpeechRecognitionPreferences;
class WebUI;
}
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 9500473c..307344a 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -71,7 +71,7 @@
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/signin/token_service.h"
-#include "chrome/browser/speech/chrome_speech_input_preferences.h"
+#include "chrome/browser/speech/chrome_speech_recognition_preferences.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/transport_security_persister.h"
#include "chrome/browser/ui/browser_init.h"
@@ -283,7 +283,7 @@ ProfileImpl::ProfileImpl(const FilePath& path,
void ProfileImpl::DoFinalInit() {
PrefService* prefs = GetPrefs();
pref_change_registrar_.Init(prefs);
- pref_change_registrar_.Add(prefs::kSpeechInputFilterProfanities, this);
+ pref_change_registrar_.Add(prefs::kSpeechRecognitionFilterProfanities, this);
pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this);
pref_change_registrar_.Add(prefs::kGoogleServicesUsername, this);
pref_change_registrar_.Add(prefs::kDefaultZoomLevel, this);
@@ -891,12 +891,14 @@ content::GeolocationPermissionContext*
return geolocation_permission_context_.get();
}
-content::SpeechInputPreferences* ProfileImpl::GetSpeechInputPreferences() {
+content::SpeechRecognitionPreferences*
+ ProfileImpl::GetSpeechRecognitionPreferences() {
#if defined(ENABLE_INPUT_SPEECH)
- if (!speech_input_preferences_.get()) {
- speech_input_preferences_ = new ChromeSpeechInputPreferences(GetPrefs());
+ if (!speech_recognition_preferences_.get()) {
+ speech_recognition_preferences_ =
+ new ChromeSpeechRecognitionPreferences(GetPrefs());
}
- return speech_input_preferences_.get();
+ return speech_recognition_preferences_.get();
#else
return NULL;
#endif
@@ -1184,12 +1186,12 @@ void ProfileImpl::Observe(int type,
std::string* pref_name_in = content::Details<std::string>(details).ptr();
PrefService* prefs = content::Source<PrefService>(source).ptr();
DCHECK(pref_name_in && prefs);
- if (*pref_name_in == prefs::kSpeechInputFilterProfanities) {
- content::SpeechInputPreferences* speech_prefs =
- GetSpeechInputPreferences();
+ if (*pref_name_in == prefs::kSpeechRecognitionFilterProfanities) {
+ content::SpeechRecognitionPreferences* speech_prefs =
+ GetSpeechRecognitionPreferences();
if (speech_prefs) {
speech_prefs->SetFilterProfanities(prefs->GetBoolean(
- prefs::kSpeechInputFilterProfanities));
+ prefs::kSpeechRecognitionFilterProfanities));
}
} else if (*pref_name_in == prefs::kClearSiteDataOnExit) {
clear_local_state_on_exit_ =
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index a7b9b6f..816e112 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -39,7 +39,7 @@ class Preferences;
#endif
namespace content {
-class SpeechInputPreferences;
+class SpeechRecognitionPreferences;
}
// The default profile implementation.
@@ -60,7 +60,8 @@ class ProfileImpl : public Profile,
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
virtual content::GeolocationPermissionContext*
GetGeolocationPermissionContext() OVERRIDE;
- virtual content::SpeechInputPreferences* GetSpeechInputPreferences() OVERRIDE;
+ virtual content::SpeechRecognitionPreferences*
+ GetSpeechRecognitionPreferences() OVERRIDE;
virtual bool DidLastSessionExitCleanly() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
@@ -236,7 +237,8 @@ class ProfileImpl : public Profile,
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
scoped_refptr<content::GeolocationPermissionContext>
geolocation_permission_context_;
- scoped_refptr<content::SpeechInputPreferences> speech_input_preferences_;
+ scoped_refptr<content::SpeechRecognitionPreferences>
+ speech_recognition_preferences_;
scoped_refptr<UserStyleSheetWatcher> user_style_sheet_watcher_;
scoped_ptr<GAIAInfoUpdateService> gaia_info_update_service_;
scoped_refptr<HistoryService> history_service_;
diff --git a/chrome/browser/speech/chrome_speech_input_manager_delegate.h b/chrome/browser/speech/chrome_speech_input_manager_delegate.h
deleted file mode 100644
index d133a51..0000000
--- a/chrome/browser/speech/chrome_speech_input_manager_delegate.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_DELEGATE_H_
-#define CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_DELEGATE_H_
-
-#include "base/compiler_specific.h"
-#include "base/memory/ref_counted.h"
-#include "chrome/browser/speech/speech_input_bubble_controller.h"
-#include "content/public/browser/speech_input_manager_delegate.h"
-
-namespace speech_input {
-
-// This is Chrome's implementation of the SpeechInputManager interface. This
-// class is a singleton and accessed via the Get method.
-class ChromeSpeechInputManagerDelegate
- : NON_EXPORTED_BASE(public content::SpeechInputManagerDelegate),
- public SpeechInputBubbleControllerDelegate {
- public:
- ChromeSpeechInputManagerDelegate();
- virtual ~ChromeSpeechInputManagerDelegate();
-
- // SpeechInputBubbleControllerDelegate methods.
- virtual void InfoBubbleButtonClicked(
- int caller_id, SpeechInputBubble::Button button) OVERRIDE;
- virtual void InfoBubbleFocusChanged(int caller_id) OVERRIDE;
-
- protected:
- // SpeechInputManagerDelegate methods.
- virtual void GetRequestInfo(bool* can_report_metrics,
- std::string* request_info) OVERRIDE;
- virtual void ShowRecognitionRequested(int caller_id,
- int render_process_id,
- int render_view_id,
- const gfx::Rect& element_rect) OVERRIDE;
- virtual void ShowWarmUp(int caller_id) OVERRIDE;
- virtual void ShowRecognizing(int caller_id) OVERRIDE;
- virtual void ShowRecording(int caller_id) OVERRIDE;
- virtual void ShowInputVolume(int caller_id,
- float volume,
- float noise_volume) OVERRIDE;
- virtual void ShowMicError(int caller_id,
- MicError error) OVERRIDE;
- virtual void ShowRecognizerError(int caller_id,
- content::SpeechInputError error) OVERRIDE;
- virtual void DoClose(int caller_id) OVERRIDE;
-
- private:
- class OptionalRequestInfo;
-
- scoped_refptr<SpeechInputBubbleController> bubble_controller_;
- scoped_refptr<OptionalRequestInfo> optional_request_info_;
-
- DISALLOW_COPY_AND_ASSIGN(ChromeSpeechInputManagerDelegate);
-};
-
-} // namespace speech_input
-
-#endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_DELEGATE_H_
diff --git a/chrome/browser/speech/chrome_speech_input_preferences.h b/chrome/browser/speech/chrome_speech_input_preferences.h
deleted file mode 100644
index b253e31..0000000
--- a/chrome/browser/speech/chrome_speech_input_preferences.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_PREFERENCES_H_
-#define CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_PREFERENCES_H_
-#pragma once
-
-#include "base/basictypes.h"
-#include "content/public/browser/speech_input_preferences.h"
-
-class PrefService;
-
-class ChromeSpeechInputPreferences : public content::SpeechInputPreferences {
- public:
- explicit ChromeSpeechInputPreferences(PrefService* pref_service);
-
- // Overridden from content::SpeechInputPreferences:
- virtual bool FilterProfanities() const OVERRIDE;
- virtual void SetFilterProfanities(bool filter_profanities) OVERRIDE;
-
- private:
- virtual ~ChromeSpeechInputPreferences();
-
- // Only to be accessed and modified on the IO thread.
- bool filter_profanities_;
-
- DISALLOW_COPY_AND_ASSIGN(ChromeSpeechInputPreferences);
-};
-
-#endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_PREFERENCES_H_
diff --git a/chrome/browser/speech/chrome_speech_input_manager_delegate.cc b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc
index 48a95da..bdf5f58 100644
--- a/chrome/browser/speech/chrome_speech_input_manager_delegate.cc
+++ b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/speech/chrome_speech_input_manager_delegate.h"
+#include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
#include <string>
@@ -17,8 +17,8 @@
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/resource_context.h"
-#include "content/public/browser/speech_input_manager.h"
-#include "content/public/common/speech_input_result.h"
+#include "content/public/browser/speech_recognition_manager.h"
+#include "content/public/common/speech_recognition_result.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -27,15 +27,15 @@
#endif
using content::BrowserThread;
-using content::SpeechInputManager;
+using content::SpeechRecognitionManager;
-namespace speech_input {
+namespace speech {
// Asynchronously fetches the PC and audio hardware/driver info if
// the user has opted into UMA. This information is sent with speech input
// requests to the server for identifying and improving quality issues with
// specific device configurations.
-class ChromeSpeechInputManagerDelegate::OptionalRequestInfo
+class ChromeSpeechRecognitionManagerDelegate::OptionalRequestInfo
: public base::RefCountedThreadSafe<OptionalRequestInfo> {
public:
OptionalRequestInfo() : can_report_metrics_(false) {
@@ -63,7 +63,7 @@ class ChromeSpeechInputManagerDelegate::OptionalRequestInfo
base::AutoLock lock(lock_);
can_report_metrics_ = true;
string16 device_model =
- SpeechInputManager::GetInstance()->GetAudioInputDeviceModel();
+ SpeechRecognitionManager::GetInstance()->GetAudioInputDeviceModel();
#if defined(OS_WIN)
value_ = UTF16ToUTF8(
installer::WMIComputerSystem::GetModel() + L"|" + device_model);
@@ -94,15 +94,16 @@ class ChromeSpeechInputManagerDelegate::OptionalRequestInfo
DISALLOW_COPY_AND_ASSIGN(OptionalRequestInfo);
};
-ChromeSpeechInputManagerDelegate::ChromeSpeechInputManagerDelegate()
- : bubble_controller_(new SpeechInputBubbleController(
+ChromeSpeechRecognitionManagerDelegate::ChromeSpeechRecognitionManagerDelegate()
+ : bubble_controller_(new SpeechRecognitionBubbleController(
ALLOW_THIS_IN_INITIALIZER_LIST(this))) {
}
-ChromeSpeechInputManagerDelegate::~ChromeSpeechInputManagerDelegate() {
+ChromeSpeechRecognitionManagerDelegate::
+ ~ChromeSpeechRecognitionManagerDelegate() {
}
-void ChromeSpeechInputManagerDelegate::ShowRecognitionRequested(
+void ChromeSpeechRecognitionManagerDelegate::ShowRecognitionRequested(
int caller_id,
int render_process_id,
int render_view_id,
@@ -111,7 +112,7 @@ void ChromeSpeechInputManagerDelegate::ShowRecognitionRequested(
render_view_id, element_rect);
}
-void ChromeSpeechInputManagerDelegate::GetRequestInfo(
+void ChromeSpeechRecognitionManagerDelegate::GetRequestInfo(
bool* can_report_metrics,
std::string* request_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -130,24 +131,24 @@ void ChromeSpeechInputManagerDelegate::GetRequestInfo(
*request_info = optional_request_info_->value();
}
-void ChromeSpeechInputManagerDelegate::ShowWarmUp(int caller_id) {
+void ChromeSpeechRecognitionManagerDelegate::ShowWarmUp(int caller_id) {
bubble_controller_->SetBubbleWarmUpMode(caller_id);
}
-void ChromeSpeechInputManagerDelegate::ShowRecognizing(int caller_id) {
+void ChromeSpeechRecognitionManagerDelegate::ShowRecognizing(int caller_id) {
bubble_controller_->SetBubbleRecognizingMode(caller_id);
}
-void ChromeSpeechInputManagerDelegate::ShowRecording(int caller_id) {
+void ChromeSpeechRecognitionManagerDelegate::ShowRecording(int caller_id) {
bubble_controller_->SetBubbleRecordingMode(caller_id);
}
-void ChromeSpeechInputManagerDelegate::ShowInputVolume(
+void ChromeSpeechRecognitionManagerDelegate::ShowInputVolume(
int caller_id, float volume, float noise_volume) {
bubble_controller_->SetBubbleInputVolume(caller_id, volume, noise_volume);
}
-void ChromeSpeechInputManagerDelegate::ShowMicError(int caller_id,
+void ChromeSpeechRecognitionManagerDelegate::ShowMicError(int caller_id,
MicError error) {
switch (error) {
case MIC_ERROR_NO_DEVICE_AVAILABLE:
@@ -165,21 +166,21 @@ void ChromeSpeechInputManagerDelegate::ShowMicError(int caller_id,
}
}
-void ChromeSpeechInputManagerDelegate::ShowRecognizerError(
- int caller_id, content::SpeechInputError error) {
+void ChromeSpeechRecognitionManagerDelegate::ShowRecognizerError(
+ int caller_id, content::SpeechRecognitionErrorCode error) {
struct ErrorMessageMapEntry {
- content::SpeechInputError error;
+ content::SpeechRecognitionErrorCode error;
int message_id;
};
ErrorMessageMapEntry error_message_map[] = {
{
- content::SPEECH_INPUT_ERROR_AUDIO, IDS_SPEECH_INPUT_MIC_ERROR
+ content::SPEECH_RECOGNITION_ERROR_AUDIO, IDS_SPEECH_INPUT_MIC_ERROR
}, {
- content::SPEECH_INPUT_ERROR_NO_SPEECH, IDS_SPEECH_INPUT_NO_SPEECH
+ content::SPEECH_RECOGNITION_ERROR_NO_SPEECH, IDS_SPEECH_INPUT_NO_SPEECH
}, {
- content::SPEECH_INPUT_ERROR_NO_MATCH, IDS_SPEECH_INPUT_NO_RESULTS
+ content::SPEECH_RECOGNITION_ERROR_NO_MATCH, IDS_SPEECH_INPUT_NO_RESULTS
}, {
- content::SPEECH_INPUT_ERROR_NETWORK, IDS_SPEECH_INPUT_NET_ERROR
+ content::SPEECH_RECOGNITION_ERROR_NETWORK, IDS_SPEECH_INPUT_NET_ERROR
}
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(error_message_map); ++i) {
@@ -194,25 +195,27 @@ void ChromeSpeechInputManagerDelegate::ShowRecognizerError(
NOTREACHED() << "unknown error " << error;
}
-void ChromeSpeechInputManagerDelegate::DoClose(int caller_id) {
+void ChromeSpeechRecognitionManagerDelegate::DoClose(int caller_id) {
bubble_controller_->CloseBubble(caller_id);
}
-void ChromeSpeechInputManagerDelegate::InfoBubbleButtonClicked(
- int caller_id, SpeechInputBubble::Button button) {
+void ChromeSpeechRecognitionManagerDelegate::InfoBubbleButtonClicked(
+ int caller_id, SpeechRecognitionBubble::Button button) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (button == SpeechInputBubble::BUTTON_CANCEL) {
- SpeechInputManager::GetInstance()->CancelRecognitionForRequest(caller_id);
- } else if (button == SpeechInputBubble::BUTTON_TRY_AGAIN) {
- SpeechInputManager::GetInstance()->StartRecognitionForRequest(caller_id);
+ if (button == SpeechRecognitionBubble::BUTTON_CANCEL) {
+ SpeechRecognitionManager::GetInstance()->CancelRecognitionForRequest(
+ caller_id);
+ } else if (button == SpeechRecognitionBubble::BUTTON_TRY_AGAIN) {
+ SpeechRecognitionManager::GetInstance()->StartRecognitionForRequest(
+ caller_id);
}
}
-void ChromeSpeechInputManagerDelegate::InfoBubbleFocusChanged(int caller_id) {
+void ChromeSpeechRecognitionManagerDelegate::InfoBubbleFocusChanged(
+ int caller_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
- SpeechInputManager::GetInstance()->FocusLostForRequest(caller_id);
+ SpeechRecognitionManager::GetInstance()->FocusLostForRequest(caller_id);
}
-} // namespace speech_input
+} // namespace speech
diff --git a/chrome/browser/speech/chrome_speech_recognition_manager_delegate.h b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.h
new file mode 100644
index 0000000..cf4e7db
--- /dev/null
+++ b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
+#define CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
+
+#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
+#include "chrome/browser/speech/speech_recognition_bubble_controller.h"
+#include "content/public/browser/speech_recognition_manager_delegate.h"
+
+namespace speech {
+
+// This is Chrome's implementation of the SpeechRecognitionManager interface.
+// This class is a singleton and accessed via the Get method.
+class ChromeSpeechRecognitionManagerDelegate
+ : NON_EXPORTED_BASE(public content::SpeechRecognitionManagerDelegate),
+ public SpeechRecognitionBubbleControllerDelegate {
+ public:
+ ChromeSpeechRecognitionManagerDelegate();
+ virtual ~ChromeSpeechRecognitionManagerDelegate();
+
+ // SpeechRecognitionBubbleControllerDelegate methods.
+ virtual void InfoBubbleButtonClicked(
+ int caller_id, SpeechRecognitionBubble::Button button) OVERRIDE;
+ virtual void InfoBubbleFocusChanged(int caller_id) OVERRIDE;
+
+ protected:
+ // SpeechRecognitionManagerDelegate methods.
+ virtual void GetRequestInfo(bool* can_report_metrics,
+ std::string* request_info) OVERRIDE;
+ virtual void ShowRecognitionRequested(int caller_id,
+ int render_process_id,
+ int render_view_id,
+ const gfx::Rect& element_rect) OVERRIDE;
+ virtual void ShowWarmUp(int caller_id) OVERRIDE;
+ virtual void ShowRecognizing(int caller_id) OVERRIDE;
+ virtual void ShowRecording(int caller_id) OVERRIDE;
+ virtual void ShowInputVolume(int caller_id,
+ float volume,
+ float noise_volume) OVERRIDE;
+ virtual void ShowMicError(int caller_id,
+ MicError error) OVERRIDE;
+ virtual void ShowRecognizerError(
+ int caller_id, content::SpeechRecognitionErrorCode error) OVERRIDE;
+ virtual void DoClose(int caller_id) OVERRIDE;
+
+ private:
+ class OptionalRequestInfo;
+
+ scoped_refptr<SpeechRecognitionBubbleController> bubble_controller_;
+ scoped_refptr<OptionalRequestInfo> optional_request_info_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionManagerDelegate);
+};
+
+} // namespace speech
+
+#endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
diff --git a/chrome/browser/speech/chrome_speech_input_preferences.cc b/chrome/browser/speech/chrome_speech_recognition_preferences.cc
index bce8ee6..04a20d9 100644
--- a/chrome/browser/speech/chrome_speech_input_preferences.cc
+++ b/chrome/browser/speech/chrome_speech_recognition_preferences.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/speech/chrome_speech_input_preferences.h"
+#include "chrome/browser/speech/chrome_speech_recognition_preferences.h"
#include "base/bind.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -11,26 +11,26 @@
using content::BrowserThread;
-ChromeSpeechInputPreferences::ChromeSpeechInputPreferences(
+ChromeSpeechRecognitionPreferences::ChromeSpeechRecognitionPreferences(
PrefService* pref_service)
: filter_profanities_(
- pref_service->GetBoolean(prefs::kSpeechInputFilterProfanities)) {
+ pref_service->GetBoolean(prefs::kSpeechRecognitionFilterProfanities)){
}
-ChromeSpeechInputPreferences::~ChromeSpeechInputPreferences() {
+ChromeSpeechRecognitionPreferences::~ChromeSpeechRecognitionPreferences() {
}
-bool ChromeSpeechInputPreferences::FilterProfanities() const {
+bool ChromeSpeechRecognitionPreferences::FilterProfanities() const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
return filter_profanities_;
}
-void ChromeSpeechInputPreferences::SetFilterProfanities(
+void ChromeSpeechRecognitionPreferences::SetFilterProfanities(
bool filter_profanities) {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(&ChromeSpeechInputPreferences::SetFilterProfanities,
+ base::Bind(&ChromeSpeechRecognitionPreferences::SetFilterProfanities,
this, filter_profanities));
return;
}
diff --git a/chrome/browser/speech/chrome_speech_recognition_preferences.h b/chrome/browser/speech/chrome_speech_recognition_preferences.h
new file mode 100644
index 0000000..0a6310e1
--- /dev/null
+++ b/chrome/browser/speech/chrome_speech_recognition_preferences.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_PREFERENCES_H_
+#define CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_PREFERENCES_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "content/public/browser/speech_recognition_preferences.h"
+
+class PrefService;
+
+class ChromeSpeechRecognitionPreferences
+ : public content::SpeechRecognitionPreferences {
+ public:
+ explicit ChromeSpeechRecognitionPreferences(PrefService* pref_service);
+
+ // Overridden from content::SpeechRecognitionPreferences:
+ virtual bool FilterProfanities() const OVERRIDE;
+ virtual void SetFilterProfanities(bool filter_profanities) OVERRIDE;
+
+ private:
+ virtual ~ChromeSpeechRecognitionPreferences();
+
+ // Only to be accessed and modified on the IO thread.
+ bool filter_profanities_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionPreferences);
+};
+
+#endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_PREFERENCES_H_
diff --git a/chrome/browser/speech/speech_input_extension_apitest.cc b/chrome/browser/speech/speech_input_extension_apitest.cc
index 6d3c489..905ac33 100644
--- a/chrome/browser/speech/speech_input_extension_apitest.cc
+++ b/chrome/browser/speech/speech_input_extension_apitest.cc
@@ -13,7 +13,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/speech_recognizer_delegate.h"
-#include "content/public/common/speech_input_result.h"
+#include "content/public/common/speech_recognition_result.h"
#include "testing/gtest/include/gtest/gtest.h"
using content::BrowserThread;
@@ -33,11 +33,11 @@ class SpeechInputExtensionApiTest : public ExtensionApiTest,
recording_devices_available_ = available;
}
- void SetRecognitionError(content::SpeechInputError error) {
+ void SetRecognitionError(content::SpeechRecognitionErrorCode error) {
next_error_ = error;
}
- void SetRecognitionResult(const content::SpeechInputResult& result) {
+ void SetRecognitionResult(const content::SpeechRecognitionResult& result) {
next_result_ = result;
}
@@ -59,7 +59,7 @@ class SpeechInputExtensionApiTest : public ExtensionApiTest,
return recording_devices_available_;
}
- virtual bool IsRecordingInProcess() OVERRIDE {
+ virtual bool IsCapturingAudio() OVERRIDE {
// Only the mock recognizer is supposed to be recording during testing.
return HasValidRecognizer();
}
@@ -105,15 +105,15 @@ class SpeechInputExtensionApiTest : public ExtensionApiTest,
bool recording_devices_available_;
bool recognizer_is_valid_;
- content::SpeechInputError next_error_;
- content::SpeechInputResult next_result_;
+ content::SpeechRecognitionErrorCode next_error_;
+ content::SpeechRecognitionResult next_result_;
int result_delay_ms_;
};
SpeechInputExtensionApiTest::SpeechInputExtensionApiTest()
: recording_devices_available_(true),
recognizer_is_valid_(false),
- next_error_(content::SPEECH_INPUT_ERROR_NONE),
+ next_error_(content::SPEECH_RECOGNITION_ERROR_NONE),
result_delay_ms_(0) {
}
@@ -165,7 +165,7 @@ void SpeechInputExtensionApiTest::StopRecording(bool recognition_failed) {
void SpeechInputExtensionApiTest::ProvideResults(int caller_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (next_error_ != content::SPEECH_INPUT_ERROR_NONE) {
+ if (next_error_ != content::SPEECH_RECOGNITION_ERROR_NONE) {
GetManager()->OnRecognizerError(caller_id, next_error_);
return;
}
@@ -192,9 +192,10 @@ IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, NoDevicesAvailable) {
IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionSuccessful) {
AutoManagerHook hook(this);
- content::SpeechInputResult result;
+ content::SpeechRecognitionResult result;
result.hypotheses.push_back(
- content::SpeechInputHypothesis(UTF8ToUTF16("this is a test"), 0.99));
+ content::SpeechRecognitionHypothesis(
+ UTF8ToUTF16("this is a test"), 0.99));
SetRecognitionResult(result);
ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_;
}
@@ -202,6 +203,6 @@ IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionSuccessful) {
IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) {
AutoManagerHook hook(this);
- SetRecognitionError(content::SPEECH_INPUT_ERROR_NETWORK);
+ SetRecognitionError(content::SPEECH_RECOGNITION_ERROR_NETWORK);
ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_;
}
diff --git a/chrome/browser/speech/speech_input_extension_manager.cc b/chrome/browser/speech/speech_input_extension_manager.cc
index 86ebae27..cbaf7ed 100644
--- a/chrome/browser/speech/speech_input_extension_manager.cc
+++ b/chrome/browser/speech/speech_input_extension_manager.cc
@@ -22,12 +22,13 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
-#include "content/public/browser/speech_input_manager.h"
+#include "content/public/browser/speech_recognition_manager.h"
#include "content/public/browser/speech_recognizer.h"
-#include "content/public/common/speech_input_result.h"
+#include "content/public/common/speech_recognition_result.h"
using content::BrowserThread;
-using content::SpeechInputManager;
+using content::SpeechRecognitionHypothesis;
+using content::SpeechRecognitionManager;
namespace {
@@ -238,7 +239,7 @@ void SpeechInputExtensionManager::ResetToIdleState() {
void SpeechInputExtensionManager::SetRecognitionResult(
int caller_id,
- const content::SpeechInputResult& result) {
+ const content::SpeechRecognitionResult& result) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_EQ(caller_id, kSpeechCallerId);
@@ -253,7 +254,7 @@ void SpeechInputExtensionManager::SetRecognitionResult(
}
void SpeechInputExtensionManager::SetRecognitionResultOnUIThread(
- const content::SpeechInputResult& result,
+ const content::SpeechRecognitionResult& result,
const std::string& extension_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -265,7 +266,7 @@ void SpeechInputExtensionManager::SetRecognitionResultOnUIThread(
js_event->Set(kHypothesesKey, js_hypothesis_array);
for (size_t i = 0; i < result.hypotheses.size(); ++i) {
- const content::SpeechInputHypothesis& hypothesis = result.hypotheses[i];
+ const SpeechRecognitionHypothesis& hypothesis = result.hypotheses[i];
DictionaryValue* js_hypothesis_object = new DictionaryValue();
js_hypothesis_array->Append(js_hypothesis_object);
@@ -335,7 +336,7 @@ void SpeechInputExtensionManager::DidStartReceivingAudioOnUIThread() {
}
void SpeechInputExtensionManager::OnRecognizerError(
- int caller_id, content::SpeechInputError error) {
+ int caller_id, content::SpeechRecognitionErrorCode error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_EQ(caller_id, kSpeechCallerId);
VLOG(1) << "OnRecognizerError: " << error;
@@ -351,10 +352,10 @@ void SpeechInputExtensionManager::OnRecognizerError(
bool report_to_event = true;
switch (error) {
- case content::SPEECH_INPUT_ERROR_NONE:
+ case content::SPEECH_RECOGNITION_ERROR_NONE:
break;
- case content::SPEECH_INPUT_ERROR_AUDIO:
+ case content::SPEECH_RECOGNITION_ERROR_AUDIO:
if (state_ == kStarting) {
event_error_code = kErrorUnableToStart;
report_to_event = false;
@@ -363,22 +364,22 @@ void SpeechInputExtensionManager::OnRecognizerError(
}
break;
- case content::SPEECH_INPUT_ERROR_NETWORK:
+ case content::SPEECH_RECOGNITION_ERROR_NETWORK:
event_error_code = kErrorNetworkError;
break;
- case content::SPEECH_INPUT_ERROR_BAD_GRAMMAR:
+ case content::SPEECH_RECOGNITION_ERROR_BAD_GRAMMAR:
// No error is returned on invalid language, for example.
// To avoid confusion about when this is would be fired, the invalid
// params error is not being exposed to the onError event.
event_error_code = kErrorUnableToStart;
break;
- case content::SPEECH_INPUT_ERROR_NO_SPEECH:
+ case content::SPEECH_RECOGNITION_ERROR_NO_SPEECH:
event_error_code = kErrorNoSpeechHeard;
break;
- case content::SPEECH_INPUT_ERROR_NO_MATCH:
+ case content::SPEECH_RECOGNITION_ERROR_NO_MATCH:
event_error_code = kErrorNoResults;
break;
@@ -551,7 +552,7 @@ void SpeechInputExtensionManager::StartOnIOThread(
return;
}
- if (GetSpeechInputExtensionInterface()->IsRecordingInProcess()) {
+ if (GetSpeechInputExtensionInterface()->IsCapturingAudio()) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&SpeechInputExtensionManager::DispatchError, this,
std::string(kErrorRecordingDeviceInUse), false));
@@ -565,12 +566,12 @@ void SpeechInputExtensionManager::StartOnIOThread(
bool SpeechInputExtensionManager::HasAudioInputDevices() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- return SpeechInputManager::GetInstance()->HasAudioInputDevices();
+ return SpeechRecognitionManager::GetInstance()->HasAudioInputDevices();
}
-bool SpeechInputExtensionManager::IsRecordingInProcess() {
+bool SpeechInputExtensionManager::IsCapturingAudio() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- return SpeechInputManager::GetInstance()->IsRecordingInProcess();
+ return SpeechRecognitionManager::GetInstance()->IsCapturingAudio();
}
void SpeechInputExtensionManager::IsRecording(
@@ -586,7 +587,7 @@ void SpeechInputExtensionManager::IsRecordingOnIOThread(
const IsRecordingCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- bool result = GetSpeechInputExtensionInterface()->IsRecordingInProcess();
+ bool result = GetSpeechInputExtensionInterface()->IsCapturingAudio();
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&SpeechInputExtensionManager::IsRecordingOnUIThread,
diff --git a/chrome/browser/speech/speech_input_extension_manager.h b/chrome/browser/speech/speech_input_extension_manager.h
index a6f3b14..aaf612d 100644
--- a/chrome/browser/speech/speech_input_extension_manager.h
+++ b/chrome/browser/speech/speech_input_extension_manager.h
@@ -45,7 +45,7 @@ class SpeechInputExtensionInterface {
virtual void StopRecording(bool recognition_failed) = 0;
virtual bool HasAudioInputDevices() = 0;
- virtual bool IsRecordingInProcess() = 0;
+ virtual bool IsCapturingAudio() = 0;
// Called from the UI thread.
virtual bool HasValidRecognizer() = 0;
@@ -117,7 +117,7 @@ class SpeechInputExtensionManager
// Methods from SpeechRecognizerDelegate.
virtual void SetRecognitionResult(
int caller_id,
- const content::SpeechInputResult& result) OVERRIDE;
+ const content::SpeechRecognitionResult& result) OVERRIDE;
virtual void DidStartReceivingAudio(int caller_id) OVERRIDE;
virtual void DidCompleteRecording(int caller_id) OVERRIDE;
@@ -125,7 +125,7 @@ class SpeechInputExtensionManager
virtual void DidStartReceivingSpeech(int caller_id) OVERRIDE;
virtual void DidStopReceivingSpeech(int caller_id) OVERRIDE;
virtual void OnRecognizerError(int caller_id,
- content::SpeechInputError error)
+ content::SpeechRecognitionErrorCode error)
OVERRIDE;
virtual void DidCompleteEnvironmentEstimation(int caller_id) OVERRIDE;
virtual void SetInputVolume(int caller_id, float volume,
@@ -138,7 +138,7 @@ class SpeechInputExtensionManager
private:
// SpeechInputExtensionInterface methods:
- virtual bool IsRecordingInProcess() OVERRIDE;
+ virtual bool IsCapturingAudio() OVERRIDE;
virtual bool HasAudioInputDevices() OVERRIDE;
virtual bool HasValidRecognizer() OVERRIDE;
virtual void StartRecording(
@@ -161,7 +161,7 @@ class SpeechInputExtensionManager
void IsRecordingOnIOThread(const IsRecordingCallback& callback);
void SetRecognitionResultOnUIThread(
- const content::SpeechInputResult& result,
+ const content::SpeechRecognitionResult& result,
const std::string& extension_id);
void DidStartReceivingAudioOnUIThread();
void StopSucceededOnUIThread();
diff --git a/chrome/browser/speech/speech_input_bubble.cc b/chrome/browser/speech/speech_recognition_bubble.cc
index 6d5bf8d..d3f4013 100644
--- a/chrome/browser/speech/speech_input_bubble.cc
+++ b/chrome/browser/speech/speech_recognition_bubble.cc
@@ -5,7 +5,7 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/message_loop.h"
-#include "chrome/browser/speech/speech_input_bubble.h"
+#include "chrome/browser/speech/speech_recognition_bubble.h"
#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -24,8 +24,8 @@ const int kWarmingUpAnimationStepMs = 100;
const int kRecognizingAnimationStepMs = 100;
// A lazily initialized singleton to hold all the image used by the speech
-// input bubbles and safely destroy them on exit.
-class SpeechInputBubbleImages {
+// recognition bubbles and safely destroy them on exit.
+class SpeechRecognitionBubbleImages {
public:
const std::vector<SkBitmap>& spinner() { return spinner_; }
const std::vector<SkBitmap>& warm_up() { return warm_up_; }
@@ -36,8 +36,8 @@ class SpeechInputBubbleImages {
private:
// Private constructor to enforce singleton.
- friend struct base::DefaultLazyInstanceTraits<SpeechInputBubbleImages>;
- SpeechInputBubbleImages();
+ friend struct base::DefaultLazyInstanceTraits<SpeechRecognitionBubbleImages>;
+ SpeechRecognitionBubbleImages();
std::vector<SkBitmap> spinner_; // Frames for the progress spinner.
std::vector<SkBitmap> warm_up_; // Frames for the warm up animation.
@@ -49,7 +49,7 @@ class SpeechInputBubbleImages {
SkBitmap* mic_mask_; // Gradient mask used by the volume indicator.
};
-SpeechInputBubbleImages::SpeechInputBubbleImages() {
+SpeechRecognitionBubbleImages::SpeechRecognitionBubbleImages() {
mic_empty_ = ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_SPEECH_INPUT_MIC_EMPTY);
mic_noise_ = ResourceBundle::GetSharedInstance().GetBitmapNamed(
@@ -100,17 +100,17 @@ SpeechInputBubbleImages::SpeechInputBubbleImages() {
}
}
-base::LazyInstance<SpeechInputBubbleImages> g_images =
+base::LazyInstance<SpeechRecognitionBubbleImages> g_images =
LAZY_INSTANCE_INITIALIZER;
} // namespace
-SpeechInputBubble::FactoryMethod SpeechInputBubble::factory_ = NULL;
-const int SpeechInputBubble::kBubbleTargetOffsetX = 10;
+SpeechRecognitionBubble::FactoryMethod SpeechRecognitionBubble::factory_ = NULL;
+const int SpeechRecognitionBubble::kBubbleTargetOffsetX = 10;
-SpeechInputBubble* SpeechInputBubble::Create(WebContents* web_contents,
- Delegate* delegate,
- const gfx::Rect& element_rect) {
+SpeechRecognitionBubble* SpeechRecognitionBubble::Create(
+ WebContents* web_contents, Delegate* delegate,
+ const gfx::Rect& element_rect) {
if (factory_)
return (*factory_)(web_contents, delegate, element_rect);
@@ -121,7 +121,8 @@ SpeechInputBubble* SpeechInputBubble::Create(WebContents* web_contents,
return CreateNativeBubble(web_contents, delegate, element_rect);
}
-SpeechInputBubbleBase::SpeechInputBubbleBase(WebContents* web_contents)
+SpeechRecognitionBubbleBase::SpeechRecognitionBubbleBase(
+ WebContents* web_contents)
: ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
display_mode_(DISPLAY_MODE_RECORDING),
web_contents_(web_contents) {
@@ -138,13 +139,13 @@ SpeechInputBubbleBase::SpeechInputBubbleBase(WebContents* web_contents)
buffer_image_->allocPixels();
}
-SpeechInputBubbleBase::~SpeechInputBubbleBase() {
+SpeechRecognitionBubbleBase::~SpeechRecognitionBubbleBase() {
// This destructor is added to make sure members such as the scoped_ptr
// get destroyed here and the derived classes don't have to care about such
// member variables which they don't use.
}
-void SpeechInputBubbleBase::SetWarmUpMode() {
+void SpeechRecognitionBubbleBase::SetWarmUpMode() {
weak_factory_.InvalidateWeakPtrs();
display_mode_ = DISPLAY_MODE_WARM_UP;
animation_step_ = 0;
@@ -152,11 +153,11 @@ void SpeechInputBubbleBase::SetWarmUpMode() {
UpdateLayout();
}
-void SpeechInputBubbleBase::DoWarmingUpAnimationStep() {
+void SpeechRecognitionBubbleBase::DoWarmingUpAnimationStep() {
SetImage(g_images.Get().warm_up()[animation_step_]);
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
- base::Bind(&SpeechInputBubbleBase::DoWarmingUpAnimationStep,
+ base::Bind(&SpeechRecognitionBubbleBase::DoWarmingUpAnimationStep,
weak_factory_.GetWeakPtr()),
base::TimeDelta::FromMilliseconds(
animation_step_ == 0 ? kWarmingUpAnimationStartMs
@@ -165,41 +166,41 @@ void SpeechInputBubbleBase::DoWarmingUpAnimationStep() {
animation_step_ = 1; // Frame 0 is skipped during the animation.
}
-void SpeechInputBubbleBase::SetRecordingMode() {
+void SpeechRecognitionBubbleBase::SetRecordingMode() {
weak_factory_.InvalidateWeakPtrs();
display_mode_ = DISPLAY_MODE_RECORDING;
SetInputVolume(0, 0);
UpdateLayout();
}
-void SpeechInputBubbleBase::SetRecognizingMode() {
+void SpeechRecognitionBubbleBase::SetRecognizingMode() {
display_mode_ = DISPLAY_MODE_RECOGNIZING;
animation_step_ = 0;
DoRecognizingAnimationStep();
UpdateLayout();
}
-void SpeechInputBubbleBase::DoRecognizingAnimationStep() {
+void SpeechRecognitionBubbleBase::DoRecognizingAnimationStep() {
SetImage(g_images.Get().spinner()[animation_step_]);
if (++animation_step_ >= static_cast<int>(g_images.Get().spinner().size()))
animation_step_ = 0;
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
- base::Bind(&SpeechInputBubbleBase::DoRecognizingAnimationStep,
+ base::Bind(&SpeechRecognitionBubbleBase::DoRecognizingAnimationStep,
weak_factory_.GetWeakPtr()),
base::TimeDelta::FromMilliseconds(kRecognizingAnimationStepMs));
}
-void SpeechInputBubbleBase::SetMessage(const string16& text) {
+void SpeechRecognitionBubbleBase::SetMessage(const string16& text) {
weak_factory_.InvalidateWeakPtrs();
message_text_ = text;
display_mode_ = DISPLAY_MODE_MESSAGE;
UpdateLayout();
}
-void SpeechInputBubbleBase::DrawVolumeOverlay(SkCanvas* canvas,
- const SkBitmap& bitmap,
- float volume) {
+void SpeechRecognitionBubbleBase::DrawVolumeOverlay(SkCanvas* canvas,
+ const SkBitmap& bitmap,
+ float volume) {
buffer_image_->eraseARGB(0, 0, 0, 0);
int width = mic_image_->width();
@@ -222,7 +223,8 @@ void SpeechInputBubbleBase::DrawVolumeOverlay(SkCanvas* canvas,
canvas->drawBitmap(*buffer_image_.get(), 0, 0);
}
-void SpeechInputBubbleBase::SetInputVolume(float volume, float noise_volume) {
+void SpeechRecognitionBubbleBase::SetInputVolume(float volume,
+ float noise_volume) {
mic_image_->eraseARGB(0, 0, 0, 0);
SkCanvas canvas(*mic_image_);
@@ -235,15 +237,15 @@ void SpeechInputBubbleBase::SetInputVolume(float volume, float noise_volume) {
SetImage(*mic_image_.get());
}
-WebContents* SpeechInputBubbleBase::web_contents() {
+WebContents* SpeechRecognitionBubbleBase::web_contents() {
return web_contents_;
}
-void SpeechInputBubbleBase::SetImage(const SkBitmap& image) {
+void SpeechRecognitionBubbleBase::SetImage(const SkBitmap& image) {
icon_image_.reset(new SkBitmap(image));
UpdateImage();
}
-SkBitmap SpeechInputBubbleBase::icon_image() {
+SkBitmap SpeechRecognitionBubbleBase::icon_image() {
return (icon_image_ != NULL) ? *icon_image_ : SkBitmap();
}
diff --git a/chrome/browser/speech/speech_input_bubble.h b/chrome/browser/speech/speech_recognition_bubble.h
index 2ebfe56..f3fef09 100644
--- a/chrome/browser/speech/speech_input_bubble.h
+++ b/chrome/browser/speech/speech_recognition_bubble.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_H_
-#define CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_H_
+#ifndef CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_H_
+#define CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_H_
#pragma once
#include <vector>
@@ -24,11 +24,11 @@ class Canvas;
class Rect;
}
-// SpeechInputBubble displays a popup info bubble during speech recognition,
-// points to the html element which requested speech input and shows recognition
-// progress events. The popup is closed by the user clicking anywhere outside
-// the popup window, or by the caller destroying this object.
-class SpeechInputBubble {
+// SpeechRecognitionBubble displays a popup info bubble during speech
+// recognition, points to the html element which requested speech recognition
+// and shows progress events. The popup is closed by the user clicking anywhere
+// outside the popup window, or by the caller destroying this object.
+class SpeechRecognitionBubble {
public:
// The various buttons which may be part of the bubble.
enum Button {
@@ -58,31 +58,31 @@ class SpeechInputBubble {
// Creates the bubble, call |Show| to display it on screen.
// |web_contents| is the WebContents hosting the page.
// |element_rect| is the display bounds of the html element requesting speech
- // input (in page coordinates).
- static SpeechInputBubble* Create(content::WebContents* web_contents,
- Delegate* delegate,
- const gfx::Rect& element_rect);
+ // recognition (in page coordinates).
+ static SpeechRecognitionBubble* Create(content::WebContents* web_contents,
+ Delegate* delegate,
+ const gfx::Rect& element_rect);
// This is implemented by platform specific code to create the underlying
// bubble window. Not to be called directly by users of this class.
- static SpeechInputBubble* CreateNativeBubble(
+ static SpeechRecognitionBubble* CreateNativeBubble(
content::WebContents* web_contents,
Delegate* delegate,
const gfx::Rect& element_rect);
// |Create| uses the currently registered FactoryMethod to create the
- // SpeechInputBubble instances. FactoryMethod is intended for testing.
- typedef SpeechInputBubble* (*FactoryMethod)(content::WebContents*,
- Delegate*,
- const gfx::Rect&);
- // Sets the factory used by the static method Create. SpeechInputBubble does
- // not take ownership of |factory|. A value of NULL results in a
- // SpeechInputBubble being created directly.
+ // SpeechRecognitionBubble instances. FactoryMethod is intended for testing.
+ typedef SpeechRecognitionBubble* (*FactoryMethod)(content::WebContents*,
+ Delegate*,
+ const gfx::Rect&);
+ // Sets the factory used by the static method Create. SpeechRecognitionBubble
+ // does not take ownership of |factory|. A value of NULL results in a
+ // SpeechRecognitionBubble being created directly.
#if defined(UNIT_TEST)
static void set_factory(FactoryMethod factory) { factory_ = factory; }
#endif
- virtual ~SpeechInputBubble() {}
+ virtual ~SpeechRecognitionBubble() {}
// Indicates to the user that audio hardware is initializing. If the bubble is
// hidden, |Show| must be called to make it appear on screen.
@@ -122,8 +122,8 @@ class SpeechInputBubble {
};
// Base class for the platform specific bubble implementations, this contains
-// the platform independent code for SpeechInputBubble.
-class SpeechInputBubbleBase : public SpeechInputBubble {
+// the platform independent code for SpeechRecognitionBubble.
+class SpeechRecognitionBubbleBase : public SpeechRecognitionBubble {
public:
// The current display mode of the bubble, useful only for the platform
// specific implementation.
@@ -134,10 +134,10 @@ class SpeechInputBubbleBase : public SpeechInputBubble {
DISPLAY_MODE_MESSAGE
};
- explicit SpeechInputBubbleBase(content::WebContents* web_contents);
- virtual ~SpeechInputBubbleBase();
+ explicit SpeechRecognitionBubbleBase(content::WebContents* web_contents);
+ virtual ~SpeechRecognitionBubbleBase();
- // SpeechInputBubble methods
+ // SpeechRecognitionBubble methods
virtual void SetWarmUpMode() OVERRIDE;
virtual void SetRecordingMode() OVERRIDE;
virtual void SetRecognizingMode() OVERRIDE;
@@ -168,7 +168,7 @@ class SpeechInputBubbleBase : public SpeechInputBubble {
float volume);
// Task factory used for animation timer.
- base::WeakPtrFactory<SpeechInputBubbleBase> weak_factory_;
+ base::WeakPtrFactory<SpeechRecognitionBubbleBase> weak_factory_;
int animation_step_; // Current index/step of the animation.
std::vector<SkBitmap> animation_frames_;
std::vector<SkBitmap> warming_up_frames_;
@@ -189,6 +189,6 @@ class SpeechInputBubbleBase : public SpeechInputBubble {
// Visual Studio where it gets confused between multiple Delegate
// classes and gives a C2500 error. (I saw this error on the try bots -
// the workaround was not needed for my machine).
-typedef SpeechInputBubble::Delegate SpeechInputBubbleDelegate;
+typedef SpeechRecognitionBubble::Delegate SpeechRecognitionBubbleDelegate;
-#endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_H_
+#endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_H_
diff --git a/chrome/browser/speech/speech_input_bubble_browsertest.cc b/chrome/browser/speech/speech_recognition_bubble_browsertest.cc
index 72fbf3a..7b1bec9 100644
--- a/chrome/browser/speech/speech_input_bubble_browsertest.cc
+++ b/chrome/browser/speech/speech_recognition_bubble_browsertest.cc
@@ -1,52 +1,53 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/speech/speech_input_bubble.h"
+#include "chrome/browser/speech/speech_recognition_bubble.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/rect.h"
-class SpeechInputBubbleTest : public SpeechInputBubbleDelegate,
+class SpeechRecognitionBubbleTest : public SpeechRecognitionBubbleDelegate,
public InProcessBrowserTest {
public:
- // SpeechInputBubble::Delegate methods.
- virtual void InfoBubbleButtonClicked(SpeechInputBubble::Button button) {}
+ // SpeechRecognitionBubble::Delegate methods.
+ virtual void InfoBubbleButtonClicked(SpeechRecognitionBubble::Button button) {
+ }
virtual void InfoBubbleFocusChanged() {}
protected:
};
-IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, CreateAndDestroy) {
+IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest, CreateAndDestroy) {
gfx::Rect element_rect(100, 100, 100, 100);
- scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create(
+ scoped_ptr<SpeechRecognitionBubble> bubble(SpeechRecognitionBubble::Create(
browser()->GetSelectedWebContents(), this, element_rect));
EXPECT_TRUE(bubble.get());
}
-IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, ShowAndDestroy) {
+IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest, ShowAndDestroy) {
gfx::Rect element_rect(100, 100, 100, 100);
- scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create(
+ scoped_ptr<SpeechRecognitionBubble> bubble(SpeechRecognitionBubble::Create(
browser()->GetSelectedWebContents(), this, element_rect));
EXPECT_TRUE(bubble.get());
bubble->Show();
}
-IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, ShowAndHide) {
+IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest, ShowAndHide) {
gfx::Rect element_rect(100, 100, 100, 100);
- scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create(
+ scoped_ptr<SpeechRecognitionBubble> bubble(SpeechRecognitionBubble::Create(
browser()->GetSelectedWebContents(), this, element_rect));
EXPECT_TRUE(bubble.get());
bubble->Show();
bubble->Hide();
}
-IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, ShowAndHideTwice) {
+IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest, ShowAndHideTwice) {
gfx::Rect element_rect(100, 100, 100, 100);
- scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create(
+ scoped_ptr<SpeechRecognitionBubble> bubble(SpeechRecognitionBubble::Create(
browser()->GetSelectedWebContents(), this, element_rect));
EXPECT_TRUE(bubble.get());
bubble->Show();
diff --git a/chrome/browser/speech/speech_input_bubble_controller.cc b/chrome/browser/speech/speech_recognition_bubble_controller.cc
index 8645e51..656738f 100644
--- a/chrome/browser/speech/speech_input_bubble_controller.cc
+++ b/chrome/browser/speech/speech_recognition_bubble_controller.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/speech/speech_input_bubble_controller.h"
+#include "chrome/browser/speech/speech_recognition_bubble_controller.h"
#include "base/bind.h"
#include "chrome/browser/tab_contents/tab_util.h"
@@ -16,28 +16,29 @@
using content::BrowserThread;
using content::WebContents;
-namespace speech_input {
+namespace speech {
-SpeechInputBubbleController::SpeechInputBubbleController(Delegate* delegate)
+SpeechRecognitionBubbleController::SpeechRecognitionBubbleController(
+ Delegate* delegate)
: delegate_(delegate),
current_bubble_caller_id_(0),
registrar_(new content::NotificationRegistrar) {
}
-SpeechInputBubbleController::~SpeechInputBubbleController() {
+SpeechRecognitionBubbleController::~SpeechRecognitionBubbleController() {
DCHECK(bubbles_.empty());
}
-void SpeechInputBubbleController::CreateBubble(int caller_id,
- int render_process_id,
- int render_view_id,
- const gfx::Rect& element_rect) {
+void SpeechRecognitionBubbleController::CreateBubble(
+ int caller_id,
+ int render_process_id,
+ int render_view_id,
+ const gfx::Rect& element_rect) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(&SpeechInputBubbleController::CreateBubble, this,
- caller_id, render_process_id, render_view_id,
- element_rect));
+ base::Bind(&SpeechRecognitionBubbleController::CreateBubble, this,
+ caller_id, render_process_id, render_view_id, element_rect));
return;
}
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -45,16 +46,16 @@ void SpeechInputBubbleController::CreateBubble(int caller_id,
render_view_id);
DCHECK_EQ(0u, bubbles_.count(caller_id));
- SpeechInputBubble* bubble = SpeechInputBubble::Create(web_contents, this,
- element_rect);
+ SpeechRecognitionBubble* bubble = SpeechRecognitionBubble::Create(
+ web_contents, this, element_rect);
if (!bubble) {
// Could be null if tab or display rect were invalid.
// Simulate the cancel button being clicked to inform the delegate.
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(
- &SpeechInputBubbleController::InvokeDelegateButtonClicked,
- this, caller_id, SpeechInputBubble::BUTTON_CANCEL));
+ &SpeechRecognitionBubbleController::InvokeDelegateButtonClicked,
+ this, caller_id, SpeechRecognitionBubble::BUTTON_CANCEL));
return;
}
@@ -63,38 +64,38 @@ void SpeechInputBubbleController::CreateBubble(int caller_id,
UpdateTabContentsSubscription(caller_id, BUBBLE_ADDED);
}
-void SpeechInputBubbleController::CloseBubble(int caller_id) {
+void SpeechRecognitionBubbleController::CloseBubble(int caller_id) {
ProcessRequestInUiThread(caller_id, REQUEST_CLOSE, string16(), 0, 0);
}
-void SpeechInputBubbleController::SetBubbleWarmUpMode(int caller_id) {
+void SpeechRecognitionBubbleController::SetBubbleWarmUpMode(int caller_id) {
ProcessRequestInUiThread(caller_id, REQUEST_SET_WARM_UP_MODE,
string16(), 0, 0);
}
-void SpeechInputBubbleController::SetBubbleRecordingMode(int caller_id) {
+void SpeechRecognitionBubbleController::SetBubbleRecordingMode(int caller_id) {
ProcessRequestInUiThread(caller_id, REQUEST_SET_RECORDING_MODE,
string16(), 0, 0);
}
-void SpeechInputBubbleController::SetBubbleRecognizingMode(int caller_id) {
+void SpeechRecognitionBubbleController::SetBubbleRecognizingMode(
+ int caller_id) {
ProcessRequestInUiThread(caller_id, REQUEST_SET_RECOGNIZING_MODE,
string16(), 0, 0);
}
-void SpeechInputBubbleController::SetBubbleInputVolume(int caller_id,
- float volume,
- float noise_volume) {
+void SpeechRecognitionBubbleController::SetBubbleInputVolume(
+ int caller_id, float volume, float noise_volume) {
ProcessRequestInUiThread(caller_id, REQUEST_SET_INPUT_VOLUME, string16(),
volume, noise_volume);
}
-void SpeechInputBubbleController::SetBubbleMessage(int caller_id,
- const string16& text) {
+void SpeechRecognitionBubbleController::SetBubbleMessage(int caller_id,
+ const string16& text) {
ProcessRequestInUiThread(caller_id, REQUEST_SET_MESSAGE, text, 0, 0);
}
-void SpeechInputBubbleController::UpdateTabContentsSubscription(
+void SpeechRecognitionBubbleController::UpdateTabContentsSubscription(
int caller_id, ManageSubscriptionAction action) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -117,11 +118,11 @@ void SpeechInputBubbleController::UpdateTabContentsSubscription(
content::Source<WebContents>(web_contents));
} else {
registrar_->Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
- content::Source<WebContents>(web_contents));
+ content::Source<WebContents>(web_contents));
}
}
-void SpeechInputBubbleController::Observe(
+void SpeechRecognitionBubbleController::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -133,8 +134,8 @@ void SpeechInputBubbleController::Observe(
if (iter->second->web_contents() == web_contents) {
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(
- &SpeechInputBubbleController::InvokeDelegateButtonClicked,
- this, iter->first, SpeechInputBubble::BUTTON_CANCEL));
+ &SpeechRecognitionBubbleController::InvokeDelegateButtonClicked,
+ this, iter->first, SpeechRecognitionBubble::BUTTON_CANCEL));
CloseBubble(iter->first);
// We expect to have a very small number of items in this map so
// redo-ing from start is ok.
@@ -148,12 +149,12 @@ void SpeechInputBubbleController::Observe(
}
}
-void SpeechInputBubbleController::ProcessRequestInUiThread(
+void SpeechRecognitionBubbleController::ProcessRequestInUiThread(
int caller_id, RequestType type, const string16& text, float volume,
float noise_volume) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
- &SpeechInputBubbleController::ProcessRequestInUiThread, this,
+ &SpeechRecognitionBubbleController::ProcessRequestInUiThread, this,
caller_id, type, text, volume, noise_volume));
return;
}
@@ -171,7 +172,7 @@ void SpeechInputBubbleController::ProcessRequestInUiThread(
current_bubble_caller_id_ = caller_id;
}
- SpeechInputBubble* bubble = bubbles_[caller_id];
+ SpeechRecognitionBubble* bubble = bubbles_[caller_id];
switch (type) {
case REQUEST_SET_WARM_UP_MODE:
bubble->SetWarmUpMode();
@@ -204,19 +205,19 @@ void SpeechInputBubbleController::ProcessRequestInUiThread(
bubble->Show();
}
-void SpeechInputBubbleController::InfoBubbleButtonClicked(
- SpeechInputBubble::Button button) {
+void SpeechRecognitionBubbleController::InfoBubbleButtonClicked(
+ SpeechRecognitionBubble::Button button) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(current_bubble_caller_id_);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(
- &SpeechInputBubbleController::InvokeDelegateButtonClicked,
+ &SpeechRecognitionBubbleController::InvokeDelegateButtonClicked,
this, current_bubble_caller_id_, button));
}
-void SpeechInputBubbleController::InfoBubbleFocusChanged() {
+void SpeechRecognitionBubbleController::InfoBubbleFocusChanged() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(current_bubble_caller_id_);
@@ -226,17 +227,18 @@ void SpeechInputBubbleController::InfoBubbleFocusChanged() {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(
- &SpeechInputBubbleController::InvokeDelegateFocusChanged,
+ &SpeechRecognitionBubbleController::InvokeDelegateFocusChanged,
this, old_bubble_caller_id));
}
-void SpeechInputBubbleController::InvokeDelegateButtonClicked(
- int caller_id, SpeechInputBubble::Button button) {
+void SpeechRecognitionBubbleController::InvokeDelegateButtonClicked(
+ int caller_id, SpeechRecognitionBubble::Button button) {
delegate_->InfoBubbleButtonClicked(caller_id, button);
}
-void SpeechInputBubbleController::InvokeDelegateFocusChanged(int caller_id) {
+void SpeechRecognitionBubbleController::InvokeDelegateFocusChanged(
+ int caller_id) {
delegate_->InfoBubbleFocusChanged(caller_id);
}
-} // namespace speech_input
+} // namespace speech
diff --git a/chrome/browser/speech/speech_input_bubble_controller.h b/chrome/browser/speech/speech_recognition_bubble_controller.h
index 39a0293..735b9dd 100644
--- a/chrome/browser/speech/speech_input_bubble_controller.h
+++ b/chrome/browser/speech/speech_recognition_bubble_controller.h
@@ -1,16 +1,16 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_CONTROLLER_H_
-#define CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_CONTROLLER_H_
+#ifndef CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_
+#define CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_
#include <map>
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/speech/speech_input_bubble.h"
+#include "chrome/browser/speech/speech_recognition_bubble.h"
#include "content/public/browser/notification_observer.h"
namespace gfx {
@@ -21,38 +21,38 @@ namespace content {
class NotificationRegistrar;
}
-namespace speech_input {
+namespace speech {
-// This class handles the speech input popup UI on behalf of SpeechInputManager.
-// SpeechInputManager invokes methods in the IO thread and this class processes
+// This class handles the speech recognition popup UI on behalf of
+// SpeechRecognitionManager, which invokes methods in the IO thread, processing
// those requests in the UI thread. There could be multiple bubble objects alive
// at the same time but only one of them is visible to the user. User actions on
// that bubble are reported to the delegate.
-class SpeechInputBubbleController
- : public base::RefCountedThreadSafe<SpeechInputBubbleController>,
- public SpeechInputBubbleDelegate,
+class SpeechRecognitionBubbleController
+ : public base::RefCountedThreadSafe<SpeechRecognitionBubbleController>,
+ public SpeechRecognitionBubbleDelegate,
public content::NotificationObserver {
public:
// All methods of this delegate are called in the IO thread.
class Delegate {
public:
- // Invoked when the user clicks on a button in the speech input UI.
- virtual void InfoBubbleButtonClicked(int caller_id,
- SpeechInputBubble::Button button) = 0;
+ // Invoked when the user clicks on a button in the speech recognition UI.
+ virtual void InfoBubbleButtonClicked(
+ int caller_id, SpeechRecognitionBubble::Button button) = 0;
- // Invoked when the user clicks outside the speech input info bubble causing
- // it to close and input focus to change.
+ // Invoked when the user clicks outside the speech recognition info bubble
+ // causing it to close and input focus to change.
virtual void InfoBubbleFocusChanged(int caller_id) = 0;
protected:
virtual ~Delegate() {}
};
- explicit SpeechInputBubbleController(Delegate* delegate);
- virtual ~SpeechInputBubbleController();
+ explicit SpeechRecognitionBubbleController(Delegate* delegate);
+ virtual ~SpeechRecognitionBubbleController();
- // Creates a new speech input UI bubble. One of the SetXxxx methods below need
- // to be called to specify what to display.
+ // Creates a new speech recognition UI bubble. One of the SetXxxx methods
+ // below need to be called to specify what to display.
void CreateBubble(int caller_id,
int render_process_id,
int render_view_id,
@@ -79,9 +79,9 @@ class SpeechInputBubbleController
void CloseBubble(int caller_id);
- // SpeechInputBubble::Delegate methods.
+ // SpeechRecognitionBubble::Delegate methods.
virtual void InfoBubbleButtonClicked(
- SpeechInputBubble::Button button) OVERRIDE;
+ SpeechRecognitionBubble::Button button) OVERRIDE;
virtual void InfoBubbleFocusChanged() OVERRIDE;
// content::NotificationObserver implementation.
@@ -106,7 +106,7 @@ class SpeechInputBubbleController
};
void InvokeDelegateButtonClicked(int caller_id,
- SpeechInputBubble::Button button);
+ SpeechRecognitionBubble::Button button);
void InvokeDelegateFocusChanged(int caller_id);
void ProcessRequestInUiThread(int caller_id,
RequestType type,
@@ -133,7 +133,7 @@ class SpeechInputBubbleController
// Map of caller-ids to bubble objects. The bubbles are weak pointers owned by
// this object and get destroyed by |CloseBubble|.
- typedef std::map<int, SpeechInputBubble*> BubbleCallerIdMap;
+ typedef std::map<int, SpeechRecognitionBubble*> BubbleCallerIdMap;
BubbleCallerIdMap bubbles_;
scoped_ptr<content::NotificationRegistrar> registrar_;
@@ -143,9 +143,9 @@ class SpeechInputBubbleController
// Visual Studio where it gets confused between multiple Delegate
// classes and gives a C2500 error. (I saw this error on the try bots -
// the workaround was not needed for my machine).
-typedef SpeechInputBubbleController::Delegate
- SpeechInputBubbleControllerDelegate;
+typedef SpeechRecognitionBubbleController::Delegate
+ SpeechRecognitionBubbleControllerDelegate;
-} // namespace speech_input
+} // namespace speech
-#endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_BUBBLE_CONTROLLER_H_
+#endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_
diff --git a/chrome/browser/speech/speech_input_bubble_controller_unittest.cc b/chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc
index a935dd3..bf1ad88 100644
--- a/chrome/browser/speech/speech_input_bubble_controller_unittest.cc
+++ b/chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/bind.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/speech/speech_input_bubble_controller.h"
+#include "chrome/browser/speech/speech_recognition_bubble_controller.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/test/base/browser_with_test_window_test.h"
@@ -18,11 +18,11 @@ using content::WebContents;
class SkBitmap;
-namespace speech_input {
+namespace speech {
// A mock bubble class which fakes a focus change or recognition cancel by the
// user and closing of the info bubble.
-class MockSpeechInputBubble : public SpeechInputBubbleBase {
+class MockSpeechRecognitionBubble : public SpeechRecognitionBubbleBase {
public:
enum BubbleType {
BUBBLE_TEST_FOCUS_CHANGED,
@@ -30,26 +30,29 @@ class MockSpeechInputBubble : public SpeechInputBubbleBase {
BUBBLE_TEST_CLICK_TRY_AGAIN,
};
- MockSpeechInputBubble(WebContents* web_contents,
+ MockSpeechRecognitionBubble(WebContents* web_contents,
Delegate* delegate,
const gfx::Rect&)
- : SpeechInputBubbleBase(web_contents) {
- VLOG(1) << "MockSpeechInputBubble created";
+ : SpeechRecognitionBubbleBase(web_contents) {
+ VLOG(1) << "MockSpeechRecognitionBubble created";
MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(&InvokeDelegate, delegate));
}
static void InvokeDelegate(Delegate* delegate) {
- VLOG(1) << "MockSpeechInputBubble invoking delegate for type " << type_;
+ VLOG(1) << "MockSpeechRecognitionBubble invoking delegate for type "
+ << type_;
switch (type_) {
case BUBBLE_TEST_FOCUS_CHANGED:
delegate->InfoBubbleFocusChanged();
break;
case BUBBLE_TEST_CLICK_CANCEL:
- delegate->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_CANCEL);
+ delegate->InfoBubbleButtonClicked(
+ SpeechRecognitionBubble::BUTTON_CANCEL);
break;
case BUBBLE_TEST_CLICK_TRY_AGAIN:
- delegate->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_TRY_AGAIN);
+ delegate->InfoBubbleButtonClicked(
+ SpeechRecognitionBubble::BUTTON_TRY_AGAIN);
break;
}
}
@@ -71,34 +74,34 @@ class MockSpeechInputBubble : public SpeechInputBubbleBase {
};
// The test fixture.
-class SpeechInputBubbleControllerTest
- : public SpeechInputBubbleControllerDelegate,
+class SpeechRecognitionBubbleControllerTest
+ : public SpeechRecognitionBubbleControllerDelegate,
public BrowserWithTestWindowTest {
public:
- SpeechInputBubbleControllerTest()
+ SpeechRecognitionBubbleControllerTest()
: BrowserWithTestWindowTest(),
io_thread_(BrowserThread::IO), // constructs a new thread and loop
cancel_clicked_(false),
try_again_clicked_(false),
focus_changed_(false),
controller_(ALLOW_THIS_IN_INITIALIZER_LIST(
- new SpeechInputBubbleController(this))) {
+ new SpeechRecognitionBubbleController(this))) {
EXPECT_EQ(NULL, test_fixture_);
test_fixture_ = this;
}
- ~SpeechInputBubbleControllerTest() {
+ ~SpeechRecognitionBubbleControllerTest() {
test_fixture_ = NULL;
}
- // SpeechInputBubbleControllerDelegate methods.
+ // SpeechRecognitionBubbleControllerDelegate methods.
virtual void InfoBubbleButtonClicked(int caller_id,
- SpeechInputBubble::Button button) {
+ SpeechRecognitionBubble::Button button) {
VLOG(1) << "Received InfoBubbleButtonClicked for button " << button;
EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (button == SpeechInputBubble::BUTTON_CANCEL) {
+ if (button == SpeechRecognitionBubble::BUTTON_CANCEL) {
cancel_clicked_ = true;
- } else if (button == SpeechInputBubble::BUTTON_TRY_AGAIN) {
+ } else if (button == SpeechRecognitionBubble::BUTTON_TRY_AGAIN) {
try_again_clicked_ = true;
}
message_loop()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
@@ -114,20 +117,20 @@ class SpeechInputBubbleControllerTest
// testing::Test methods.
virtual void SetUp() {
BrowserWithTestWindowTest::SetUp();
- SpeechInputBubble::set_factory(
- &SpeechInputBubbleControllerTest::CreateBubble);
+ SpeechRecognitionBubble::set_factory(
+ &SpeechRecognitionBubbleControllerTest::CreateBubble);
io_thread_.Start();
}
virtual void TearDown() {
- SpeechInputBubble::set_factory(NULL);
+ SpeechRecognitionBubble::set_factory(NULL);
io_thread_.Stop();
BrowserWithTestWindowTest::TearDown();
}
static void ActivateBubble() {
- if (MockSpeechInputBubble::type() ==
- MockSpeechInputBubble::BUBBLE_TEST_FOCUS_CHANGED) {
+ if (MockSpeechRecognitionBubble::type() ==
+ MockSpeechRecognitionBubble::BUBBLE_TEST_FOCUS_CHANGED) {
test_fixture_->controller_->SetBubbleWarmUpMode(kBubbleCallerId);
} else {
test_fixture_->controller_->SetBubbleMessage(kBubbleCallerId,
@@ -135,9 +138,10 @@ class SpeechInputBubbleControllerTest
}
}
- static SpeechInputBubble* CreateBubble(WebContents* web_contents,
- SpeechInputBubble::Delegate* delegate,
- const gfx::Rect& element_rect) {
+ static SpeechRecognitionBubble* CreateBubble(
+ WebContents* web_contents,
+ SpeechRecognitionBubble::Delegate* delegate,
+ const gfx::Rect& element_rect) {
EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Set up to activate the bubble soon after it gets created, since we test
// events sent by the bubble and those are handled only when the bubble is
@@ -152,9 +156,10 @@ class SpeechInputBubbleControllerTest
// a valid WebContents.
TabContentsWrapper* wrapper =
test_fixture_->browser()->GetSelectedTabContentsWrapper();
- if (wrapper)
+ if (wrapper)
web_contents = wrapper->web_contents();
- return new MockSpeechInputBubble(web_contents, delegate, element_rect);
+ return new MockSpeechRecognitionBubble(web_contents, delegate,
+ element_rect);
}
protected:
@@ -164,25 +169,25 @@ class SpeechInputBubbleControllerTest
bool cancel_clicked_;
bool try_again_clicked_;
bool focus_changed_;
- scoped_refptr<SpeechInputBubbleController> controller_;
+ scoped_refptr<SpeechRecognitionBubbleController> controller_;
static const int kBubbleCallerId;
- static SpeechInputBubbleControllerTest* test_fixture_;
+ static SpeechRecognitionBubbleControllerTest* test_fixture_;
};
-SpeechInputBubbleControllerTest*
-SpeechInputBubbleControllerTest::test_fixture_ = NULL;
+SpeechRecognitionBubbleControllerTest*
+SpeechRecognitionBubbleControllerTest::test_fixture_ = NULL;
-const int SpeechInputBubbleControllerTest::kBubbleCallerId = 1;
+const int SpeechRecognitionBubbleControllerTest::kBubbleCallerId = 1;
-MockSpeechInputBubble::BubbleType MockSpeechInputBubble::type_ =
- MockSpeechInputBubble::BUBBLE_TEST_FOCUS_CHANGED;
+MockSpeechRecognitionBubble::BubbleType MockSpeechRecognitionBubble::type_ =
+ MockSpeechRecognitionBubble::BUBBLE_TEST_FOCUS_CHANGED;
// Test that the speech bubble UI gets created in the UI thread and that the
// focus changed callback comes back in the IO thread.
-TEST_F(SpeechInputBubbleControllerTest, TestFocusChanged) {
- MockSpeechInputBubble::set_type(
- MockSpeechInputBubble::BUBBLE_TEST_FOCUS_CHANGED);
+TEST_F(SpeechRecognitionBubbleControllerTest, TestFocusChanged) {
+ MockSpeechRecognitionBubble::set_type(
+ MockSpeechRecognitionBubble::BUBBLE_TEST_FOCUS_CHANGED);
controller_->CreateBubble(kBubbleCallerId, 1, 1, gfx::Rect(1, 1));
MessageLoop::current()->Run();
@@ -194,9 +199,9 @@ TEST_F(SpeechInputBubbleControllerTest, TestFocusChanged) {
// Test that the speech bubble UI gets created in the UI thread and that the
// recognition cancelled callback comes back in the IO thread.
-TEST_F(SpeechInputBubbleControllerTest, TestRecognitionCancelled) {
- MockSpeechInputBubble::set_type(
- MockSpeechInputBubble::BUBBLE_TEST_CLICK_CANCEL);
+TEST_F(SpeechRecognitionBubbleControllerTest, TestRecognitionCancelled) {
+ MockSpeechRecognitionBubble::set_type(
+ MockSpeechRecognitionBubble::BUBBLE_TEST_CLICK_CANCEL);
controller_->CreateBubble(kBubbleCallerId, 1, 1, gfx::Rect(1, 1));
MessageLoop::current()->Run();
@@ -208,9 +213,9 @@ TEST_F(SpeechInputBubbleControllerTest, TestRecognitionCancelled) {
// Test that the speech bubble UI gets created in the UI thread and that the
// try-again button click event comes back in the IO thread.
-TEST_F(SpeechInputBubbleControllerTest, TestTryAgainClicked) {
- MockSpeechInputBubble::set_type(
- MockSpeechInputBubble::BUBBLE_TEST_CLICK_TRY_AGAIN);
+TEST_F(SpeechRecognitionBubbleControllerTest, TestTryAgainClicked) {
+ MockSpeechRecognitionBubble::set_type(
+ MockSpeechRecognitionBubble::BUBBLE_TEST_CLICK_TRY_AGAIN);
controller_->CreateBubble(kBubbleCallerId, 1, 1, gfx::Rect(1, 1));
MessageLoop::current()->Run();
@@ -220,4 +225,4 @@ TEST_F(SpeechInputBubbleControllerTest, TestTryAgainClicked) {
controller_->CloseBubble(kBubbleCallerId);
}
-} // namespace speech_input
+} // namespace speech
diff --git a/chrome/browser/speech/speech_input_bubble_gtk.cc b/chrome/browser/speech/speech_recognition_bubble_gtk.cc
index a548bc1..816aa73 100644
--- a/chrome/browser/speech/speech_input_bubble_gtk.cc
+++ b/chrome/browser/speech/speech_recognition_bubble_gtk.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/speech/speech_input_bubble.h"
+#include "chrome/browser/speech/speech_recognition_bubble.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
@@ -15,7 +15,7 @@
#include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
#include "chrome/browser/ui/gtk/theme_service_gtk.h"
#include "content/public/browser/resource_context.h"
-#include "content/public/browser/speech_input_manager.h"
+#include "content/public/browser/speech_recognition_manager.h"
#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -38,18 +38,18 @@ const int kButtonBarHorizontalSpacing = 10;
// Use black for text labels since the bubble has white background.
const GdkColor& kLabelTextColor = ui::kGdkBlack;
-// Implementation of SpeechInputBubble for GTK. This shows a speech input bubble
-// on screen.
-class SpeechInputBubbleGtk : public SpeechInputBubbleBase,
- public BubbleDelegateGtk {
+// Implementation of SpeechRecognitionBubble for GTK. This shows a speech
+// recognition bubble on screen.
+class SpeechRecognitionBubbleGtk : public SpeechRecognitionBubbleBase,
+ public BubbleDelegateGtk {
public:
- SpeechInputBubbleGtk(WebContents* web_contents,
- Delegate* delegate,
- const gfx::Rect& element_rect);
- ~SpeechInputBubbleGtk();
+ SpeechRecognitionBubbleGtk(WebContents* web_contents,
+ Delegate* delegate,
+ const gfx::Rect& element_rect);
+ ~SpeechRecognitionBubbleGtk();
private:
- // SpeechInputBubbleBase:
+ // SpeechRecognitionBubbleBase:
virtual void Show() OVERRIDE;
virtual void Hide() OVERRIDE;
virtual void UpdateLayout() OVERRIDE;
@@ -58,9 +58,9 @@ class SpeechInputBubbleGtk : public SpeechInputBubbleBase,
// BubbleDelegateGtk:
virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE;
- CHROMEGTK_CALLBACK_0(SpeechInputBubbleGtk, void, OnCancelClicked);
- CHROMEGTK_CALLBACK_0(SpeechInputBubbleGtk, void, OnTryAgainClicked);
- CHROMEGTK_CALLBACK_0(SpeechInputBubbleGtk, void, OnMicSettingsClicked);
+ CHROMEGTK_CALLBACK_0(SpeechRecognitionBubbleGtk, void, OnCancelClicked);
+ CHROMEGTK_CALLBACK_0(SpeechRecognitionBubbleGtk, void, OnTryAgainClicked);
+ CHROMEGTK_CALLBACK_0(SpeechRecognitionBubbleGtk, void, OnMicSettingsClicked);
Delegate* delegate_;
BubbleGtk* bubble_;
@@ -74,13 +74,13 @@ class SpeechInputBubbleGtk : public SpeechInputBubbleBase,
GtkWidget* icon_container_;
GtkWidget* mic_settings_;
- DISALLOW_COPY_AND_ASSIGN(SpeechInputBubbleGtk);
+ DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionBubbleGtk);
};
-SpeechInputBubbleGtk::SpeechInputBubbleGtk(WebContents* web_contents,
- Delegate* delegate,
- const gfx::Rect& element_rect)
- : SpeechInputBubbleBase(web_contents),
+SpeechRecognitionBubbleGtk::SpeechRecognitionBubbleGtk(
+ WebContents* web_contents, Delegate* delegate,
+ const gfx::Rect& element_rect)
+ : SpeechRecognitionBubbleBase(web_contents),
delegate_(delegate),
bubble_(NULL),
element_rect_(element_rect),
@@ -93,7 +93,7 @@ SpeechInputBubbleGtk::SpeechInputBubbleGtk(WebContents* web_contents,
mic_settings_(NULL) {
}
-SpeechInputBubbleGtk::~SpeechInputBubbleGtk() {
+SpeechRecognitionBubbleGtk::~SpeechRecognitionBubbleGtk() {
// The |Close| call below invokes our |BubbleClosing| method. Since we were
// destroyed by the caller we don't need to call them back, hence set this
// flag here.
@@ -101,20 +101,20 @@ SpeechInputBubbleGtk::~SpeechInputBubbleGtk() {
Hide();
}
-void SpeechInputBubbleGtk::OnCancelClicked(GtkWidget* widget) {
+void SpeechRecognitionBubbleGtk::OnCancelClicked(GtkWidget* widget) {
delegate_->InfoBubbleButtonClicked(BUTTON_CANCEL);
}
-void SpeechInputBubbleGtk::OnTryAgainClicked(GtkWidget* widget) {
+void SpeechRecognitionBubbleGtk::OnTryAgainClicked(GtkWidget* widget) {
delegate_->InfoBubbleButtonClicked(BUTTON_TRY_AGAIN);
}
-void SpeechInputBubbleGtk::OnMicSettingsClicked(GtkWidget* widget) {
- content::SpeechInputManager::GetInstance()->ShowAudioInputSettings();
+void SpeechRecognitionBubbleGtk::OnMicSettingsClicked(GtkWidget* widget) {
+ content::SpeechRecognitionManager::GetInstance()->ShowAudioInputSettings();
Hide();
}
-void SpeechInputBubbleGtk::Show() {
+void SpeechRecognitionBubbleGtk::Show() {
if (bubble_)
return; // Nothing further to do since the bubble is already visible.
@@ -206,12 +206,12 @@ void SpeechInputBubbleGtk::Show() {
UpdateLayout();
}
-void SpeechInputBubbleGtk::Hide() {
+void SpeechRecognitionBubbleGtk::Hide() {
if (bubble_)
bubble_->Close();
}
-void SpeechInputBubbleGtk::UpdateLayout() {
+void SpeechRecognitionBubbleGtk::UpdateLayout() {
if (!bubble_)
return;
@@ -273,7 +273,7 @@ void SpeechInputBubbleGtk::UpdateLayout() {
}
}
-void SpeechInputBubbleGtk::UpdateImage() {
+void SpeechRecognitionBubbleGtk::UpdateImage() {
SkBitmap image = icon_image();
if (image.isNull() || !bubble_)
return;
@@ -283,8 +283,8 @@ void SpeechInputBubbleGtk::UpdateImage() {
g_object_unref(pixbuf);
}
-void SpeechInputBubbleGtk::BubbleClosing(BubbleGtk* bubble,
- bool closed_by_escape) {
+void SpeechRecognitionBubbleGtk::BubbleClosing(BubbleGtk* bubble,
+ bool closed_by_escape) {
bubble_ = NULL;
if (!did_invoke_close_)
delegate_->InfoBubbleFocusChanged();
@@ -292,9 +292,9 @@ void SpeechInputBubbleGtk::BubbleClosing(BubbleGtk* bubble,
} // namespace
-SpeechInputBubble* SpeechInputBubble::CreateNativeBubble(
+SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble(
WebContents* web_contents,
Delegate* delegate,
const gfx::Rect& element_rect) {
- return new SpeechInputBubbleGtk(web_contents, delegate, element_rect);
+ return new SpeechRecognitionBubbleGtk(web_contents, delegate, element_rect);
}
diff --git a/chrome/browser/speech/speech_input_bubble_mac.mm b/chrome/browser/speech/speech_recognition_bubble_mac.mm
index 53ea4b6..d8a7cbc 100644
--- a/chrome/browser/speech/speech_input_bubble_mac.mm
+++ b/chrome/browser/speech/speech_recognition_bubble_mac.mm
@@ -4,14 +4,14 @@
#import <Cocoa/Cocoa.h>
-#include "chrome/browser/speech/speech_input_bubble.h"
+#include "chrome/browser/speech/speech_recognition_bubble.h"
#import "base/memory/scoped_nsobject.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
#include "chrome/browser/ui/cocoa/browser_window_controller.h"
#include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
-#import "chrome/browser/ui/cocoa/speech_input_window_controller.h"
+#import "chrome/browser/ui/cocoa/speech_recognition_window_controller.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "skia/ext/skia_utils_mac.h"
@@ -21,44 +21,45 @@ using content::WebContents;
namespace {
// A class to bridge between the speech recognition C++ code and the Objective-C
-// bubble implementation. See chrome/browser/speech/speech_input_bubble.h for
-// more information on how this gets used.
-class SpeechInputBubbleImpl : public SpeechInputBubbleBase {
+// bubble implementation. See chrome/browser/speech/speech_recognition_bubble.h
+// for more information on how this gets used.
+class SpeechRecognitionBubbleImpl : public SpeechRecognitionBubbleBase {
public:
- SpeechInputBubbleImpl(WebContents* web_contents,
+ SpeechRecognitionBubbleImpl(WebContents* web_contents,
Delegate* delegate,
const gfx::Rect& element_rect);
- virtual ~SpeechInputBubbleImpl();
+ virtual ~SpeechRecognitionBubbleImpl();
virtual void Show();
virtual void Hide();
virtual void UpdateLayout();
virtual void UpdateImage();
private:
- scoped_nsobject<SpeechInputWindowController> window_;
+ scoped_nsobject<SpeechRecognitionWindowController> window_;
Delegate* delegate_;
gfx::Rect element_rect_;
};
-SpeechInputBubbleImpl::SpeechInputBubbleImpl(WebContents* web_contents,
- Delegate* delegate,
- const gfx::Rect& element_rect)
- : SpeechInputBubbleBase(web_contents),
+SpeechRecognitionBubbleImpl::SpeechRecognitionBubbleImpl(
+ WebContents* web_contents,
+ Delegate* delegate,
+ const gfx::Rect& element_rect)
+ : SpeechRecognitionBubbleBase(web_contents),
delegate_(delegate),
element_rect_(element_rect) {
}
-SpeechInputBubbleImpl::~SpeechInputBubbleImpl() {
+SpeechRecognitionBubbleImpl::~SpeechRecognitionBubbleImpl() {
if (window_.get())
[window_.get() close];
}
-void SpeechInputBubbleImpl::UpdateImage() {
+void SpeechRecognitionBubbleImpl::UpdateImage() {
if (window_.get())
[window_.get() setImage:gfx::SkBitmapToNSImage(icon_image())];
}
-void SpeechInputBubbleImpl::Show() {
+void SpeechRecognitionBubbleImpl::Show() {
if (window_.get()) {
[window_.get() show];
return;
@@ -88,7 +89,7 @@ void SpeechInputBubbleImpl::Show() {
anchor = [view convertPoint:anchor toView:nil];
anchor = [[view window] convertBaseToScreen:anchor];
- window_.reset([[SpeechInputWindowController alloc]
+ window_.reset([[SpeechRecognitionWindowController alloc]
initWithParentWindow:parentWindow
delegate:delegate_
anchoredAt:anchor]);
@@ -97,7 +98,7 @@ void SpeechInputBubbleImpl::Show() {
[window_.get() show];
}
-void SpeechInputBubbleImpl::Hide() {
+void SpeechRecognitionBubbleImpl::Hide() {
if (!window_.get())
return;
@@ -105,7 +106,7 @@ void SpeechInputBubbleImpl::Hide() {
window_.reset();
}
-void SpeechInputBubbleImpl::UpdateLayout() {
+void SpeechRecognitionBubbleImpl::UpdateLayout() {
if (!window_.get())
return;
@@ -116,10 +117,10 @@ void SpeechInputBubbleImpl::UpdateLayout() {
} // namespace
-SpeechInputBubble* SpeechInputBubble::CreateNativeBubble(
+SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble(
WebContents* web_contents,
Delegate* delegate,
const gfx::Rect& element_rect) {
- return new SpeechInputBubbleImpl(web_contents, delegate, element_rect);
+ return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect);
}
diff --git a/chrome/browser/speech/speech_input_bubble_views.cc b/chrome/browser/speech/speech_recognition_bubble_views.cc
index aa2a109..cb27738 100644
--- a/chrome/browser/speech/speech_input_bubble_views.cc
+++ b/chrome/browser/speech/speech_recognition_bubble_views.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/speech/speech_input_bubble.h"
+#include "chrome/browser/speech/speech_recognition_bubble.h"
#include <algorithm>
@@ -13,7 +13,7 @@
#include "chrome/browser/ui/views/toolbar_view.h"
#include "chrome/browser/ui/views/window.h"
#include "content/public/browser/resource_context.h"
-#include "content/public/browser/speech_input_manager.h"
+#include "content/public/browser/speech_recognition_manager.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "grit/generated_resources.h"
@@ -38,18 +38,18 @@ const int kBubbleHeadingVertMargin = 6;
const int kIconHorizontalOffset = 27;
const int kIconVerticalOffset = -7;
-// This is the SpeechInputBubble content and views bubble delegate.
-class SpeechInputBubbleView
+// This is the SpeechRecognitionBubble content and views bubble delegate.
+class SpeechRecognitionBubbleView
: public views::BubbleDelegateView,
public views::ButtonListener,
public views::LinkListener {
public:
- SpeechInputBubbleView(SpeechInputBubbleDelegate* delegate,
- views::View* anchor_view,
- const gfx::Rect& element_rect,
- WebContents* web_contents);
+ SpeechRecognitionBubbleView(SpeechRecognitionBubbleDelegate* delegate,
+ views::View* anchor_view,
+ const gfx::Rect& element_rect,
+ WebContents* web_contents);
- void UpdateLayout(SpeechInputBubbleBase::DisplayMode mode,
+ void UpdateLayout(SpeechRecognitionBubbleBase::DisplayMode mode,
const string16& message_text,
const SkBitmap& image);
void SetImage(const SkBitmap& image);
@@ -76,7 +76,7 @@ class SpeechInputBubbleView
}
private:
- SpeechInputBubbleDelegate* delegate_;
+ SpeechRecognitionBubbleDelegate* delegate_;
gfx::Rect element_rect_;
WebContents* web_contents_;
bool notify_delegate_on_activation_change_;
@@ -86,14 +86,14 @@ class SpeechInputBubbleView
views::TextButton* try_again_;
views::TextButton* cancel_;
views::Link* mic_settings_;
- SpeechInputBubbleBase::DisplayMode display_mode_;
+ SpeechRecognitionBubbleBase::DisplayMode display_mode_;
const int kIconLayoutMinWidth;
- DISALLOW_COPY_AND_ASSIGN(SpeechInputBubbleView);
+ DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionBubbleView);
};
-SpeechInputBubbleView::SpeechInputBubbleView(
- SpeechInputBubbleDelegate* delegate,
+SpeechRecognitionBubbleView::SpeechRecognitionBubbleView(
+ SpeechRecognitionBubbleDelegate* delegate,
views::View* anchor_view,
const gfx::Rect& element_rect,
WebContents* web_contents)
@@ -108,7 +108,7 @@ SpeechInputBubbleView::SpeechInputBubbleView(
try_again_(NULL),
cancel_(NULL),
mic_settings_(NULL),
- display_mode_(SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP),
+ display_mode_(SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP),
kIconLayoutMinWidth(ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_SPEECH_INPUT_MIC_EMPTY)->width()) {
// The bubble lifetime is managed by its controller; closing on escape or
@@ -117,14 +117,14 @@ SpeechInputBubbleView::SpeechInputBubbleView(
set_close_on_deactivate(false);
}
-void SpeechInputBubbleView::OnWidgetActivationChanged(views::Widget* widget,
- bool active) {
+void SpeechRecognitionBubbleView::OnWidgetActivationChanged(
+ views::Widget* widget, bool active) {
if (widget == GetWidget() && !active && notify_delegate_on_activation_change_)
delegate_->InfoBubbleFocusChanged();
BubbleDelegateView::OnWidgetActivationChanged(widget, active);
}
-gfx::Rect SpeechInputBubbleView::GetAnchorRect() {
+gfx::Rect SpeechRecognitionBubbleView::GetAnchorRect() {
gfx::Rect container_rect;
web_contents_->GetContainerBounds(&container_rect);
gfx::Rect anchor(element_rect_);
@@ -134,7 +134,7 @@ gfx::Rect SpeechInputBubbleView::GetAnchorRect() {
return anchor;
}
-void SpeechInputBubbleView::Init() {
+void SpeechRecognitionBubbleView::Init() {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont);
@@ -172,18 +172,20 @@ void SpeechInputBubbleView::Init() {
AddChildView(mic_settings_);
}
-void SpeechInputBubbleView::UpdateLayout(
- SpeechInputBubbleBase::DisplayMode mode,
+void SpeechRecognitionBubbleView::UpdateLayout(
+ SpeechRecognitionBubbleBase::DisplayMode mode,
const string16& message_text,
const SkBitmap& image) {
display_mode_ = mode;
- bool is_message = (mode == SpeechInputBubbleBase::DISPLAY_MODE_MESSAGE);
+ bool is_message = (mode == SpeechRecognitionBubbleBase::DISPLAY_MODE_MESSAGE);
icon_->SetVisible(!is_message);
message_->SetVisible(is_message);
mic_settings_->SetVisible(is_message);
try_again_->SetVisible(is_message);
- cancel_->SetVisible(mode != SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP);
- heading_->SetVisible(mode == SpeechInputBubbleBase::DISPLAY_MODE_RECORDING);
+ cancel_->SetVisible(
+ mode != SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP);
+ heading_->SetVisible(
+ mode == SpeechRecognitionBubbleBase::DISPLAY_MODE_RECORDING);
// Clickable elements should be enabled if and only if they are visible.
mic_settings_->SetEnabled(mic_settings_->visible());
@@ -208,27 +210,29 @@ void SpeechInputBubbleView::UpdateLayout(
SizeToContents();
}
-void SpeechInputBubbleView::SetImage(const SkBitmap& image) {
+void SpeechRecognitionBubbleView::SetImage(const SkBitmap& image) {
icon_->SetImage(image);
}
-void SpeechInputBubbleView::ButtonPressed(views::Button* source,
- const views::Event& event) {
+void SpeechRecognitionBubbleView::ButtonPressed(views::Button* source,
+ const views::Event& event) {
if (source == cancel_) {
- delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_CANCEL);
+ delegate_->InfoBubbleButtonClicked(SpeechRecognitionBubble::BUTTON_CANCEL);
} else if (source == try_again_) {
- delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_TRY_AGAIN);
+ delegate_->InfoBubbleButtonClicked(
+ SpeechRecognitionBubble::BUTTON_TRY_AGAIN);
} else {
NOTREACHED() << "Unknown button";
}
}
-void SpeechInputBubbleView::LinkClicked(views::Link* source, int event_flags) {
+void SpeechRecognitionBubbleView::LinkClicked(views::Link* source,
+ int event_flags) {
DCHECK_EQ(source, mic_settings_);
- content::SpeechInputManager::GetInstance()->ShowAudioInputSettings();
+ content::SpeechRecognitionManager::GetInstance()->ShowAudioInputSettings();
}
-gfx::Size SpeechInputBubbleView::GetPreferredSize() {
+gfx::Size SpeechRecognitionBubbleView::GetPreferredSize() {
int width = heading_->GetPreferredSize().width();
int control_width = cancel_->GetPreferredSize().width();
if (try_again_->visible()) {
@@ -261,7 +265,7 @@ gfx::Size SpeechInputBubbleView::GetPreferredSize() {
return gfx::Size(width, height);
}
-void SpeechInputBubbleView::Layout() {
+void SpeechRecognitionBubbleView::Layout() {
int x = kBubbleHorizMargin;
int y = kBubbleVertMargin;
int available_width = width() - kBubbleHorizMargin * 2;
@@ -292,7 +296,7 @@ void SpeechInputBubbleView::Layout() {
DCHECK(icon_->visible());
int control_height = icon_->GetImage().height();
- if (display_mode_ == SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP)
+ if (display_mode_ == SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP)
y = (available_height - control_height) / 2;
icon_->SetBounds(x, y, available_width, control_height);
y += control_height;
@@ -312,47 +316,47 @@ void SpeechInputBubbleView::Layout() {
}
}
-// Implementation of SpeechInputBubble.
-class SpeechInputBubbleImpl : public SpeechInputBubbleBase {
+// Implementation of SpeechRecognitionBubble.
+class SpeechRecognitionBubbleImpl : public SpeechRecognitionBubbleBase {
public:
- SpeechInputBubbleImpl(WebContents* web_contents,
+ SpeechRecognitionBubbleImpl(WebContents* web_contents,
Delegate* delegate,
const gfx::Rect& element_rect);
- virtual ~SpeechInputBubbleImpl();
+ virtual ~SpeechRecognitionBubbleImpl();
- // SpeechInputBubble methods.
+ // SpeechRecognitionBubble methods.
virtual void Show() OVERRIDE;
virtual void Hide() OVERRIDE;
- // SpeechInputBubbleBase methods.
+ // SpeechRecognitionBubbleBase methods.
virtual void UpdateLayout() OVERRIDE;
virtual void UpdateImage() OVERRIDE;
private:
Delegate* delegate_;
- SpeechInputBubbleView* bubble_;
+ SpeechRecognitionBubbleView* bubble_;
gfx::Rect element_rect_;
- DISALLOW_COPY_AND_ASSIGN(SpeechInputBubbleImpl);
+ DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionBubbleImpl);
};
-SpeechInputBubbleImpl::SpeechInputBubbleImpl(WebContents* web_contents,
- Delegate* delegate,
- const gfx::Rect& element_rect)
- : SpeechInputBubbleBase(web_contents),
+SpeechRecognitionBubbleImpl::SpeechRecognitionBubbleImpl(
+ WebContents* web_contents, Delegate* delegate,
+ const gfx::Rect& element_rect)
+ : SpeechRecognitionBubbleBase(web_contents),
delegate_(delegate),
bubble_(NULL),
element_rect_(element_rect) {
}
-SpeechInputBubbleImpl::~SpeechInputBubbleImpl() {
+SpeechRecognitionBubbleImpl::~SpeechRecognitionBubbleImpl() {
if (bubble_) {
bubble_->set_notify_delegate_on_activation_change(false);
bubble_->GetWidget()->Close();
}
}
-void SpeechInputBubbleImpl::Show() {
+void SpeechRecognitionBubbleImpl::Show() {
if (!bubble_) {
// Anchor to the location icon view, in case |element_rect| is offscreen.
Browser* browser = Browser::GetOrCreateTabbedBrowser(
@@ -360,34 +364,34 @@ void SpeechInputBubbleImpl::Show() {
BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
views::View* icon = browser_view->GetLocationBarView() ?
browser_view->GetLocationBarView()->location_icon_view() : NULL;
- bubble_ = new SpeechInputBubbleView(delegate_, icon, element_rect_,
- web_contents());
+ bubble_ = new SpeechRecognitionBubbleView(delegate_, icon, element_rect_,
+ web_contents());
browser::CreateViewsBubble(bubble_);
UpdateLayout();
}
bubble_->Show();
}
-void SpeechInputBubbleImpl::Hide() {
+void SpeechRecognitionBubbleImpl::Hide() {
if (bubble_)
bubble_->GetWidget()->Hide();
}
-void SpeechInputBubbleImpl::UpdateLayout() {
+void SpeechRecognitionBubbleImpl::UpdateLayout() {
if (bubble_)
bubble_->UpdateLayout(display_mode(), message_text(), icon_image());
}
-void SpeechInputBubbleImpl::UpdateImage() {
+void SpeechRecognitionBubbleImpl::UpdateImage() {
if (bubble_)
bubble_->SetImage(icon_image());
}
} // namespace
-SpeechInputBubble* SpeechInputBubble::CreateNativeBubble(
+SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble(
WebContents* web_contents,
- SpeechInputBubble::Delegate* delegate,
+ SpeechRecognitionBubble::Delegate* delegate,
const gfx::Rect& element_rect) {
- return new SpeechInputBubbleImpl(web_contents, delegate, element_rect);
+ return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect);
}
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 91b6908..2bf2ebe 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -68,7 +68,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
-#include "content/public/browser/speech_input_preferences.h"
+#include "content/public/browser/speech_recognition_preferences.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_restriction.h"
@@ -1415,7 +1415,7 @@ bool RenderViewContextMenu::IsCommandIdChecked(int id) const {
// Check box for menu item 'Block offensive words'.
if (id == IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES) {
return profile_->GetPrefs()->GetBoolean(
- prefs::kSpeechInputFilterProfanities);
+ prefs::kSpeechRecognitionFilterProfanities);
}
return false;
@@ -1851,9 +1851,9 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
case IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES: {
PrefService* prefs = profile_->GetPrefs();
const bool filter = !prefs->GetBoolean(
- prefs::kSpeechInputFilterProfanities);
- prefs->SetBoolean(prefs::kSpeechInputFilterProfanities, filter);
- profile_->GetSpeechInputPreferences()->SetFilterProfanities(filter);
+ prefs::kSpeechRecognitionFilterProfanities);
+ prefs->SetBoolean(prefs::kSpeechRecognitionFilterProfanities, filter);
+ profile_->GetSpeechRecognitionPreferences()->SetFilterProfanities(filter);
break;
}
diff --git a/chrome/browser/ui/cocoa/speech_input_window_controller.h b/chrome/browser/ui/cocoa/speech_recognition_window_controller.h
index c472ecc..5227dc94 100644
--- a/chrome/browser/ui/cocoa/speech_input_window_controller.h
+++ b/chrome/browser/ui/cocoa/speech_recognition_window_controller.h
@@ -1,22 +1,22 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_COCOA_SPEECH_INPUT_WINDOW_CONTROLLER_H_
-#define CHROME_BROWSER_UI_COCOA_SPEECH_INPUT_WINDOW_CONTROLLER_H_
+#ifndef CHROME_BROWSER_UI_COCOA_SPEECH_RECOGNITION_WINDOW_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_SPEECH_RECOGNITION_WINDOW_CONTROLLER_H_
#pragma once
#import <Cocoa/Cocoa.h>
-#include "chrome/browser/speech/speech_input_bubble.h"
+#include "chrome/browser/speech/speech_recognition_bubble.h"
#include "chrome/browser/ui/cocoa/base_bubble_controller.h"
-// Controller for the speech input bubble window. This bubble window gets
+// Controller for the speech recognition bubble window. This bubble window gets
// displayed when the user starts speech input in a html input element.
-@interface SpeechInputWindowController : BaseBubbleController {
+@interface SpeechRecognitionWindowController : BaseBubbleController {
@private
- SpeechInputBubble::Delegate* delegate_; // weak.
- SpeechInputBubbleBase::DisplayMode displayMode_;
+ SpeechRecognitionBubble::Delegate* delegate_; // weak.
+ SpeechRecognitionBubbleBase::DisplayMode displayMode_;
// References below are weak, being obtained from the nib.
IBOutlet NSImageView* iconImage_;
@@ -28,7 +28,7 @@
// Initialize the window. |anchoredAt| is in screen coordinates.
- (id)initWithParentWindow:(NSWindow*)parentWindow
- delegate:(SpeechInputBubbleDelegate*)delegate
+ delegate:(SpeechRecognitionBubbleDelegate*)delegate
anchoredAt:(NSPoint)anchoredAt;
// Handler for the cancel button.
@@ -41,23 +41,23 @@
- (IBAction)micSettings:(id)sender;
// Updates the UI with data related to the given display mode.
-- (void)updateLayout:(SpeechInputBubbleBase::DisplayMode)mode
+- (void)updateLayout:(SpeechRecognitionBubbleBase::DisplayMode)mode
messageText:(const string16&)messageText
iconImage:(NSImage*)iconImage;
-// Makes the speech input bubble visible on screen.
+// Makes the speech recognition bubble visible on screen.
- (void)show;
-// Hides the speech input bubble away from screen. This does NOT release the
-// controller and the window.
+// Hides the speech recognition bubble away from screen. This does NOT release
+// the controller and the window.
- (void)hide;
// Sets the image to be displayed in the bubble's status ImageView. A future
// call to updateLayout may change the image.
// TODO(satish): Clean that up and move it into the platform independent
-// SpeechInputBubbleBase class.
+// SpeechRecognitionBubbleBase class.
- (void)setImage:(NSImage*)image;
@end
-#endif // CHROME_BROWSER_UI_COCOA_SPEECH_INPUT_WINDOW_CONTROLLER_H_
+#endif // CHROME_BROWSER_UI_COCOA_SPEECH_RECOGNITION_WINDOW_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/speech_input_window_controller.mm b/chrome/browser/ui/cocoa/speech_recognition_window_controller.mm
index d692f6e..e5206a7 100644
--- a/chrome/browser/ui/cocoa/speech_input_window_controller.mm
+++ b/chrome/browser/ui/cocoa/speech_recognition_window_controller.mm
@@ -1,8 +1,8 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "speech_input_window_controller.h"
+#import "speech_recognition_window_controller.h"
#include "base/logging.h"
#include "base/sys_string_conversions.h"
@@ -19,23 +19,23 @@ const int kBubbleControlVerticalSpacing = 10; // Space between controls.
const int kBubbleHorizontalMargin = 5; // Space on either sides of controls.
const int kInstructionLabelMaxWidth = 150;
-@interface SpeechInputWindowController (Private)
+@interface SpeechRecognitionWindowController (Private)
- (NSSize)calculateContentSize;
- (void)layout:(NSSize)size;
@end
-@implementation SpeechInputWindowController
+@implementation SpeechRecognitionWindowController
- (id)initWithParentWindow:(NSWindow*)parentWindow
- delegate:(SpeechInputBubbleDelegate*)delegate
+ delegate:(SpeechRecognitionBubbleDelegate*)delegate
anchoredAt:(NSPoint)anchoredAt {
anchoredAt.y += info_bubble::kBubbleArrowHeight / 2.0;
- if ((self = [super initWithWindowNibPath:@"SpeechInputBubble"
+ if ((self = [super initWithWindowNibPath:@"SpeechRecognitionBubble"
parentWindow:parentWindow
anchoredAt:anchoredAt])) {
DCHECK(delegate);
delegate_ = delegate;
- displayMode_ = SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP;
+ displayMode_ = SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP;
}
return self;
}
@@ -46,11 +46,11 @@ const int kInstructionLabelMaxWidth = 150;
}
- (IBAction)cancel:(id)sender {
- delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_CANCEL);
+ delegate_->InfoBubbleButtonClicked(SpeechRecognitionBubble::BUTTON_CANCEL);
}
- (IBAction)tryAgain:(id)sender {
- delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_TRY_AGAIN);
+ delegate_->InfoBubbleButtonClicked(SpeechRecognitionBubble::BUTTON_TRY_AGAIN);
}
- (IBAction)micSettings:(id)sender {
@@ -76,7 +76,7 @@ const int kInstructionLabelMaxWidth = 150;
// recording mode, so from warm up it can transition to recording without any
// UI jank.
bool isWarmUp = (displayMode_ ==
- SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP);
+ SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP);
if (![iconImage_ isHidden]) {
NSSize size = [[iconImage_ image] size];
@@ -161,7 +161,7 @@ const int kInstructionLabelMaxWidth = 150;
if (![iconImage_ isHidden]) {
rect.size = [[iconImage_ image] size];
// In warm-up mode only the icon gets displayed so center it vertically.
- if (displayMode_ == SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP)
+ if (displayMode_ == SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP)
y = (size.height - rect.size.height) / 2;
rect.origin.x = (size.width - NSWidth(rect)) / 2;
rect.origin.y = y;
@@ -169,7 +169,7 @@ const int kInstructionLabelMaxWidth = 150;
}
}
-- (void)updateLayout:(SpeechInputBubbleBase::DisplayMode)mode
+- (void)updateLayout:(SpeechRecognitionBubbleBase::DisplayMode)mode
messageText:(const string16&)messageText
iconImage:(NSImage*)iconImage {
// The very first time this method is called, the child views would still be
@@ -177,9 +177,10 @@ const int kInstructionLabelMaxWidth = 150;
// the child views properly so we can do the layout calculations below.
NSWindow* window = [self window];
displayMode_ = mode;
- BOOL is_message = (mode == SpeechInputBubbleBase::DISPLAY_MODE_MESSAGE);
- BOOL is_recording = (mode == SpeechInputBubbleBase::DISPLAY_MODE_RECORDING);
- BOOL is_warm_up = (mode == SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP);
+ BOOL is_message = (mode == SpeechRecognitionBubbleBase::DISPLAY_MODE_MESSAGE);
+ BOOL is_recording =
+ (mode == SpeechRecognitionBubbleBase::DISPLAY_MODE_RECORDING);
+ BOOL is_warm_up = (mode == SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP);
[iconImage_ setHidden:is_message];
[tryAgainButton_ setHidden:!is_message];
[micSettingsButton_ setHidden:!is_message];
@@ -223,4 +224,4 @@ const int kInstructionLabelMaxWidth = 150;
[iconImage_ setImage:image];
}
-@end // implementation SpeechInputWindowController
+@end // implementation SpeechRecognitionWindowController
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index ddaebcd..b62a994 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2328,23 +2328,23 @@
'browser/signin/ubertoken_fetcher.cc',
'browser/signin/ubertoken_fetcher.h',
'browser/simple_message_box.h',
- 'browser/speech/chrome_speech_input_manager_delegate.cc',
- 'browser/speech/chrome_speech_input_manager_delegate.h',
- 'browser/speech/chrome_speech_input_preferences.cc',
- 'browser/speech/chrome_speech_input_preferences.h',
- 'browser/speech/speech_input_bubble.cc',
- 'browser/speech/speech_input_bubble.h',
- 'browser/speech/speech_input_bubble_controller.cc',
- 'browser/speech/speech_input_bubble_controller.h',
- 'browser/speech/speech_input_bubble_gtk.cc',
- 'browser/speech/speech_input_bubble_mac.mm',
- 'browser/speech/speech_input_bubble_views.cc',
+ 'browser/speech/chrome_speech_recognition_manager_delegate.cc',
+ 'browser/speech/chrome_speech_recognition_manager_delegate.h',
+ 'browser/speech/chrome_speech_recognition_preferences.cc',
+ 'browser/speech/chrome_speech_recognition_preferences.h',
'browser/speech/speech_input_extension_api.cc',
'browser/speech/speech_input_extension_api.h',
'browser/speech/speech_input_extension_manager.cc',
'browser/speech/speech_input_extension_manager.h',
'browser/speech/speech_input_extension_notification.cc',
'browser/speech/speech_input_extension_notification.h',
+ 'browser/speech/speech_recognition_bubble.cc',
+ 'browser/speech/speech_recognition_bubble.h',
+ 'browser/speech/speech_recognition_bubble_controller.cc',
+ 'browser/speech/speech_recognition_bubble_controller.h',
+ 'browser/speech/speech_recognition_bubble_gtk.cc',
+ 'browser/speech/speech_recognition_bubble_mac.mm',
+ 'browser/speech/speech_recognition_bubble_views.cc',
'browser/spellchecker/spellcheck_factory.cc',
'browser/spellchecker/spellcheck_factory.h',
'browser/spellchecker/spellcheck_host.cc',
@@ -3016,8 +3016,8 @@
'browser/ui/cocoa/restart_browser.mm',
'browser/ui/cocoa/select_file_dialog_mac.mm',
'browser/ui/cocoa/simple_message_box_mac.mm',
- 'browser/ui/cocoa/speech_input_window_controller.h',
- 'browser/ui/cocoa/speech_input_window_controller.mm',
+ 'browser/ui/cocoa/speech_recognition_window_controller.h',
+ 'browser/ui/cocoa/speech_recognition_window_controller.mm',
'browser/ui/cocoa/ssl_client_certificate_selector.mm',
'browser/ui/cocoa/status_bubble_mac.h',
'browser/ui/cocoa/status_bubble_mac.mm',
@@ -4935,7 +4935,7 @@
'app/nibs/MainMenu.xib',
'app/nibs/SadTab.xib',
'app/nibs/SaveAccessoryView.xib',
- 'app/nibs/SpeechInputBubble.xib',
+ 'app/nibs/SpeechRecognitionBubble.xib',
'app/nibs/TaskManager.xib',
'app/nibs/Toolbar.xib',
'app/nibs/WrenchMenu.xib',
@@ -5049,7 +5049,7 @@
['exclude', '^browser/extensions/extension_rlz_module'],
['include', 'browser/printing/print_dialog_cloud.cc'],
['include', 'browser/printing/print_dialog_cloud.h'],
- ['include', '^browser/speech/speech_input_bubble_views.cc'],
+ ['include', '^browser/speech/speech_recognition_bubble_views.cc'],
# Exclude all of browser/ui/gtk, then include the things we want.
['exclude', '^browser/ui/gtk'],
@@ -5339,7 +5339,7 @@
['exclude', '^browser/extensions/extension_host_mac.mm'],
['exclude', '^browser/extensions/external_registry_extension_loader_win.cc'],
['exclude', '^browser/extensions/external_registry_extension_loader_win.h'],
- ['exclude', '^browser/speech/speech_input_bubble_gtk.cc'],
+ ['exclude', '^browser/speech/speech_recognition_bubble_gtk.cc'],
['exclude', '^browser/tab_contents/render_view_context_menu_gtk.cc'],
['exclude', '^browser/tab_contents/render_view_context_menu_gtk.h'],
['exclude', '^browser/tab_contents/tab_contents_view_gtk.cc'],
diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi
index db5160e..1c158d5 100644
--- a/chrome/chrome_dll.gypi
+++ b/chrome/chrome_dll.gypi
@@ -276,7 +276,7 @@
'app/nibs/PreviewableContents.xib',
'app/nibs/SaveAccessoryView.xib',
'app/nibs/SadTab.xib',
- 'app/nibs/SpeechInputBubble.xib',
+ 'app/nibs/SpeechRecognitionBubble.xib',
'app/nibs/TabView.xib',
'app/nibs/TaskManager.xib',
'app/nibs/Toolbar.xib',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index c06e2c2..34b128e 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1723,7 +1723,7 @@
'browser/signin/token_service_unittest.cc',
'browser/signin/token_service_unittest.h',
'browser/signin/ubertoken_fetcher_unittest.cc',
- 'browser/speech/speech_input_bubble_controller_unittest.cc',
+ 'browser/speech/speech_recognition_bubble_controller_unittest.cc',
'browser/spellchecker/spellcheck_platform_mac_unittest.cc',
'browser/spellchecker/spellcheck_profile_unittest.cc',
'browser/status_icons/status_icon_unittest.cc',
@@ -2754,8 +2754,8 @@
'browser/service/service_process_control_browsertest.cc',
'browser/sessions/session_restore_browsertest.cc',
'browser/sessions/tab_restore_service_browsertest.cc',
- 'browser/speech/speech_input_bubble_browsertest.cc',
'browser/speech/speech_input_extension_apitest.cc',
+ 'browser/speech/speech_recognition_bubble_browsertest.cc',
'browser/spellchecker/spellcheck_host_browsertest.cc',
'browser/ssl/ssl_browser_tests.cc',
'browser/tab_contents/render_view_context_menu_browsertest.cc',
@@ -2894,7 +2894,7 @@
'../content/browser/renderer_host/render_view_host_browsertest.cc',
'../content/browser/renderer_host/render_view_host_manager_browsertest.cc',
'../content/browser/renderer_host/resource_dispatcher_host_browsertest.cc',
- '../content/browser/speech/speech_input_browsertest.cc',
+ '../content/browser/speech/speech_recognition_browsertest.cc',
'../content/browser/webkit_browsertest.cc',
'../content/renderer/mouse_lock_dispatcher_browsertest.cc',
'../content/renderer/render_view_browsertest.cc',
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 9401963..8d1cc80 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -691,7 +691,7 @@ const char kEnableAutoSpellCorrect[] = "browser.enable_autospellcorrect";
// Boolean pref to define the default setting for "block offensive words".
// The old key value is kept to avoid unnecessary migration code.
-const char kSpeechInputFilterProfanities[] =
+const char kSpeechRecognitionFilterProfanities[] =
"browser.speechinput_censor_results";
// Boolean pref to determine if the tray notification balloon for speech input
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index bc6e009..021fb2d4 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -250,8 +250,8 @@ extern const char kDeleteCookies[];
extern const char kDeletePasswords[];
extern const char kDeleteFormData[];
extern const char kEnableSpellCheck[];
-extern const char kSpeechInputFilterProfanities[];
extern const char kSpeechInputTrayNotificationShown[];
+extern const char kSpeechRecognitionFilterProfanities[];
extern const char kEnabledLabsExperiments[];
extern const char kEnableAutoSpellCorrect[];
extern const char kSavingBrowserHistoryDisabled[];
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 54d7605..930fa98a 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -36,7 +36,7 @@
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/signin/token_service.h"
-#include "chrome/browser/speech/chrome_speech_input_preferences.h"
+#include "chrome/browser/speech/chrome_speech_recognition_preferences.h"
#include "chrome/browser/sync/profile_sync_service_mock.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/common/chrome_constants.h"
@@ -651,11 +651,13 @@ TestingProfile::GetGeolocationPermissionContext() {
return geolocation_permission_context_.get();
}
-content::SpeechInputPreferences* TestingProfile::GetSpeechInputPreferences() {
+content::SpeechRecognitionPreferences*
+ TestingProfile::GetSpeechRecognitionPreferences() {
#if defined(ENABLE_INPUT_SPEECH)
- if (!speech_input_preferences_.get())
- speech_input_preferences_ = new ChromeSpeechInputPreferences(GetPrefs());
- return speech_input_preferences_.get();
+ if (!speech_recognition_preferences_.get())
+ speech_recognition_preferences_ =
+ new ChromeSpeechRecognitionPreferences(GetPrefs());
+ return speech_recognition_preferences_.get();
#else
return NULL;
#endif
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h
index 0ba2120..1088970 100644
--- a/chrome/test/base/testing_profile.h
+++ b/chrome/test/base/testing_profile.h
@@ -17,7 +17,7 @@
namespace content {
class MockResourceContext;
-class SpeechInputPreferences;
+class SpeechRecognitionPreferences;
}
namespace history {
@@ -165,7 +165,8 @@ class TestingProfile : public Profile {
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
virtual content::GeolocationPermissionContext*
GetGeolocationPermissionContext() OVERRIDE;
- virtual content::SpeechInputPreferences* GetSpeechInputPreferences() OVERRIDE;
+ virtual content::SpeechRecognitionPreferences*
+ GetSpeechRecognitionPreferences() OVERRIDE;
virtual bool DidLastSessionExitCleanly() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
@@ -351,7 +352,8 @@ class TestingProfile : public Profile {
scoped_refptr<content::GeolocationPermissionContext>
geolocation_permission_context_;
- scoped_refptr<content::SpeechInputPreferences> speech_input_preferences_;
+ scoped_refptr<content::SpeechRecognitionPreferences>
+ speech_recognition_preferences_;
FilePath last_selected_directory_;
scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails.