| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 #include "chrome/common/pref_names.h" | 85 #include "chrome/common/pref_names.h" |
| 86 #include "chrome/common/render_messages.h" | 86 #include "chrome/common/render_messages.h" |
| 87 #include "chrome/common/spellcheck_messages.h" | 87 #include "chrome/common/spellcheck_messages.h" |
| 88 #include "content/browser/appcache/chrome_appcache_service.h" | 88 #include "content/browser/appcache/chrome_appcache_service.h" |
| 89 #include "content/browser/browser_thread.h" | 89 #include "content/browser/browser_thread.h" |
| 90 #include "content/browser/chrome_blob_storage_context.h" | 90 #include "content/browser/chrome_blob_storage_context.h" |
| 91 #include "content/browser/file_system/browser_file_system_helper.h" | 91 #include "content/browser/file_system/browser_file_system_helper.h" |
| 92 #include "content/browser/host_zoom_map.h" | 92 #include "content/browser/host_zoom_map.h" |
| 93 #include "content/browser/in_process_webkit/webkit_context.h" | 93 #include "content/browser/in_process_webkit/webkit_context.h" |
| 94 #include "content/browser/renderer_host/render_process_host.h" | 94 #include "content/browser/renderer_host/render_process_host.h" |
| 95 #include "content/browser/speech/speech_input_manager.h" |
| 95 #include "content/browser/ssl/ssl_host_state.h" | 96 #include "content/browser/ssl/ssl_host_state.h" |
| 96 #include "content/browser/user_metrics.h" | 97 #include "content/browser/user_metrics.h" |
| 97 #include "content/common/notification_service.h" | 98 #include "content/common/notification_service.h" |
| 98 #include "grit/browser_resources.h" | 99 #include "grit/browser_resources.h" |
| 99 #include "grit/locale_settings.h" | 100 #include "grit/locale_settings.h" |
| 100 #include "net/base/transport_security_state.h" | 101 #include "net/base/transport_security_state.h" |
| 101 #include "ui/base/resource/resource_bundle.h" | 102 #include "ui/base/resource/resource_bundle.h" |
| 102 #include "webkit/database/database_tracker.h" | 103 #include "webkit/database/database_tracker.h" |
| 103 #include "webkit/quota/quota_manager.h" | 104 #include "webkit/quota/quota_manager.h" |
| 104 | 105 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 OnPrefsLoaded(true); | 322 OnPrefsLoaded(true); |
| 322 } | 323 } |
| 323 } | 324 } |
| 324 | 325 |
| 325 void ProfileImpl::DoFinalInit() { | 326 void ProfileImpl::DoFinalInit() { |
| 326 PrefService* prefs = GetPrefs(); | 327 PrefService* prefs = GetPrefs(); |
| 327 pref_change_registrar_.Init(prefs); | 328 pref_change_registrar_.Init(prefs); |
| 328 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); | 329 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); |
| 329 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); | 330 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); |
| 330 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); | 331 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); |
| 332 pref_change_registrar_.Add(prefs::kSpeechInputCensorResults, this); |
| 331 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); | 333 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); |
| 332 pref_change_registrar_.Add(prefs::kGoogleServicesUsername, this); | 334 pref_change_registrar_.Add(prefs::kGoogleServicesUsername, this); |
| 333 pref_change_registrar_.Add(prefs::kDefaultZoomLevel, this); | 335 pref_change_registrar_.Add(prefs::kDefaultZoomLevel, this); |
| 334 | 336 |
| 335 // It would be nice to use PathService for fetching this directory, but | 337 // It would be nice to use PathService for fetching this directory, but |
| 336 // the cache directory depends on the profile directory, which isn't available | 338 // the cache directory depends on the profile directory, which isn't available |
| 337 // to PathService. | 339 // to PathService. |
| 338 chrome::GetUserCacheDirectory(path_, &base_cache_path_); | 340 chrome::GetUserCacheDirectory(path_, &base_cache_path_); |
| 339 if (!delegate_) { | 341 if (!delegate_) { |
| 340 if (!file_util::CreateDirectory(base_cache_path_)) | 342 if (!file_util::CreateDirectory(base_cache_path_)) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 InstantController::RecordMetrics(this); | 395 InstantController::RecordMetrics(this); |
| 394 | 396 |
| 395 // Instantiates Metrics object for spellchecking for use. | 397 // Instantiates Metrics object for spellchecking for use. |
| 396 if (g_browser_process->metrics_service() && | 398 if (g_browser_process->metrics_service() && |
| 397 g_browser_process->metrics_service()->recording_active()) { | 399 g_browser_process->metrics_service()->recording_active()) { |
| 398 spellcheck_host_metrics_.reset(new SpellCheckHostMetrics()); | 400 spellcheck_host_metrics_.reset(new SpellCheckHostMetrics()); |
| 399 spellcheck_host_metrics_->RecordEnabledStats( | 401 spellcheck_host_metrics_->RecordEnabledStats( |
| 400 GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); | 402 GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); |
| 401 } | 403 } |
| 402 | 404 |
| 405 speech_input::SpeechInputManager::Get()->NotifyCensorResults( |
| 406 prefs->GetBoolean(prefs::kSpeechInputCensorResults)); |
| 407 |
| 403 FilePath cookie_path = GetPath(); | 408 FilePath cookie_path = GetPath(); |
| 404 cookie_path = cookie_path.Append(chrome::kCookieFilename); | 409 cookie_path = cookie_path.Append(chrome::kCookieFilename); |
| 405 FilePath cache_path = base_cache_path_; | 410 FilePath cache_path = base_cache_path_; |
| 406 int cache_max_size; | 411 int cache_max_size; |
| 407 GetCacheParameters(kNormalContext, &cache_path, &cache_max_size); | 412 GetCacheParameters(kNormalContext, &cache_path, &cache_max_size); |
| 408 cache_path = GetCachePath(cache_path); | 413 cache_path = GetCachePath(cache_path); |
| 409 | 414 |
| 410 FilePath media_cache_path = base_cache_path_; | 415 FilePath media_cache_path = base_cache_path_; |
| 411 int media_cache_max_size; | 416 int media_cache_max_size; |
| 412 GetCacheParameters(kMediaContext, &media_cache_path, &media_cache_max_size); | 417 GetCacheParameters(kMediaContext, &media_cache_path, &media_cache_max_size); |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 *pref_name_in == prefs::kEnableSpellCheck) { | 1384 *pref_name_in == prefs::kEnableSpellCheck) { |
| 1380 ReinitializeSpellCheckHost(true); | 1385 ReinitializeSpellCheckHost(true); |
| 1381 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { | 1386 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { |
| 1382 bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); | 1387 bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); |
| 1383 for (RenderProcessHost::iterator | 1388 for (RenderProcessHost::iterator |
| 1384 i(RenderProcessHost::AllHostsIterator()); | 1389 i(RenderProcessHost::AllHostsIterator()); |
| 1385 !i.IsAtEnd(); i.Advance()) { | 1390 !i.IsAtEnd(); i.Advance()) { |
| 1386 RenderProcessHost* process = i.GetCurrentValue(); | 1391 RenderProcessHost* process = i.GetCurrentValue(); |
| 1387 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); | 1392 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); |
| 1388 } | 1393 } |
| 1394 } else if (*pref_name_in == prefs::kSpeechInputCensorResults) { |
| 1395 speech_input::SpeechInputManager::Get()->NotifyCensorResults( |
| 1396 prefs->GetBoolean(prefs::kSpeechInputCensorResults)); |
| 1389 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { | 1397 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { |
| 1390 clear_local_state_on_exit_ = | 1398 clear_local_state_on_exit_ = |
| 1391 prefs->GetBoolean(prefs::kClearSiteDataOnExit); | 1399 prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
| 1392 if (webkit_context_) { | 1400 if (webkit_context_) { |
| 1393 webkit_context_->set_clear_local_state_on_exit( | 1401 webkit_context_->set_clear_local_state_on_exit( |
| 1394 clear_local_state_on_exit_); | 1402 clear_local_state_on_exit_); |
| 1395 } | 1403 } |
| 1396 if (appcache_service_) { | 1404 if (appcache_service_) { |
| 1397 appcache_service_->SetClearLocalStateOnExit( | 1405 appcache_service_->SetClearLocalStateOnExit( |
| 1398 clear_local_state_on_exit_); | 1406 clear_local_state_on_exit_); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1652 if (!prerender::PrerenderManager::IsPrerenderingPossible()) | 1660 if (!prerender::PrerenderManager::IsPrerenderingPossible()) |
| 1653 return NULL; | 1661 return NULL; |
| 1654 if (!prerender_manager_.get()) { | 1662 if (!prerender_manager_.get()) { |
| 1655 CHECK(g_browser_process->prerender_tracker()); | 1663 CHECK(g_browser_process->prerender_tracker()); |
| 1656 prerender_manager_.reset( | 1664 prerender_manager_.reset( |
| 1657 new prerender::PrerenderManager( | 1665 new prerender::PrerenderManager( |
| 1658 this, g_browser_process->prerender_tracker())); | 1666 this, g_browser_process->prerender_tracker())); |
| 1659 } | 1667 } |
| 1660 return prerender_manager_.get(); | 1668 return prerender_manager_.get(); |
| 1661 } | 1669 } |
| OLD | NEW |