summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profiles
diff options
context:
space:
mode:
authorallanwoj@chromium.org <allanwoj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-29 15:13:01 +0000
committerallanwoj@chromium.org <allanwoj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-29 15:13:01 +0000
commit8238dd6190819daade7ee98f669e23a5a56ee4fa (patch)
tree09debefb10323f762ccdf5b94c5722ea77b60d5d /chrome/browser/profiles
parent8cc6e41efa5af14f403cbb14b15e3af8ea686c93 (diff)
downloadchromium_src-8238dd6190819daade7ee98f669e23a5a56ee4fa.zip
chromium_src-8238dd6190819daade7ee98f669e23a5a56ee4fa.tar.gz
chromium_src-8238dd6190819daade7ee98f669e23a5a56ee4fa.tar.bz2
Remove use of default request context and fix use of speech censor flag
Now gets the request context and censor preference in BrowserRenderProcessHost and passes them through to the SpeechInputDispatcherHost. Each time a speech request is made, the SpeechInputDispatcherHost passes through these values to the SpeechInputManager. Also each time the censor preference changes, RenderViewContextMenu updates the current profile's SpeechInputPreferences. BUG=92366 TEST=Speech recognition works. Review URL: http://codereview.chromium.org/7989001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103278 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profiles')
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.cc4
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.h1
-rw-r--r--chrome/browser/profiles/profile.h2
-rw-r--r--chrome/browser/profiles/profile_impl.cc19
-rw-r--r--chrome/browser/profiles/profile_impl.h172
5 files changed, 110 insertions, 88 deletions
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index 8812a27..177df04 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -421,6 +421,10 @@ GeolocationPermissionContext*
return profile_->GetGeolocationPermissionContext();
}
+SpeechInputPreferences* OffTheRecordProfileImpl::GetSpeechInputPreferences() {
+ return profile_->GetSpeechInputPreferences();
+}
+
UserStyleSheetWatcher* OffTheRecordProfileImpl::GetUserStyleSheetWatcher() {
return profile_->GetUserStyleSheetWatcher();
}
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h
index ab54947..9f7dea4 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.h
+++ b/chrome/browser/profiles/off_the_record_profile_impl.h
@@ -83,6 +83,7 @@ class OffTheRecordProfileImpl : public Profile,
virtual HostZoomMap* GetHostZoomMap() OVERRIDE;
virtual GeolocationPermissionContext*
GetGeolocationPermissionContext() OVERRIDE;
+ virtual SpeechInputPreferences* GetSpeechInputPreferences() OVERRIDE;
virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() OVERRIDE;
virtual FindBarState* GetFindBarState() OVERRIDE;
virtual bool HasProfileSyncService() const OVERRIDE;
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h
index 45f1447..337b8ab 100644
--- a/chrome/browser/profiles/profile.h
+++ b/chrome/browser/profiles/profile.h
@@ -84,6 +84,7 @@ class PromoResourceService;
class ProtocolHandlerRegistry;
class SQLitePersistentCookieStore;
class SSLConfigServiceManager;
+class SpeechInputPreferences;
class SpellCheckHost;
class TemplateURLFetcher;
class TokenService;
@@ -203,6 +204,7 @@ class Profile : public content::BrowserContext {
virtual const content::ResourceContext& GetResourceContext() = 0;
virtual HostZoomMap* GetHostZoomMap() = 0;
virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0;
+ virtual SpeechInputPreferences* GetSpeechInputPreferences() = 0;
virtual quota::QuotaManager* GetQuotaManager() = 0;
virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0;
virtual WebKitContext* GetWebKitContext() = 0;
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 481b2ef..6c9deb5 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -64,6 +64,7 @@
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/speech/chrome_speech_input_manager.h"
+#include "chrome/browser/speech/chrome_speech_input_preferences.h"
#include "chrome/browser/spellchecker/spellcheck_profile.h"
#include "chrome/browser/sync/profile_sync_factory_impl.h"
#include "chrome/browser/sync/profile_sync_service.h"
@@ -447,9 +448,6 @@ void ProfileImpl::DoFinalInit() {
GetSpellCheckProfile()->StartRecordingMetrics(
GetPrefs()->GetBoolean(prefs::kEnableSpellCheck));
- speech_input::ChromeSpeechInputManager::GetInstance()->set_censor_results(
- prefs->GetBoolean(prefs::kSpeechInputCensorResults));
-
FilePath cookie_path = GetPath();
cookie_path = cookie_path.Append(chrome::kCookieFilename);
FilePath origin_bound_cert_path = GetPath();
@@ -1089,12 +1087,20 @@ HostZoomMap* ProfileImpl::GetHostZoomMap() {
}
GeolocationPermissionContext* ProfileImpl::GetGeolocationPermissionContext() {
- if (!geolocation_permission_context_.get())
+ if (!geolocation_permission_context_.get()) {
geolocation_permission_context_ =
new ChromeGeolocationPermissionContext(this);
+ }
return geolocation_permission_context_.get();
}
+SpeechInputPreferences* ProfileImpl::GetSpeechInputPreferences() {
+ if (!speech_input_preferences_.get()) {
+ speech_input_preferences_ = new ChromeSpeechInputPreferences(GetPrefs());
+ }
+ return speech_input_preferences_.get();
+}
+
UserStyleSheetWatcher* ProfileImpl::GetUserStyleSheetWatcher() {
if (!user_style_sheet_watcher_.get()) {
user_style_sheet_watcher_ = new UserStyleSheetWatcher(GetPath());
@@ -1492,9 +1498,8 @@ void ProfileImpl::Observe(int type,
process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled));
}
} else if (*pref_name_in == prefs::kSpeechInputCensorResults) {
- speech_input::ChromeSpeechInputManager::GetInstance()->
- set_censor_results(prefs->GetBoolean(
- prefs::kSpeechInputCensorResults));
+ GetSpeechInputPreferences()->set_censor_results(prefs->GetBoolean(
+ prefs::kSpeechInputCensorResults));
} else if (*pref_name_in == prefs::kClearSiteDataOnExit) {
clear_local_state_on_exit_ =
prefs->GetBoolean(prefs::kClearSiteDataOnExit);
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index 80a476d..c538eac 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -25,6 +25,7 @@ class ExtensionPrefValueMap;
class ExtensionSettings;
class NetPrefObserver;
class PrefService;
+class SpeechInputPreferences;
class SpellCheckProfile;
#if defined(OS_CHROMEOS)
@@ -43,101 +44,109 @@ class ProfileImpl : public Profile,
static void RegisterUserPrefs(PrefService* prefs);
- // Profile implementation.
- virtual std::string GetProfileName();
- virtual FilePath GetPath();
- virtual bool IsOffTheRecord();
- virtual Profile* GetOffTheRecordProfile();
- virtual void DestroyOffTheRecordProfile();
- virtual bool HasOffTheRecordProfile();
- virtual Profile* GetOriginalProfile();
- virtual ChromeAppCacheService* GetAppCacheService();
- virtual webkit_database::DatabaseTracker* GetDatabaseTracker();
- virtual history::TopSites* GetTopSites();
- virtual history::TopSites* GetTopSitesWithoutCreating();
- virtual VisitedLinkMaster* GetVisitedLinkMaster();
- virtual UserScriptMaster* GetUserScriptMaster();
- virtual SSLHostState* GetSSLHostState();
- virtual ExtensionService* GetExtensionService();
- virtual ExtensionDevToolsManager* GetExtensionDevToolsManager();
- virtual ExtensionProcessManager* GetExtensionProcessManager();
- virtual ExtensionMessageService* GetExtensionMessageService();
- virtual ExtensionEventRouter* GetExtensionEventRouter();
- virtual ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy();
- virtual FaviconService* GetFaviconService(ServiceAccessType sat);
- virtual HistoryService* GetHistoryService(ServiceAccessType sat);
- virtual HistoryService* GetHistoryServiceWithoutCreating();
- virtual AutocompleteClassifier* GetAutocompleteClassifier();
- virtual history::ShortcutsBackend* GetShortcutsBackend();
- virtual WebDataService* GetWebDataService(ServiceAccessType sat);
- virtual WebDataService* GetWebDataServiceWithoutCreating();
- virtual PasswordStore* GetPasswordStore(ServiceAccessType sat);
- virtual PrefService* GetPrefs();
- virtual PrefService* GetOffTheRecordPrefs();
- virtual TemplateURLFetcher* GetTemplateURLFetcher();
- virtual DownloadManager* GetDownloadManager();
- virtual fileapi::FileSystemContext* GetFileSystemContext();
- virtual quota::QuotaManager* GetQuotaManager();
- virtual bool HasCreatedDownloadManager() const;
- virtual net::URLRequestContextGetter* GetRequestContext();
+ // content::BrowserContext implementation:
+ virtual FilePath GetPath() OVERRIDE;
+ virtual SSLHostState* GetSSLHostState() OVERRIDE;
+ virtual DownloadManager* GetDownloadManager() OVERRIDE;
+ virtual bool HasCreatedDownloadManager() const OVERRIDE;
+ virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
- int renderer_child_id);
- virtual net::URLRequestContextGetter* GetRequestContextForMedia();
- virtual net::URLRequestContextGetter* GetRequestContextForExtensions();
+ int renderer_child_id) OVERRIDE;
+ virtual net::URLRequestContextGetter* GetRequestContextForMedia() OVERRIDE;
+ virtual const content::ResourceContext& GetResourceContext() OVERRIDE;
+ virtual HostZoomMap* GetHostZoomMap() OVERRIDE;
+ virtual GeolocationPermissionContext*
+ GetGeolocationPermissionContext() OVERRIDE;
+ virtual SpeechInputPreferences* GetSpeechInputPreferences() OVERRIDE;
+ virtual quota::QuotaManager* GetQuotaManager() OVERRIDE;
+ virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE;
+ virtual WebKitContext* GetWebKitContext() OVERRIDE;
+ virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE;
+ virtual ChromeBlobStorageContext* GetBlobStorageContext() OVERRIDE;
+ virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE;
+
+ // Profile implementation:
+ virtual std::string GetProfileName() OVERRIDE;
+ virtual bool IsOffTheRecord() OVERRIDE;
+ virtual Profile* GetOffTheRecordProfile() OVERRIDE;
+ virtual void DestroyOffTheRecordProfile() OVERRIDE;
+ virtual bool HasOffTheRecordProfile() OVERRIDE;
+ virtual Profile* GetOriginalProfile() OVERRIDE;
+ virtual history::TopSites* GetTopSites() OVERRIDE;
+ virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE;
+ virtual VisitedLinkMaster* GetVisitedLinkMaster() OVERRIDE;
+ virtual UserScriptMaster* GetUserScriptMaster() OVERRIDE;
+ virtual ExtensionService* GetExtensionService() OVERRIDE;
+ virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() OVERRIDE;
+ virtual ExtensionProcessManager* GetExtensionProcessManager() OVERRIDE;
+ virtual ExtensionMessageService* GetExtensionMessageService() OVERRIDE;
+ virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE;
+ virtual ExtensionSpecialStoragePolicy*
+ GetExtensionSpecialStoragePolicy() OVERRIDE;
+ virtual FaviconService* GetFaviconService(ServiceAccessType sat) OVERRIDE;
+ virtual HistoryService* GetHistoryService(ServiceAccessType sat) OVERRIDE;
+ virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE;
+ virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE;
+ virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE;
+ virtual WebDataService* GetWebDataService(ServiceAccessType sat) OVERRIDE;
+ virtual WebDataService* GetWebDataServiceWithoutCreating() OVERRIDE;
+ virtual PasswordStore* GetPasswordStore(ServiceAccessType sat) OVERRIDE;
+ virtual PrefService* GetPrefs() OVERRIDE;
+ virtual PrefService* GetOffTheRecordPrefs() OVERRIDE;
+ virtual TemplateURLFetcher* GetTemplateURLFetcher() OVERRIDE;
+ virtual net::URLRequestContextGetter*
+ GetRequestContextForExtensions() OVERRIDE;
virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp(
- const std::string& app_id);
- virtual const content::ResourceContext& GetResourceContext();
- virtual void RegisterExtensionWithRequestContexts(const Extension* extension);
+ const std::string& app_id) OVERRIDE;
+ virtual void RegisterExtensionWithRequestContexts(
+ const Extension* extension) OVERRIDE;
virtual void UnregisterExtensionWithRequestContexts(
const std::string& extension_id,
- const extension_misc::UnloadedExtensionReason reason);
- virtual net::SSLConfigService* GetSSLConfigService();
- virtual HostContentSettingsMap* GetHostContentSettingsMap();
- virtual HostZoomMap* GetHostZoomMap();
- virtual GeolocationPermissionContext* GetGeolocationPermissionContext();
- virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher();
- virtual FindBarState* GetFindBarState();
- virtual bool HasProfileSyncService() const;
- virtual bool DidLastSessionExitCleanly();
- virtual BookmarkModel* GetBookmarkModel();
- virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry();
- virtual bool IsSameProfile(Profile* profile);
- virtual base::Time GetStartTime() const;
- virtual SpellCheckHost* GetSpellCheckHost();
- virtual void ReinitializeSpellCheckHost(bool force);
- virtual WebKitContext* GetWebKitContext();
- virtual void MarkAsCleanShutdown();
- virtual void InitExtensions(bool extensions_enabled);
- virtual void InitPromoResources();
- virtual void InitRegisteredProtocolHandlers();
- virtual FilePath last_selected_directory();
- virtual void set_last_selected_directory(const FilePath& path);
- virtual ProfileSyncService* GetProfileSyncService();
+ const extension_misc::UnloadedExtensionReason reason) OVERRIDE;
+ virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE;
+ virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE;
+ virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() OVERRIDE;
+ virtual FindBarState* GetFindBarState() OVERRIDE;
+ virtual bool HasProfileSyncService() const OVERRIDE;
+ virtual bool DidLastSessionExitCleanly() OVERRIDE;
+ virtual BookmarkModel* GetBookmarkModel() OVERRIDE;
+ virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE;
+ virtual bool IsSameProfile(Profile* profile) OVERRIDE;
+ virtual base::Time GetStartTime() const OVERRIDE;
+ virtual SpellCheckHost* GetSpellCheckHost() OVERRIDE;
+ virtual void ReinitializeSpellCheckHost(bool force) OVERRIDE;
+ virtual void MarkAsCleanShutdown() OVERRIDE;
+ virtual void InitExtensions(bool extensions_enabled) OVERRIDE;
+ virtual void InitPromoResources() OVERRIDE;
+ virtual void InitRegisteredProtocolHandlers() OVERRIDE;
+ virtual FilePath last_selected_directory() OVERRIDE;
+ virtual void set_last_selected_directory(const FilePath& path) OVERRIDE;
+ virtual ProfileSyncService* GetProfileSyncService() OVERRIDE;
virtual ProfileSyncService* GetProfileSyncService(
- const std::string& cros_user);
- virtual TokenService* GetTokenService();
+ const std::string& cros_user) OVERRIDE;
+ virtual TokenService* GetTokenService() OVERRIDE;
void InitSyncService(const std::string& cros_user);
- virtual ChromeBlobStorageContext* GetBlobStorageContext();
- virtual ExtensionInfoMap* GetExtensionInfoMap();
- virtual PromoCounter* GetInstantPromoCounter();
- virtual ChromeURLDataManager* GetChromeURLDataManager();
- virtual chrome_browser_net::Predictor* GetNetworkPredictor();
- virtual void DeleteTransportSecurityStateSince(base::Time time);
+ virtual ExtensionInfoMap* GetExtensionInfoMap() OVERRIDE;
+ virtual PromoCounter* GetInstantPromoCounter() OVERRIDE;
+ virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE;
+ virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE;
+ virtual void DeleteTransportSecurityStateSince(base::Time time) OVERRIDE;
#if defined(OS_CHROMEOS)
- virtual void ChangeAppLocale(const std::string& locale, AppLocaleChangedVia);
- virtual void OnLogin();
- virtual void SetupChromeOSEnterpriseExtensionObserver();
- virtual void InitChromeOSPreferences();
+ virtual void ChangeAppLocale(const std::string& locale,
+ AppLocaleChangedVia) OVERRIDE;
+ virtual void OnLogin() OVERRIDE;
+ virtual void SetupChromeOSEnterpriseExtensionObserver() OVERRIDE;
+ virtual void InitChromeOSPreferences() OVERRIDE;
#endif // defined(OS_CHROMEOS)
- virtual PrefProxyConfigTracker* GetProxyConfigTracker();
- virtual prerender::PrerenderManager* GetPrerenderManager();
+ virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE;
+ virtual prerender::PrerenderManager* GetPrerenderManager() OVERRIDE;
// NotificationObserver implementation.
virtual void Observe(int type,
const NotificationSource& source,
- const NotificationDetails& details);
+ const NotificationDetails& details) OVERRIDE;
private:
friend class Profile;
@@ -224,6 +233,7 @@ class ProfileImpl : public Profile,
scoped_refptr<HostZoomMap> host_zoom_map_;
scoped_refptr<GeolocationPermissionContext>
geolocation_permission_context_;
+ scoped_refptr<SpeechInputPreferences> speech_input_preferences_;
scoped_refptr<UserStyleSheetWatcher> user_style_sheet_watcher_;
scoped_ptr<FindBarState> find_bar_state_;
scoped_refptr<ChromeDownloadManagerDelegate> download_manager_delegate_;