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/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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 #include "chrome/common/json_pref_store.h" | 94 #include "chrome/common/json_pref_store.h" |
95 #include "chrome/common/pref_names.h" | 95 #include "chrome/common/pref_names.h" |
96 #include "chrome/common/render_messages.h" | 96 #include "chrome/common/render_messages.h" |
97 #include "chrome/common/spellcheck_messages.h" | 97 #include "chrome/common/spellcheck_messages.h" |
98 #include "chrome/common/url_constants.h" | 98 #include "chrome/common/url_constants.h" |
99 #include "content/browser/appcache/chrome_appcache_service.h" | 99 #include "content/browser/appcache/chrome_appcache_service.h" |
100 #include "content/browser/chrome_blob_storage_context.h" | 100 #include "content/browser/chrome_blob_storage_context.h" |
101 #include "content/browser/file_system/browser_file_system_helper.h" | 101 #include "content/browser/file_system/browser_file_system_helper.h" |
102 #include "content/browser/host_zoom_map.h" | 102 #include "content/browser/host_zoom_map.h" |
103 #include "content/browser/in_process_webkit/webkit_context.h" | 103 #include "content/browser/in_process_webkit/webkit_context.h" |
104 #include "content/browser/renderer_host/render_process_host.h" | |
105 #include "content/browser/speech/speech_input_manager.h" | 104 #include "content/browser/speech/speech_input_manager.h" |
106 #include "content/browser/ssl/ssl_host_state.h" | 105 #include "content/browser/ssl/ssl_host_state.h" |
107 #include "content/browser/user_metrics.h" | 106 #include "content/browser/user_metrics.h" |
108 #include "content/public/browser/browser_thread.h" | 107 #include "content/public/browser/browser_thread.h" |
109 #include "content/public/browser/notification_service.h" | 108 #include "content/public/browser/notification_service.h" |
| 109 #include "content/public/browser/render_process_host.h" |
110 #include "grit/locale_settings.h" | 110 #include "grit/locale_settings.h" |
111 #include "net/base/transport_security_state.h" | 111 #include "net/base/transport_security_state.h" |
112 #include "net/http/http_server_properties.h" | 112 #include "net/http/http_server_properties.h" |
113 #include "webkit/database/database_tracker.h" | 113 #include "webkit/database/database_tracker.h" |
114 #include "webkit/quota/quota_manager.h" | 114 #include "webkit/quota/quota_manager.h" |
115 | 115 |
116 #if defined(OS_WIN) | 116 #if defined(OS_WIN) |
117 #include "chrome/browser/instant/promo_counter.h" | 117 #include "chrome/browser/instant/promo_counter.h" |
118 #include "chrome/browser/password_manager/password_store_win.h" | 118 #include "chrome/browser/password_manager/password_store_win.h" |
119 #include "chrome/installer/util/install_util.h" | 119 #include "chrome/installer/util/install_util.h" |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 void ProfileImpl::ReinitializeSpellCheckHost(bool force) { | 1188 void ProfileImpl::ReinitializeSpellCheckHost(bool force) { |
1189 PrefService* pref = GetPrefs(); | 1189 PrefService* pref = GetPrefs(); |
1190 SpellCheckProfile::ReinitializeResult result = | 1190 SpellCheckProfile::ReinitializeResult result = |
1191 GetSpellCheckProfile()->ReinitializeHost( | 1191 GetSpellCheckProfile()->ReinitializeHost( |
1192 force, | 1192 force, |
1193 pref->GetBoolean(prefs::kEnableSpellCheck), | 1193 pref->GetBoolean(prefs::kEnableSpellCheck), |
1194 pref->GetString(prefs::kSpellCheckDictionary), | 1194 pref->GetString(prefs::kSpellCheckDictionary), |
1195 GetRequestContext()); | 1195 GetRequestContext()); |
1196 if (result == SpellCheckProfile::REINITIALIZE_REMOVED_HOST) { | 1196 if (result == SpellCheckProfile::REINITIALIZE_REMOVED_HOST) { |
1197 // The spellchecker has been disabled. | 1197 // The spellchecker has been disabled. |
1198 for (RenderProcessHost::iterator | 1198 for (content::RenderProcessHost::iterator i( |
1199 i(RenderProcessHost::AllHostsIterator()); | 1199 content::RenderProcessHost::AllHostsIterator()); |
1200 !i.IsAtEnd(); i.Advance()) { | 1200 !i.IsAtEnd(); i.Advance()) { |
1201 RenderProcessHost* process = i.GetCurrentValue(); | 1201 content::RenderProcessHost* process = i.GetCurrentValue(); |
1202 process->Send(new SpellCheckMsg_Init(IPC::InvalidPlatformFileForTransit(), | 1202 process->Send(new SpellCheckMsg_Init(IPC::InvalidPlatformFileForTransit(), |
1203 std::vector<std::string>(), | 1203 std::vector<std::string>(), |
1204 std::string(), | 1204 std::string(), |
1205 false)); | 1205 false)); |
1206 } | 1206 } |
1207 } | 1207 } |
1208 } | 1208 } |
1209 | 1209 |
1210 ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() { | 1210 ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() { |
1211 if (!extension_pref_value_map_.get()) | 1211 if (!extension_pref_value_map_.get()) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 } | 1290 } |
1291 case chrome::NOTIFICATION_PREF_CHANGED: { | 1291 case chrome::NOTIFICATION_PREF_CHANGED: { |
1292 std::string* pref_name_in = content::Details<std::string>(details).ptr(); | 1292 std::string* pref_name_in = content::Details<std::string>(details).ptr(); |
1293 PrefService* prefs = content::Source<PrefService>(source).ptr(); | 1293 PrefService* prefs = content::Source<PrefService>(source).ptr(); |
1294 DCHECK(pref_name_in && prefs); | 1294 DCHECK(pref_name_in && prefs); |
1295 if (*pref_name_in == prefs::kSpellCheckDictionary || | 1295 if (*pref_name_in == prefs::kSpellCheckDictionary || |
1296 *pref_name_in == prefs::kEnableSpellCheck) { | 1296 *pref_name_in == prefs::kEnableSpellCheck) { |
1297 ReinitializeSpellCheckHost(true); | 1297 ReinitializeSpellCheckHost(true); |
1298 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { | 1298 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { |
1299 bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); | 1299 bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); |
1300 for (RenderProcessHost::iterator | 1300 for (content::RenderProcessHost::iterator i( |
1301 i(RenderProcessHost::AllHostsIterator()); | 1301 content::RenderProcessHost::AllHostsIterator()); |
1302 !i.IsAtEnd(); i.Advance()) { | 1302 !i.IsAtEnd(); i.Advance()) { |
1303 RenderProcessHost* process = i.GetCurrentValue(); | 1303 content::RenderProcessHost* process = i.GetCurrentValue(); |
1304 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); | 1304 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); |
1305 } | 1305 } |
1306 } else if (*pref_name_in == prefs::kSpeechInputFilterProfanities) { | 1306 } else if (*pref_name_in == prefs::kSpeechInputFilterProfanities) { |
1307 GetSpeechInputPreferences()->set_filter_profanities(prefs->GetBoolean( | 1307 GetSpeechInputPreferences()->set_filter_profanities(prefs->GetBoolean( |
1308 prefs::kSpeechInputFilterProfanities)); | 1308 prefs::kSpeechInputFilterProfanities)); |
1309 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { | 1309 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { |
1310 clear_local_state_on_exit_ = | 1310 clear_local_state_on_exit_ = |
1311 prefs->GetBoolean(prefs::kClearSiteDataOnExit); | 1311 prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
1312 if (webkit_context_) { | 1312 if (webkit_context_) { |
1313 webkit_context_->set_clear_local_state_on_exit( | 1313 webkit_context_->set_clear_local_state_on_exit( |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 void ProfileImpl::UpdateProfileUserNameCache() { | 1600 void ProfileImpl::UpdateProfileUserNameCache() { |
1601 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1601 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1602 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 1602 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
1603 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); | 1603 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); |
1604 if (index != std::string::npos) { | 1604 if (index != std::string::npos) { |
1605 std::string user_name = | 1605 std::string user_name = |
1606 GetPrefs()->GetString(prefs::kGoogleServicesUsername); | 1606 GetPrefs()->GetString(prefs::kGoogleServicesUsername); |
1607 cache.SetUserNameOfProfileAtIndex(index, UTF8ToUTF16(user_name)); | 1607 cache.SetUserNameOfProfileAtIndex(index, UTF8ToUTF16(user_name)); |
1608 } | 1608 } |
1609 } | 1609 } |
OLD | NEW |