OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 64 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
65 #include "chrome/browser/prerender/prerender_manager_factory.h" | 65 #include "chrome/browser/prerender/prerender_manager_factory.h" |
66 #include "chrome/browser/profiles/gaia_info_update_service.h" | 66 #include "chrome/browser/profiles/gaia_info_update_service.h" |
67 #include "chrome/browser/profiles/profile_dependency_manager.h" | 67 #include "chrome/browser/profiles/profile_dependency_manager.h" |
68 #include "chrome/browser/profiles/profile_info_cache.h" | 68 #include "chrome/browser/profiles/profile_info_cache.h" |
69 #include "chrome/browser/profiles/profile_manager.h" | 69 #include "chrome/browser/profiles/profile_manager.h" |
70 #include "chrome/browser/search_engines/template_url_fetcher.h" | 70 #include "chrome/browser/search_engines/template_url_fetcher.h" |
71 #include "chrome/browser/search_engines/template_url_service.h" | 71 #include "chrome/browser/search_engines/template_url_service.h" |
72 #include "chrome/browser/sessions/session_service_factory.h" | 72 #include "chrome/browser/sessions/session_service_factory.h" |
73 #include "chrome/browser/signin/token_service.h" | 73 #include "chrome/browser/signin/token_service.h" |
74 #include "chrome/browser/speech/chrome_speech_input_preferences.h" | 74 #include "chrome/browser/speech/chrome_speech_recognition_preferences.h" |
75 #include "chrome/browser/sync/profile_sync_service_factory.h" | 75 #include "chrome/browser/sync/profile_sync_service_factory.h" |
76 #include "chrome/browser/transport_security_persister.h" | 76 #include "chrome/browser/transport_security_persister.h" |
77 #include "chrome/browser/ui/browser_init.h" | 77 #include "chrome/browser/ui/browser_init.h" |
78 #include "chrome/browser/ui/browser_list.h" | 78 #include "chrome/browser/ui/browser_list.h" |
79 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 79 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
80 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 80 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
81 #include "chrome/browser/user_style_sheet_watcher.h" | 81 #include "chrome/browser/user_style_sheet_watcher.h" |
82 #include "chrome/browser/visitedlink/visitedlink_event_listener.h" | 82 #include "chrome/browser/visitedlink/visitedlink_event_listener.h" |
83 #include "chrome/browser/visitedlink/visitedlink_master.h" | 83 #include "chrome/browser/visitedlink/visitedlink_master.h" |
84 #include "chrome/browser/web_resource/promo_resource_service.h" | 84 #include "chrome/browser/web_resource/promo_resource_service.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 GetPrefFilePath(), | 276 GetPrefFilePath(), |
277 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), | 277 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), |
278 false)); | 278 false)); |
279 OnPrefsLoaded(true); | 279 OnPrefsLoaded(true); |
280 } | 280 } |
281 } | 281 } |
282 | 282 |
283 void ProfileImpl::DoFinalInit() { | 283 void ProfileImpl::DoFinalInit() { |
284 PrefService* prefs = GetPrefs(); | 284 PrefService* prefs = GetPrefs(); |
285 pref_change_registrar_.Init(prefs); | 285 pref_change_registrar_.Init(prefs); |
286 pref_change_registrar_.Add(prefs::kSpeechInputFilterProfanities, this); | 286 pref_change_registrar_.Add(prefs::kSpeechRecognitionFilterProfanities, this); |
287 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); | 287 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); |
288 pref_change_registrar_.Add(prefs::kGoogleServicesUsername, this); | 288 pref_change_registrar_.Add(prefs::kGoogleServicesUsername, this); |
289 pref_change_registrar_.Add(prefs::kDefaultZoomLevel, this); | 289 pref_change_registrar_.Add(prefs::kDefaultZoomLevel, this); |
290 pref_change_registrar_.Add(prefs::kProfileAvatarIndex, this); | 290 pref_change_registrar_.Add(prefs::kProfileAvatarIndex, this); |
291 pref_change_registrar_.Add(prefs::kProfileName, this); | 291 pref_change_registrar_.Add(prefs::kProfileName, this); |
292 | 292 |
293 // It would be nice to use PathService for fetching this directory, but | 293 // It would be nice to use PathService for fetching this directory, but |
294 // the cache directory depends on the profile directory, which isn't available | 294 // the cache directory depends on the profile directory, which isn't available |
295 // to PathService. | 295 // to PathService. |
296 chrome::GetUserCacheDirectory(path_, &base_cache_path_); | 296 chrome::GetUserCacheDirectory(path_, &base_cache_path_); |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 | 884 |
885 content::GeolocationPermissionContext* | 885 content::GeolocationPermissionContext* |
886 ProfileImpl::GetGeolocationPermissionContext() { | 886 ProfileImpl::GetGeolocationPermissionContext() { |
887 if (!geolocation_permission_context_.get()) { | 887 if (!geolocation_permission_context_.get()) { |
888 geolocation_permission_context_ = | 888 geolocation_permission_context_ = |
889 new ChromeGeolocationPermissionContext(this); | 889 new ChromeGeolocationPermissionContext(this); |
890 } | 890 } |
891 return geolocation_permission_context_.get(); | 891 return geolocation_permission_context_.get(); |
892 } | 892 } |
893 | 893 |
894 content::SpeechInputPreferences* ProfileImpl::GetSpeechInputPreferences() { | 894 content::SpeechRecognitionPreferences* |
| 895 ProfileImpl::GetSpeechRecognitionPreferences() { |
895 #if defined(ENABLE_INPUT_SPEECH) | 896 #if defined(ENABLE_INPUT_SPEECH) |
896 if (!speech_input_preferences_.get()) { | 897 if (!speech_recognition_preferences_.get()) { |
897 speech_input_preferences_ = new ChromeSpeechInputPreferences(GetPrefs()); | 898 speech_recognition_preferences_ = |
| 899 new ChromeSpeechRecognitionPreferences(GetPrefs()); |
898 } | 900 } |
899 return speech_input_preferences_.get(); | 901 return speech_recognition_preferences_.get(); |
900 #else | 902 #else |
901 return NULL; | 903 return NULL; |
902 #endif | 904 #endif |
903 } | 905 } |
904 | 906 |
905 UserStyleSheetWatcher* ProfileImpl::GetUserStyleSheetWatcher() { | 907 UserStyleSheetWatcher* ProfileImpl::GetUserStyleSheetWatcher() { |
906 if (!user_style_sheet_watcher_.get()) { | 908 if (!user_style_sheet_watcher_.get()) { |
907 user_style_sheet_watcher_ = new UserStyleSheetWatcher(this, GetPath()); | 909 user_style_sheet_watcher_ = new UserStyleSheetWatcher(this, GetPath()); |
908 user_style_sheet_watcher_->Init(); | 910 user_style_sheet_watcher_->Init(); |
909 } | 911 } |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 registrar_.Remove(this, | 1179 registrar_.Remove(this, |
1178 chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED, | 1180 chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED, |
1179 content::Source<PrefService>(prefs)); | 1181 content::Source<PrefService>(prefs)); |
1180 OnPrefsLoaded(*succeeded); | 1182 OnPrefsLoaded(*succeeded); |
1181 break; | 1183 break; |
1182 } | 1184 } |
1183 case chrome::NOTIFICATION_PREF_CHANGED: { | 1185 case chrome::NOTIFICATION_PREF_CHANGED: { |
1184 std::string* pref_name_in = content::Details<std::string>(details).ptr(); | 1186 std::string* pref_name_in = content::Details<std::string>(details).ptr(); |
1185 PrefService* prefs = content::Source<PrefService>(source).ptr(); | 1187 PrefService* prefs = content::Source<PrefService>(source).ptr(); |
1186 DCHECK(pref_name_in && prefs); | 1188 DCHECK(pref_name_in && prefs); |
1187 if (*pref_name_in == prefs::kSpeechInputFilterProfanities) { | 1189 if (*pref_name_in == prefs::kSpeechRecognitionFilterProfanities) { |
1188 content::SpeechInputPreferences* speech_prefs = | 1190 content::SpeechRecognitionPreferences* speech_prefs = |
1189 GetSpeechInputPreferences(); | 1191 GetSpeechRecognitionPreferences(); |
1190 if (speech_prefs) { | 1192 if (speech_prefs) { |
1191 speech_prefs->SetFilterProfanities(prefs->GetBoolean( | 1193 speech_prefs->SetFilterProfanities(prefs->GetBoolean( |
1192 prefs::kSpeechInputFilterProfanities)); | 1194 prefs::kSpeechRecognitionFilterProfanities)); |
1193 } | 1195 } |
1194 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { | 1196 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { |
1195 clear_local_state_on_exit_ = | 1197 clear_local_state_on_exit_ = |
1196 prefs->GetBoolean(prefs::kClearSiteDataOnExit); | 1198 prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
1197 } else if (*pref_name_in == prefs::kGoogleServicesUsername) { | 1199 } else if (*pref_name_in == prefs::kGoogleServicesUsername) { |
1198 UpdateProfileUserNameCache(); | 1200 UpdateProfileUserNameCache(); |
1199 } else if (*pref_name_in == prefs::kProfileAvatarIndex) { | 1201 } else if (*pref_name_in == prefs::kProfileAvatarIndex) { |
1200 UpdateProfileAvatarCache(); | 1202 UpdateProfileAvatarCache(); |
1201 } else if (*pref_name_in == prefs::kProfileName) { | 1203 } else if (*pref_name_in == prefs::kProfileName) { |
1202 UpdateProfileNameCache(); | 1204 UpdateProfileNameCache(); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 FilePath* cache_path, | 1463 FilePath* cache_path, |
1462 int* max_size) { | 1464 int* max_size) { |
1463 DCHECK(cache_path); | 1465 DCHECK(cache_path); |
1464 DCHECK(max_size); | 1466 DCHECK(max_size); |
1465 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1467 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
1466 if (!path.empty()) | 1468 if (!path.empty()) |
1467 *cache_path = path; | 1469 *cache_path = path; |
1468 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1470 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1469 prefs_->GetInteger(prefs::kDiskCacheSize); | 1471 prefs_->GetInteger(prefs::kDiskCacheSize); |
1470 } | 1472 } |
OLD | NEW |