| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "chrome/browser/prefs/browser_prefs.h" | 60 #include "chrome/browser/prefs/browser_prefs.h" |
| 61 #include "chrome/browser/prefs/pref_value_store.h" | 61 #include "chrome/browser/prefs/pref_value_store.h" |
| 62 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 62 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 63 #include "chrome/browser/prerender/prerender_manager.h" | 63 #include "chrome/browser/prerender/prerender_manager.h" |
| 64 #include "chrome/browser/profiles/profile_dependency_manager.h" | 64 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 65 #include "chrome/browser/profiles/profile_manager.h" | 65 #include "chrome/browser/profiles/profile_manager.h" |
| 66 #include "chrome/browser/search_engines/template_url_fetcher.h" | 66 #include "chrome/browser/search_engines/template_url_fetcher.h" |
| 67 #include "chrome/browser/search_engines/template_url_service.h" | 67 #include "chrome/browser/search_engines/template_url_service.h" |
| 68 #include "chrome/browser/sessions/session_service_factory.h" | 68 #include "chrome/browser/sessions/session_service_factory.h" |
| 69 #include "chrome/browser/speech/chrome_speech_input_manager.h" | 69 #include "chrome/browser/speech/chrome_speech_input_manager.h" |
| 70 #include "chrome/browser/speech/chrome_speech_input_preferences.h" |
| 70 #include "chrome/browser/spellchecker/spellcheck_profile.h" | 71 #include "chrome/browser/spellchecker/spellcheck_profile.h" |
| 71 #include "chrome/browser/sync/profile_sync_factory_impl.h" | 72 #include "chrome/browser/sync/profile_sync_factory_impl.h" |
| 72 #include "chrome/browser/sync/profile_sync_service.h" | 73 #include "chrome/browser/sync/profile_sync_service.h" |
| 73 #include "chrome/browser/tabs/pinned_tab_service_factory.h" | 74 #include "chrome/browser/tabs/pinned_tab_service_factory.h" |
| 74 #include "chrome/browser/transport_security_persister.h" | 75 #include "chrome/browser/transport_security_persister.h" |
| 75 #include "chrome/browser/ui/browser_list.h" | 76 #include "chrome/browser/ui/browser_list.h" |
| 76 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 77 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
| 77 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 78 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 78 #include "chrome/browser/ui/webui/extension_icon_source.h" | 79 #include "chrome/browser/ui/webui/extension_icon_source.h" |
| 79 #include "chrome/browser/user_style_sheet_watcher.h" | 80 #include "chrome/browser/user_style_sheet_watcher.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 new ProfileSizeTask(path_), 112000); | 488 new ProfileSizeTask(path_), 112000); |
| 488 | 489 |
| 489 InstantController::RecordMetrics(this); | 490 InstantController::RecordMetrics(this); |
| 490 | 491 |
| 491 // Instantiates Metrics object for spellchecking for use. | 492 // Instantiates Metrics object for spellchecking for use. |
| 492 if (g_browser_process->metrics_service() && | 493 if (g_browser_process->metrics_service() && |
| 493 g_browser_process->metrics_service()->recording_active()) | 494 g_browser_process->metrics_service()->recording_active()) |
| 494 GetSpellCheckProfile()->StartRecordingMetrics( | 495 GetSpellCheckProfile()->StartRecordingMetrics( |
| 495 GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); | 496 GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); |
| 496 | 497 |
| 497 speech_input::ChromeSpeechInputManager::GetInstance()->set_censor_results( | |
| 498 prefs->GetBoolean(prefs::kSpeechInputCensorResults)); | |
| 499 | |
| 500 FilePath cookie_path = GetPath(); | 498 FilePath cookie_path = GetPath(); |
| 501 cookie_path = cookie_path.Append(chrome::kCookieFilename); | 499 cookie_path = cookie_path.Append(chrome::kCookieFilename); |
| 502 FilePath origin_bound_cert_path = GetPath(); | 500 FilePath origin_bound_cert_path = GetPath(); |
| 503 origin_bound_cert_path = | 501 origin_bound_cert_path = |
| 504 origin_bound_cert_path.Append(chrome::kOBCertFilename); | 502 origin_bound_cert_path.Append(chrome::kOBCertFilename); |
| 505 FilePath cache_path = base_cache_path_; | 503 FilePath cache_path = base_cache_path_; |
| 506 int cache_max_size; | 504 int cache_max_size; |
| 507 GetCacheParameters(kNormalContext, &cache_path, &cache_max_size); | 505 GetCacheParameters(kNormalContext, &cache_path, &cache_max_size); |
| 508 cache_path = GetCachePath(cache_path); | 506 cache_path = GetCachePath(cache_path); |
| 509 | 507 |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 } | 1149 } |
| 1152 } | 1150 } |
| 1153 | 1151 |
| 1154 registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, | 1152 registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, |
| 1155 Source<HostZoomMap>(host_zoom_map_)); | 1153 Source<HostZoomMap>(host_zoom_map_)); |
| 1156 } | 1154 } |
| 1157 return host_zoom_map_.get(); | 1155 return host_zoom_map_.get(); |
| 1158 } | 1156 } |
| 1159 | 1157 |
| 1160 GeolocationPermissionContext* ProfileImpl::GetGeolocationPermissionContext() { | 1158 GeolocationPermissionContext* ProfileImpl::GetGeolocationPermissionContext() { |
| 1161 if (!geolocation_permission_context_.get()) | 1159 if (!geolocation_permission_context_.get()) { |
| 1162 geolocation_permission_context_ = | 1160 geolocation_permission_context_ = |
| 1163 new ChromeGeolocationPermissionContext(this); | 1161 new ChromeGeolocationPermissionContext(this); |
| 1162 } |
| 1164 return geolocation_permission_context_.get(); | 1163 return geolocation_permission_context_.get(); |
| 1165 } | 1164 } |
| 1166 | 1165 |
| 1166 SpeechInputPreferences* ProfileImpl::GetSpeechInputPreferences() { |
| 1167 if (!speech_input_preferences_.get()) { |
| 1168 speech_input_preferences_ = new ChromeSpeechInputPreferences(GetPrefs()); |
| 1169 } |
| 1170 return speech_input_preferences_.get(); |
| 1171 } |
| 1172 |
| 1167 UserStyleSheetWatcher* ProfileImpl::GetUserStyleSheetWatcher() { | 1173 UserStyleSheetWatcher* ProfileImpl::GetUserStyleSheetWatcher() { |
| 1168 if (!user_style_sheet_watcher_.get()) { | 1174 if (!user_style_sheet_watcher_.get()) { |
| 1169 user_style_sheet_watcher_ = new UserStyleSheetWatcher(GetPath()); | 1175 user_style_sheet_watcher_ = new UserStyleSheetWatcher(GetPath()); |
| 1170 user_style_sheet_watcher_->Init(); | 1176 user_style_sheet_watcher_->Init(); |
| 1171 } | 1177 } |
| 1172 return user_style_sheet_watcher_.get(); | 1178 return user_style_sheet_watcher_.get(); |
| 1173 } | 1179 } |
| 1174 | 1180 |
| 1175 FindBarState* ProfileImpl::GetFindBarState() { | 1181 FindBarState* ProfileImpl::GetFindBarState() { |
| 1176 if (!find_bar_state_.get()) { | 1182 if (!find_bar_state_.get()) { |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 ReinitializeSpellCheckHost(true); | 1560 ReinitializeSpellCheckHost(true); |
| 1555 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { | 1561 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { |
| 1556 bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); | 1562 bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); |
| 1557 for (RenderProcessHost::iterator | 1563 for (RenderProcessHost::iterator |
| 1558 i(RenderProcessHost::AllHostsIterator()); | 1564 i(RenderProcessHost::AllHostsIterator()); |
| 1559 !i.IsAtEnd(); i.Advance()) { | 1565 !i.IsAtEnd(); i.Advance()) { |
| 1560 RenderProcessHost* process = i.GetCurrentValue(); | 1566 RenderProcessHost* process = i.GetCurrentValue(); |
| 1561 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); | 1567 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); |
| 1562 } | 1568 } |
| 1563 } else if (*pref_name_in == prefs::kSpeechInputCensorResults) { | 1569 } else if (*pref_name_in == prefs::kSpeechInputCensorResults) { |
| 1564 speech_input::ChromeSpeechInputManager::GetInstance()-> | 1570 GetSpeechInputPreferences()->set_censor_results(prefs->GetBoolean( |
| 1565 set_censor_results(prefs->GetBoolean( | 1571 prefs::kSpeechInputCensorResults)); |
| 1566 prefs::kSpeechInputCensorResults)); | |
| 1567 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { | 1572 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { |
| 1568 clear_local_state_on_exit_ = | 1573 clear_local_state_on_exit_ = |
| 1569 prefs->GetBoolean(prefs::kClearSiteDataOnExit); | 1574 prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
| 1570 if (webkit_context_) { | 1575 if (webkit_context_) { |
| 1571 webkit_context_->set_clear_local_state_on_exit( | 1576 webkit_context_->set_clear_local_state_on_exit( |
| 1572 clear_local_state_on_exit_); | 1577 clear_local_state_on_exit_); |
| 1573 } | 1578 } |
| 1574 if (db_tracker_) { | 1579 if (db_tracker_) { |
| 1575 db_tracker_->SetClearLocalStateOnExit( | 1580 db_tracker_->SetClearLocalStateOnExit( |
| 1576 clear_local_state_on_exit_); | 1581 clear_local_state_on_exit_); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { | 1838 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { |
| 1834 if (!spellcheck_profile_.get()) | 1839 if (!spellcheck_profile_.get()) |
| 1835 spellcheck_profile_.reset(new SpellCheckProfile()); | 1840 spellcheck_profile_.reset(new SpellCheckProfile()); |
| 1836 return spellcheck_profile_.get(); | 1841 return spellcheck_profile_.get(); |
| 1837 } | 1842 } |
| 1838 | 1843 |
| 1839 void ProfileImpl::SetDownloadManagerDelegate( | 1844 void ProfileImpl::SetDownloadManagerDelegate( |
| 1840 ChromeDownloadManagerDelegate* delegate) { | 1845 ChromeDownloadManagerDelegate* delegate) { |
| 1841 download_manager_delegate_ = delegate; | 1846 download_manager_delegate_ = delegate; |
| 1842 } | 1847 } |
| OLD | NEW |