| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 #include "chrome/common/pref_names.h" | 86 #include "chrome/common/pref_names.h" |
| 87 #include "chrome/common/render_messages.h" | 87 #include "chrome/common/render_messages.h" |
| 88 #include "chrome/common/spellcheck_messages.h" | 88 #include "chrome/common/spellcheck_messages.h" |
| 89 #include "content/browser/appcache/chrome_appcache_service.h" | 89 #include "content/browser/appcache/chrome_appcache_service.h" |
| 90 #include "content/browser/browser_thread.h" | 90 #include "content/browser/browser_thread.h" |
| 91 #include "content/browser/chrome_blob_storage_context.h" | 91 #include "content/browser/chrome_blob_storage_context.h" |
| 92 #include "content/browser/file_system/browser_file_system_helper.h" | 92 #include "content/browser/file_system/browser_file_system_helper.h" |
| 93 #include "content/browser/host_zoom_map.h" | 93 #include "content/browser/host_zoom_map.h" |
| 94 #include "content/browser/in_process_webkit/webkit_context.h" | 94 #include "content/browser/in_process_webkit/webkit_context.h" |
| 95 #include "content/browser/renderer_host/render_process_host.h" | 95 #include "content/browser/renderer_host/render_process_host.h" |
| 96 #include "content/browser/speech/speech_input_manager.h" |
| 96 #include "content/browser/ssl/ssl_host_state.h" | 97 #include "content/browser/ssl/ssl_host_state.h" |
| 97 #include "content/browser/user_metrics.h" | 98 #include "content/browser/user_metrics.h" |
| 98 #include "content/common/notification_service.h" | 99 #include "content/common/notification_service.h" |
| 99 #include "grit/browser_resources.h" | 100 #include "grit/browser_resources.h" |
| 100 #include "grit/locale_settings.h" | 101 #include "grit/locale_settings.h" |
| 101 #include "net/base/transport_security_state.h" | 102 #include "net/base/transport_security_state.h" |
| 102 #include "ui/base/resource/resource_bundle.h" | 103 #include "ui/base/resource/resource_bundle.h" |
| 103 #include "webkit/database/database_tracker.h" | 104 #include "webkit/database/database_tracker.h" |
| 104 #include "webkit/quota/quota_manager.h" | 105 #include "webkit/quota/quota_manager.h" |
| 105 | 106 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 OnPrefsLoaded(true); | 327 OnPrefsLoaded(true); |
| 327 } | 328 } |
| 328 } | 329 } |
| 329 | 330 |
| 330 void ProfileImpl::DoFinalInit() { | 331 void ProfileImpl::DoFinalInit() { |
| 331 PrefService* prefs = GetPrefs(); | 332 PrefService* prefs = GetPrefs(); |
| 332 pref_change_registrar_.Init(prefs); | 333 pref_change_registrar_.Init(prefs); |
| 333 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); | 334 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); |
| 334 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); | 335 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); |
| 335 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); | 336 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); |
| 337 pref_change_registrar_.Add(prefs::kSpeechInputCensorResults, this); |
| 336 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); | 338 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); |
| 337 pref_change_registrar_.Add(prefs::kGoogleServicesUsername, this); | 339 pref_change_registrar_.Add(prefs::kGoogleServicesUsername, this); |
| 338 pref_change_registrar_.Add(prefs::kDefaultZoomLevel, this); | 340 pref_change_registrar_.Add(prefs::kDefaultZoomLevel, this); |
| 339 | 341 |
| 340 // It would be nice to use PathService for fetching this directory, but | 342 // It would be nice to use PathService for fetching this directory, but |
| 341 // the cache directory depends on the profile directory, which isn't available | 343 // the cache directory depends on the profile directory, which isn't available |
| 342 // to PathService. | 344 // to PathService. |
| 343 chrome::GetUserCacheDirectory(path_, &base_cache_path_); | 345 chrome::GetUserCacheDirectory(path_, &base_cache_path_); |
| 344 if (!delegate_) { | 346 if (!delegate_) { |
| 345 if (!file_util::CreateDirectory(base_cache_path_)) | 347 if (!file_util::CreateDirectory(base_cache_path_)) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 InstantController::RecordMetrics(this); | 398 InstantController::RecordMetrics(this); |
| 397 | 399 |
| 398 // Instantiates Metrics object for spellchecking for use. | 400 // Instantiates Metrics object for spellchecking for use. |
| 399 if (g_browser_process->metrics_service() && | 401 if (g_browser_process->metrics_service() && |
| 400 g_browser_process->metrics_service()->recording_active()) { | 402 g_browser_process->metrics_service()->recording_active()) { |
| 401 spellcheck_host_metrics_.reset(new SpellCheckHostMetrics()); | 403 spellcheck_host_metrics_.reset(new SpellCheckHostMetrics()); |
| 402 spellcheck_host_metrics_->RecordEnabledStats( | 404 spellcheck_host_metrics_->RecordEnabledStats( |
| 403 GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); | 405 GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); |
| 404 } | 406 } |
| 405 | 407 |
| 408 speech_input::SpeechInputManager::Get()->set_censor_results( |
| 409 prefs->GetBoolean(prefs::kSpeechInputCensorResults)); |
| 410 |
| 406 FilePath cookie_path = GetPath(); | 411 FilePath cookie_path = GetPath(); |
| 407 cookie_path = cookie_path.Append(chrome::kCookieFilename); | 412 cookie_path = cookie_path.Append(chrome::kCookieFilename); |
| 408 FilePath cache_path = base_cache_path_; | 413 FilePath cache_path = base_cache_path_; |
| 409 int cache_max_size; | 414 int cache_max_size; |
| 410 GetCacheParameters(kNormalContext, &cache_path, &cache_max_size); | 415 GetCacheParameters(kNormalContext, &cache_path, &cache_max_size); |
| 411 cache_path = GetCachePath(cache_path); | 416 cache_path = GetCachePath(cache_path); |
| 412 | 417 |
| 413 FilePath media_cache_path = base_cache_path_; | 418 FilePath media_cache_path = base_cache_path_; |
| 414 int media_cache_max_size; | 419 int media_cache_max_size; |
| 415 GetCacheParameters(kMediaContext, &media_cache_path, &media_cache_max_size); | 420 GetCacheParameters(kMediaContext, &media_cache_path, &media_cache_max_size); |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 *pref_name_in == prefs::kEnableSpellCheck) { | 1480 *pref_name_in == prefs::kEnableSpellCheck) { |
| 1476 ReinitializeSpellCheckHost(true); | 1481 ReinitializeSpellCheckHost(true); |
| 1477 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { | 1482 } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) { |
| 1478 bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); | 1483 bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect); |
| 1479 for (RenderProcessHost::iterator | 1484 for (RenderProcessHost::iterator |
| 1480 i(RenderProcessHost::AllHostsIterator()); | 1485 i(RenderProcessHost::AllHostsIterator()); |
| 1481 !i.IsAtEnd(); i.Advance()) { | 1486 !i.IsAtEnd(); i.Advance()) { |
| 1482 RenderProcessHost* process = i.GetCurrentValue(); | 1487 RenderProcessHost* process = i.GetCurrentValue(); |
| 1483 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); | 1488 process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); |
| 1484 } | 1489 } |
| 1490 } else if (*pref_name_in == prefs::kSpeechInputCensorResults) { |
| 1491 speech_input::SpeechInputManager::Get()->set_censor_results( |
| 1492 prefs->GetBoolean(prefs::kSpeechInputCensorResults)); |
| 1485 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { | 1493 } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { |
| 1486 clear_local_state_on_exit_ = | 1494 clear_local_state_on_exit_ = |
| 1487 prefs->GetBoolean(prefs::kClearSiteDataOnExit); | 1495 prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
| 1488 if (webkit_context_) { | 1496 if (webkit_context_) { |
| 1489 webkit_context_->set_clear_local_state_on_exit( | 1497 webkit_context_->set_clear_local_state_on_exit( |
| 1490 clear_local_state_on_exit_); | 1498 clear_local_state_on_exit_); |
| 1491 } | 1499 } |
| 1492 if (db_tracker_) { | 1500 if (db_tracker_) { |
| 1493 db_tracker_->SetClearLocalStateOnExit( | 1501 db_tracker_->SetClearLocalStateOnExit( |
| 1494 clear_local_state_on_exit_); | 1502 clear_local_state_on_exit_); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 if (!prerender::PrerenderManager::IsPrerenderingPossible()) | 1753 if (!prerender::PrerenderManager::IsPrerenderingPossible()) |
| 1746 return NULL; | 1754 return NULL; |
| 1747 if (!prerender_manager_.get()) { | 1755 if (!prerender_manager_.get()) { |
| 1748 CHECK(g_browser_process->prerender_tracker()); | 1756 CHECK(g_browser_process->prerender_tracker()); |
| 1749 prerender_manager_.reset( | 1757 prerender_manager_.reset( |
| 1750 new prerender::PrerenderManager( | 1758 new prerender::PrerenderManager( |
| 1751 this, g_browser_process->prerender_tracker())); | 1759 this, g_browser_process->prerender_tracker())); |
| 1752 } | 1760 } |
| 1753 return prerender_manager_.get(); | 1761 return prerender_manager_.get(); |
| 1754 } | 1762 } |
| OLD | NEW |