OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 #include "chrome/browser/visitedlink/visitedlink_master.h" | 76 #include "chrome/browser/visitedlink/visitedlink_master.h" |
77 #include "chrome/browser/web_resource/promo_resource_service.h" | 77 #include "chrome/browser/web_resource/promo_resource_service.h" |
78 #include "chrome/browser/webdata/web_data_service.h" | 78 #include "chrome/browser/webdata/web_data_service.h" |
79 #include "chrome/common/chrome_constants.h" | 79 #include "chrome/common/chrome_constants.h" |
80 #include "chrome/common/chrome_paths.h" | 80 #include "chrome/common/chrome_paths.h" |
81 #include "chrome/common/chrome_paths_internal.h" | 81 #include "chrome/common/chrome_paths_internal.h" |
82 #include "chrome/common/chrome_switches.h" | 82 #include "chrome/common/chrome_switches.h" |
83 #include "chrome/common/json_pref_store.h" | 83 #include "chrome/common/json_pref_store.h" |
84 #include "chrome/common/pref_names.h" | 84 #include "chrome/common/pref_names.h" |
85 #include "chrome/common/render_messages.h" | 85 #include "chrome/common/render_messages.h" |
| 86 #include "chrome/common/spellcheck_messages.h" |
86 #include "content/browser/appcache/chrome_appcache_service.h" | 87 #include "content/browser/appcache/chrome_appcache_service.h" |
87 #include "content/browser/browser_thread.h" | 88 #include "content/browser/browser_thread.h" |
88 #include "content/browser/chrome_blob_storage_context.h" | 89 #include "content/browser/chrome_blob_storage_context.h" |
89 #include "content/browser/file_system/browser_file_system_helper.h" | 90 #include "content/browser/file_system/browser_file_system_helper.h" |
90 #include "content/browser/geolocation/geolocation_permission_context.h" | 91 #include "content/browser/geolocation/geolocation_permission_context.h" |
91 #include "content/browser/host_zoom_map.h" | 92 #include "content/browser/host_zoom_map.h" |
92 #include "content/browser/in_process_webkit/webkit_context.h" | 93 #include "content/browser/in_process_webkit/webkit_context.h" |
93 #include "content/browser/renderer_host/render_process_host.h" | 94 #include "content/browser/renderer_host/render_process_host.h" |
94 #include "content/browser/user_metrics.h" | 95 #include "content/browser/user_metrics.h" |
95 #include "content/common/notification_service.h" | 96 #include "content/common/notification_service.h" |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 } else if (notify) { | 1248 } else if (notify) { |
1248 // The spellchecker has been disabled. | 1249 // The spellchecker has been disabled. |
1249 SpellCheckHostInitialized(); | 1250 SpellCheckHostInitialized(); |
1250 } | 1251 } |
1251 } | 1252 } |
1252 | 1253 |
1253 void ProfileImpl::SpellCheckHostInitialized() { | 1254 void ProfileImpl::SpellCheckHostInitialized() { |
1254 spellcheck_host_ready_ = spellcheck_host_ && | 1255 spellcheck_host_ready_ = spellcheck_host_ && |
1255 (spellcheck_host_->GetDictionaryFile() != | 1256 (spellcheck_host_->GetDictionaryFile() != |
1256 base::kInvalidPlatformFileValue || | 1257 base::kInvalidPlatformFileValue || |
1257 spellcheck_host_->IsUsingPlatformChecker()); | 1258 spellcheck_host_->IsUsingPlatformChecker());; |
1258 NotificationService::current()->Notify( | |
1259 NotificationType::SPELLCHECK_HOST_REINITIALIZED, | |
1260 Source<Profile>(this), NotificationService::NoDetails()); | |
1261 } | 1259 } |
1262 | 1260 |
1263 ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() { | 1261 ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() { |
1264 if (!extension_pref_value_map_.get()) | 1262 if (!extension_pref_value_map_.get()) |
1265 extension_pref_value_map_.reset(new ExtensionPrefValueMap); | 1263 extension_pref_value_map_.reset(new ExtensionPrefValueMap); |
1266 return extension_pref_value_map_.get(); | 1264 return extension_pref_value_map_.get(); |
1267 } | 1265 } |
1268 | 1266 |
1269 WebKitContext* ProfileImpl::GetWebKitContext() { | 1267 WebKitContext* ProfileImpl::GetWebKitContext() { |
1270 if (!webkit_context_.get()) { | 1268 if (!webkit_context_.get()) { |
(...skipping 19 matching lines...) Expand all Loading... |
1290 const NotificationSource& source, | 1288 const NotificationSource& source, |
1291 const NotificationDetails& details) { | 1289 const NotificationDetails& details) { |
1292 if (NotificationType::PREF_CHANGED == type) { | 1290 if (NotificationType::PREF_CHANGED == type) { |
1293 std::string* pref_name_in = Details<std::string>(details).ptr(); | 1291 std::string* pref_name_in = Details<std::string>(details).ptr(); |
1294 PrefService* prefs = Source<PrefService>(source).ptr(); | 1292 PrefService* prefs = Source<PrefService>(source).ptr(); |
1295 DCHECK(pref_name_in && prefs); | 1293 DCHECK(pref_name_in && prefs); |
1296 if (*pref_name_in == prefs::kSpellCheckDictionary || | 1294 if (*pref_name_in == prefs::kSpellCheckDictionary || |
1297 *pref_name_in == prefs::kEnableSpellCheck) { | 1295 *pref_name_in == prefs::kEnableSpellCheck) { |
1298 ReinitializeSpellCheckHost(true); | 1296 ReinitializeSpellCheckHost(true); |
1299 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { | 1297 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { |
1300 NotificationService::current()->Notify( | 1298 bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); |
1301 NotificationType::SPELLCHECK_AUTOSPELL_TOGGLED, | 1299 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
1302 Source<Profile>(this), NotificationService::NoDetails()); | 1300 !i.IsAtEnd(); i.Advance()) { |
| 1301 RenderProcessHost* process = i.GetCurrentValue(); |
| 1302 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); |
| 1303 } |
1303 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { | 1304 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { |
1304 clear_local_state_on_exit_ = | 1305 clear_local_state_on_exit_ = |
1305 prefs->GetBoolean(prefs::kClearSiteDataOnExit); | 1306 prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
1306 if (webkit_context_) { | 1307 if (webkit_context_) { |
1307 webkit_context_->set_clear_local_state_on_exit( | 1308 webkit_context_->set_clear_local_state_on_exit( |
1308 clear_local_state_on_exit_); | 1309 clear_local_state_on_exit_); |
1309 } | 1310 } |
1310 if (appcache_service_) { | 1311 if (appcache_service_) { |
1311 appcache_service_->SetClearLocalStateOnExit( | 1312 appcache_service_->SetClearLocalStateOnExit( |
1312 clear_local_state_on_exit_); | 1313 clear_local_state_on_exit_); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 return pref_proxy_config_tracker_; | 1536 return pref_proxy_config_tracker_; |
1536 } | 1537 } |
1537 | 1538 |
1538 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { | 1539 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { |
1539 if (!prerender::PrerenderManager::IsPrerenderingPossible()) | 1540 if (!prerender::PrerenderManager::IsPrerenderingPossible()) |
1540 return NULL; | 1541 return NULL; |
1541 if (!prerender_manager_.get()) | 1542 if (!prerender_manager_.get()) |
1542 prerender_manager_.reset(new prerender::PrerenderManager(this)); | 1543 prerender_manager_.reset(new prerender::PrerenderManager(this)); |
1543 return prerender_manager_.get(); | 1544 return prerender_manager_.get(); |
1544 } | 1545 } |
OLD | NEW |