Chromium Code Reviews| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 #include "chrome/installer/util/google_update_settings.h" | 94 #include "chrome/installer/util/google_update_settings.h" |
| 95 #include "content/browser/appcache/chrome_appcache_service.h" | 95 #include "content/browser/appcache/chrome_appcache_service.h" |
| 96 #include "content/browser/browser_thread.h" | 96 #include "content/browser/browser_thread.h" |
| 97 #include "content/browser/chrome_blob_storage_context.h" | 97 #include "content/browser/chrome_blob_storage_context.h" |
| 98 #include "content/browser/download/download_manager.h" | 98 #include "content/browser/download/download_manager.h" |
| 99 #include "content/browser/file_system/browser_file_system_helper.h" | 99 #include "content/browser/file_system/browser_file_system_helper.h" |
| 100 #include "content/browser/host_zoom_map.h" | 100 #include "content/browser/host_zoom_map.h" |
| 101 #include "content/browser/in_process_webkit/webkit_context.h" | 101 #include "content/browser/in_process_webkit/webkit_context.h" |
| 102 #include "content/browser/renderer_host/render_process_host.h" | 102 #include "content/browser/renderer_host/render_process_host.h" |
| 103 #include "content/browser/speech/speech_input_manager.h" | 103 #include "content/browser/speech/speech_input_manager.h" |
| 104 #include "content/browser/speech/speech_input_preferences.h" | |
| 104 #include "content/browser/ssl/ssl_host_state.h" | 105 #include "content/browser/ssl/ssl_host_state.h" |
| 105 #include "content/browser/user_metrics.h" | 106 #include "content/browser/user_metrics.h" |
| 106 #include "content/common/notification_service.h" | 107 #include "content/common/notification_service.h" |
| 107 #include "grit/browser_resources.h" | 108 #include "grit/browser_resources.h" |
| 108 #include "grit/locale_settings.h" | 109 #include "grit/locale_settings.h" |
| 109 #include "net/base/transport_security_state.h" | 110 #include "net/base/transport_security_state.h" |
| 110 #include "ui/base/resource/resource_bundle.h" | 111 #include "ui/base/resource/resource_bundle.h" |
| 111 #include "webkit/database/database_tracker.h" | 112 #include "webkit/database/database_tracker.h" |
| 112 #include "webkit/quota/quota_manager.h" | 113 #include "webkit/quota/quota_manager.h" |
| 113 | 114 |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 new ProfileSizeTask(path_), 112000); | 445 new ProfileSizeTask(path_), 112000); |
| 445 | 446 |
| 446 InstantController::RecordMetrics(this); | 447 InstantController::RecordMetrics(this); |
| 447 | 448 |
| 448 // Instantiates Metrics object for spellchecking for use. | 449 // Instantiates Metrics object for spellchecking for use. |
| 449 if (g_browser_process->metrics_service() && | 450 if (g_browser_process->metrics_service() && |
| 450 g_browser_process->metrics_service()->recording_active()) | 451 g_browser_process->metrics_service()->recording_active()) |
| 451 GetSpellCheckProfile()->StartRecordingMetrics( | 452 GetSpellCheckProfile()->StartRecordingMetrics( |
| 452 GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); | 453 GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); |
| 453 | 454 |
| 454 speech_input::ChromeSpeechInputManager::GetInstance()->set_censor_results( | |
| 455 prefs->GetBoolean(prefs::kSpeechInputCensorResults)); | |
| 456 | |
| 457 FilePath cookie_path = GetPath(); | 455 FilePath cookie_path = GetPath(); |
| 458 cookie_path = cookie_path.Append(chrome::kCookieFilename); | 456 cookie_path = cookie_path.Append(chrome::kCookieFilename); |
| 459 FilePath origin_bound_cert_path = GetPath(); | 457 FilePath origin_bound_cert_path = GetPath(); |
| 460 origin_bound_cert_path = | 458 origin_bound_cert_path = |
| 461 origin_bound_cert_path.Append(chrome::kOBCertFilename); | 459 origin_bound_cert_path.Append(chrome::kOBCertFilename); |
| 462 FilePath cache_path = base_cache_path_; | 460 FilePath cache_path = base_cache_path_; |
| 463 int cache_max_size; | 461 int cache_max_size; |
| 464 GetCacheParameters(kNormalContext, &cache_path, &cache_max_size); | 462 GetCacheParameters(kNormalContext, &cache_path, &cache_max_size); |
| 465 cache_path = GetCachePath(cache_path); | 463 cache_path = GetCachePath(cache_path); |
| 466 | 464 |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1137 return host_zoom_map_.get(); | 1135 return host_zoom_map_.get(); |
| 1138 } | 1136 } |
| 1139 | 1137 |
| 1140 GeolocationPermissionContext* ProfileImpl::GetGeolocationPermissionContext() { | 1138 GeolocationPermissionContext* ProfileImpl::GetGeolocationPermissionContext() { |
| 1141 if (!geolocation_permission_context_.get()) | 1139 if (!geolocation_permission_context_.get()) |
| 1142 geolocation_permission_context_ = | 1140 geolocation_permission_context_ = |
| 1143 new ChromeGeolocationPermissionContext(this); | 1141 new ChromeGeolocationPermissionContext(this); |
| 1144 return geolocation_permission_context_.get(); | 1142 return geolocation_permission_context_.get(); |
| 1145 } | 1143 } |
| 1146 | 1144 |
| 1145 SpeechInputPreferences* ProfileImpl::GetSpeechInputPreferences() { | |
| 1146 if (!speech_input_preferences_.get()) | |
|
Satish
2011/09/23 16:31:54
suggest using braces for multi-line if blocks like
allanwoj
2011/09/26 13:05:15
Done.
| |
| 1147 speech_input_preferences_ = new SpeechInputPreferences( | |
| 1148 GetPrefs()->GetBoolean(prefs::kSpeechInputCensorResults)); | |
| 1149 return speech_input_preferences_.get(); | |
| 1150 } | |
| 1151 | |
| 1147 UserStyleSheetWatcher* ProfileImpl::GetUserStyleSheetWatcher() { | 1152 UserStyleSheetWatcher* ProfileImpl::GetUserStyleSheetWatcher() { |
| 1148 if (!user_style_sheet_watcher_.get()) { | 1153 if (!user_style_sheet_watcher_.get()) { |
| 1149 user_style_sheet_watcher_ = new UserStyleSheetWatcher(GetPath()); | 1154 user_style_sheet_watcher_ = new UserStyleSheetWatcher(GetPath()); |
| 1150 user_style_sheet_watcher_->Init(); | 1155 user_style_sheet_watcher_->Init(); |
| 1151 } | 1156 } |
| 1152 return user_style_sheet_watcher_.get(); | 1157 return user_style_sheet_watcher_.get(); |
| 1153 } | 1158 } |
| 1154 | 1159 |
| 1155 FindBarState* ProfileImpl::GetFindBarState() { | 1160 FindBarState* ProfileImpl::GetFindBarState() { |
| 1156 if (!find_bar_state_.get()) { | 1161 if (!find_bar_state_.get()) { |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1542 ReinitializeSpellCheckHost(true); | 1547 ReinitializeSpellCheckHost(true); |
| 1543 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { | 1548 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { |
| 1544 bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); | 1549 bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); |
| 1545 for (RenderProcessHost::iterator | 1550 for (RenderProcessHost::iterator |
| 1546 i(RenderProcessHost::AllHostsIterator()); | 1551 i(RenderProcessHost::AllHostsIterator()); |
| 1547 !i.IsAtEnd(); i.Advance()) { | 1552 !i.IsAtEnd(); i.Advance()) { |
| 1548 RenderProcessHost* process = i.GetCurrentValue(); | 1553 RenderProcessHost* process = i.GetCurrentValue(); |
| 1549 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); | 1554 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); |
| 1550 } | 1555 } |
| 1551 } else if (*pref_name_in == prefs::kSpeechInputCensorResults) { | 1556 } else if (*pref_name_in == prefs::kSpeechInputCensorResults) { |
| 1552 speech_input::ChromeSpeechInputManager::GetInstance()-> | 1557 GetSpeechInputPreferences()->set_censor_results(prefs->GetBoolean( |
| 1553 set_censor_results(prefs->GetBoolean( | 1558 prefs::kSpeechInputCensorResults)); |
| 1554 prefs::kSpeechInputCensorResults)); | |
| 1555 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { | 1559 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { |
| 1556 clear_local_state_on_exit_ = | 1560 clear_local_state_on_exit_ = |
| 1557 prefs->GetBoolean(prefs::kClearSiteDataOnExit); | 1561 prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
| 1558 if (webkit_context_) { | 1562 if (webkit_context_) { |
| 1559 webkit_context_->set_clear_local_state_on_exit( | 1563 webkit_context_->set_clear_local_state_on_exit( |
| 1560 clear_local_state_on_exit_); | 1564 clear_local_state_on_exit_); |
| 1561 } | 1565 } |
| 1562 if (db_tracker_) { | 1566 if (db_tracker_) { |
| 1563 db_tracker_->SetClearLocalStateOnExit( | 1567 db_tracker_->SetClearLocalStateOnExit( |
| 1564 clear_local_state_on_exit_); | 1568 clear_local_state_on_exit_); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1821 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { | 1825 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { |
| 1822 if (!spellcheck_profile_.get()) | 1826 if (!spellcheck_profile_.get()) |
| 1823 spellcheck_profile_.reset(new SpellCheckProfile()); | 1827 spellcheck_profile_.reset(new SpellCheckProfile()); |
| 1824 return spellcheck_profile_.get(); | 1828 return spellcheck_profile_.get(); |
| 1825 } | 1829 } |
| 1826 | 1830 |
| 1827 void ProfileImpl::SetDownloadManagerDelegate( | 1831 void ProfileImpl::SetDownloadManagerDelegate( |
| 1828 ChromeDownloadManagerDelegate* delegate) { | 1832 ChromeDownloadManagerDelegate* delegate) { |
| 1829 download_manager_delegate_ = delegate; | 1833 download_manager_delegate_ = delegate; |
| 1830 } | 1834 } |
| OLD | NEW |