| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/profile.h" | 5 #include "chrome/browser/profile.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model.h" | 13 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 14 #include "chrome/browser/browser_list.h" | 14 #include "chrome/browser/browser_list.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/browser_theme_provider.h" | 16 #include "chrome/browser/browser_theme_provider.h" |
| 17 #include "chrome/browser/download/download_manager.h" | 17 #include "chrome/browser/download/download_manager.h" |
| 18 #include "chrome/browser/extensions/extension_message_service.h" |
| 18 #include "chrome/browser/extensions/extension_process_manager.h" | 19 #include "chrome/browser/extensions/extension_process_manager.h" |
| 19 #include "chrome/browser/extensions/extensions_service.h" | 20 #include "chrome/browser/extensions/extensions_service.h" |
| 20 #include "chrome/browser/extensions/user_script_master.h" | 21 #include "chrome/browser/extensions/user_script_master.h" |
| 21 #include "chrome/browser/history/history.h" | 22 #include "chrome/browser/history/history.h" |
| 22 #include "chrome/browser/in_process_webkit/webkit_context.h" | 23 #include "chrome/browser/in_process_webkit/webkit_context.h" |
| 23 #include "chrome/browser/net/chrome_url_request_context.h" | 24 #include "chrome/browser/net/chrome_url_request_context.h" |
| 24 #include "chrome/browser/password_manager/password_store_default.h" | 25 #include "chrome/browser/password_manager/password_store_default.h" |
| 25 #include "chrome/browser/privacy_blacklist/blacklist.h" | 26 #include "chrome/browser/privacy_blacklist/blacklist.h" |
| 26 #include "chrome/browser/profile_manager.h" | 27 #include "chrome/browser/profile_manager.h" |
| 27 #include "chrome/browser/renderer_host/render_process_host.h" | 28 #include "chrome/browser/renderer_host/render_process_host.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 214 } |
| 214 | 215 |
| 215 virtual UserScriptMaster* GetUserScriptMaster() { | 216 virtual UserScriptMaster* GetUserScriptMaster() { |
| 216 return profile_->GetUserScriptMaster(); | 217 return profile_->GetUserScriptMaster(); |
| 217 } | 218 } |
| 218 | 219 |
| 219 virtual ExtensionProcessManager* GetExtensionProcessManager() { | 220 virtual ExtensionProcessManager* GetExtensionProcessManager() { |
| 220 return NULL; | 221 return NULL; |
| 221 } | 222 } |
| 222 | 223 |
| 224 virtual ExtensionMessageService* GetExtensionMessageService() { |
| 225 return NULL; |
| 226 } |
| 227 |
| 223 virtual SSLHostState* GetSSLHostState() { | 228 virtual SSLHostState* GetSSLHostState() { |
| 224 if (!ssl_host_state_.get()) | 229 if (!ssl_host_state_.get()) |
| 225 ssl_host_state_.reset(new SSLHostState()); | 230 ssl_host_state_.reset(new SSLHostState()); |
| 226 | 231 |
| 227 DCHECK(ssl_host_state_->CalledOnValidThread()); | 232 DCHECK(ssl_host_state_->CalledOnValidThread()); |
| 228 return ssl_host_state_.get(); | 233 return ssl_host_state_.get(); |
| 229 } | 234 } |
| 230 | 235 |
| 231 virtual net::ForceTLSState* GetForceTLSState() { | 236 virtual net::ForceTLSState* GetForceTLSState() { |
| 232 if (!force_tls_state_.get()) | 237 if (!force_tls_state_.get()) |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 start_time_(Time::Now()), | 497 start_time_(Time::Now()), |
| 493 spellchecker_(NULL), | 498 spellchecker_(NULL), |
| 494 shutdown_session_service_(false) { | 499 shutdown_session_service_(false) { |
| 495 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << | 500 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << |
| 496 "profile files to the root directory!"; | 501 "profile files to the root directory!"; |
| 497 create_session_service_timer_.Start( | 502 create_session_service_timer_.Start( |
| 498 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, | 503 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
| 499 &ProfileImpl::EnsureSessionServiceCreated); | 504 &ProfileImpl::EnsureSessionServiceCreated); |
| 500 | 505 |
| 501 extension_process_manager_.reset(new ExtensionProcessManager(this)); | 506 extension_process_manager_.reset(new ExtensionProcessManager(this)); |
| 507 extension_message_service_ = new ExtensionMessageService(this); |
| 502 | 508 |
| 503 PrefService* prefs = GetPrefs(); | 509 PrefService* prefs = GetPrefs(); |
| 504 prefs->AddPrefObserver(prefs::kSpellCheckDictionary, this); | 510 prefs->AddPrefObserver(prefs::kSpellCheckDictionary, this); |
| 505 prefs->AddPrefObserver(prefs::kEnableSpellCheck, this); | 511 prefs->AddPrefObserver(prefs::kEnableSpellCheck, this); |
| 506 prefs->AddPrefObserver(prefs::kEnableAutoSpellCorrect, this); | 512 prefs->AddPrefObserver(prefs::kEnableAutoSpellCorrect, this); |
| 507 | 513 |
| 508 #ifdef CHROME_PERSONALIZATION | 514 #ifdef CHROME_PERSONALIZATION |
| 509 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableP13n)) | 515 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableP13n)) |
| 510 personalization_.reset(Personalization::CreateProfilePersonalization(this)); | 516 personalization_.reset(Personalization::CreateProfilePersonalization(this)); |
| 511 #endif | 517 #endif |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 blacklist_ = 0; | 656 blacklist_ = 0; |
| 651 | 657 |
| 652 // HistoryService may call into the BookmarkModel, as such we need to | 658 // HistoryService may call into the BookmarkModel, as such we need to |
| 653 // delete HistoryService before the BookmarkModel. The destructor for | 659 // delete HistoryService before the BookmarkModel. The destructor for |
| 654 // HistoryService will join with HistoryService's backend thread so that | 660 // HistoryService will join with HistoryService's backend thread so that |
| 655 // by the time the destructor has finished we're sure it will no longer call | 661 // by the time the destructor has finished we're sure it will no longer call |
| 656 // into the BookmarkModel. | 662 // into the BookmarkModel. |
| 657 history_service_ = NULL; | 663 history_service_ = NULL; |
| 658 bookmark_bar_model_.reset(); | 664 bookmark_bar_model_.reset(); |
| 659 | 665 |
| 666 extension_message_service_->ProfileDestroyed(); |
| 667 |
| 660 MarkAsCleanShutdown(); | 668 MarkAsCleanShutdown(); |
| 661 } | 669 } |
| 662 | 670 |
| 663 FilePath ProfileImpl::GetPath() { | 671 FilePath ProfileImpl::GetPath() { |
| 664 return path_; | 672 return path_; |
| 665 } | 673 } |
| 666 | 674 |
| 667 bool ProfileImpl::IsOffTheRecord() { | 675 bool ProfileImpl::IsOffTheRecord() { |
| 668 return false; | 676 return false; |
| 669 } | 677 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 } | 710 } |
| 703 | 711 |
| 704 UserScriptMaster* ProfileImpl::GetUserScriptMaster() { | 712 UserScriptMaster* ProfileImpl::GetUserScriptMaster() { |
| 705 return user_script_master_.get(); | 713 return user_script_master_.get(); |
| 706 } | 714 } |
| 707 | 715 |
| 708 ExtensionProcessManager* ProfileImpl::GetExtensionProcessManager() { | 716 ExtensionProcessManager* ProfileImpl::GetExtensionProcessManager() { |
| 709 return extension_process_manager_.get(); | 717 return extension_process_manager_.get(); |
| 710 } | 718 } |
| 711 | 719 |
| 720 ExtensionMessageService* ProfileImpl::GetExtensionMessageService() { |
| 721 return extension_message_service_.get(); |
| 722 } |
| 723 |
| 712 SSLHostState* ProfileImpl::GetSSLHostState() { | 724 SSLHostState* ProfileImpl::GetSSLHostState() { |
| 713 if (!ssl_host_state_.get()) | 725 if (!ssl_host_state_.get()) |
| 714 ssl_host_state_.reset(new SSLHostState()); | 726 ssl_host_state_.reset(new SSLHostState()); |
| 715 | 727 |
| 716 DCHECK(ssl_host_state_->CalledOnValidThread()); | 728 DCHECK(ssl_host_state_->CalledOnValidThread()); |
| 717 return ssl_host_state_.get(); | 729 return ssl_host_state_.get(); |
| 718 } | 730 } |
| 719 | 731 |
| 720 net::ForceTLSState* ProfileImpl::GetForceTLSState() { | 732 net::ForceTLSState* ProfileImpl::GetForceTLSState() { |
| 721 if (!force_tls_state_.get()) | 733 if (!force_tls_state_.get()) |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 | 1175 |
| 1164 void ProfileImpl::StopCreateSessionServiceTimer() { | 1176 void ProfileImpl::StopCreateSessionServiceTimer() { |
| 1165 create_session_service_timer_.Stop(); | 1177 create_session_service_timer_.Stop(); |
| 1166 } | 1178 } |
| 1167 | 1179 |
| 1168 #ifdef CHROME_PERSONALIZATION | 1180 #ifdef CHROME_PERSONALIZATION |
| 1169 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { | 1181 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { |
| 1170 return personalization_.get(); | 1182 return personalization_.get(); |
| 1171 } | 1183 } |
| 1172 #endif | 1184 #endif |
| OLD | NEW |