Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/browser/profile.cc

Issue 113871: Revert the password manager refactoring -- it failed reliability tests. (Closed)
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/download/download_manager.h" 16 #include "chrome/browser/download/download_manager.h"
17 #include "chrome/browser/extensions/extension_process_manager.h" 17 #include "chrome/browser/extensions/extension_process_manager.h"
18 #include "chrome/browser/extensions/extensions_service.h" 18 #include "chrome/browser/extensions/extensions_service.h"
19 #include "chrome/browser/extensions/user_script_master.h" 19 #include "chrome/browser/extensions/user_script_master.h"
20 #include "chrome/browser/history/history.h" 20 #include "chrome/browser/history/history.h"
21 #include "chrome/browser/net/chrome_url_request_context.h" 21 #include "chrome/browser/net/chrome_url_request_context.h"
22 #include "chrome/browser/password_manager/password_store_default.h"
23 #include "chrome/browser/profile_manager.h" 22 #include "chrome/browser/profile_manager.h"
24 #include "chrome/browser/renderer_host/render_process_host.h" 23 #include "chrome/browser/renderer_host/render_process_host.h"
25 #include "chrome/browser/search_engines/template_url_fetcher.h" 24 #include "chrome/browser/search_engines/template_url_fetcher.h"
26 #include "chrome/browser/search_engines/template_url_model.h" 25 #include "chrome/browser/search_engines/template_url_model.h"
27 #include "chrome/browser/sessions/session_service.h" 26 #include "chrome/browser/sessions/session_service.h"
28 #include "chrome/browser/sessions/tab_restore_service.h" 27 #include "chrome/browser/sessions/tab_restore_service.h"
29 #include "chrome/browser/spellchecker.h" 28 #include "chrome/browser/spellchecker.h"
30 #include "chrome/browser/ssl/ssl_host_state.h" 29 #include "chrome/browser/ssl/ssl_host_state.h"
31 #include "chrome/browser/browser_theme_provider.h" 30 #include "chrome/browser/browser_theme_provider.h"
32 #include "chrome/browser/visitedlink_master.h" 31 #include "chrome/browser/visitedlink_master.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // static 81 // static
83 Profile* Profile::CreateProfile(const FilePath& path) { 82 Profile* Profile::CreateProfile(const FilePath& path) {
84 return new ProfileImpl(path); 83 return new ProfileImpl(path);
85 } 84 }
86 85
87 // static 86 // static
88 URLRequestContext* Profile::GetDefaultRequestContext() { 87 URLRequestContext* Profile::GetDefaultRequestContext() {
89 return default_request_context_; 88 return default_request_context_;
90 } 89 }
91 90
92 #if defined(OS_LINUX)
93 // Temporarily disabled while we figure some stuff out.
94 // http://code.google.com/p/chromium/issues/detail?id=12351
95 // #include "chrome/browser/password_manager/password_store_gnome.h"
96 // #include "chrome/browser/password_manager/password_store_kwallet.h"
97 #elif defined(OS_WIN)
98 #include "chrome/browser/password_manager/password_store_win.h"
99 #endif
100 91
101 //////////////////////////////////////////////////////////////////////////////// 92 ////////////////////////////////////////////////////////////////////////////////
102 // 93 //
103 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile 94 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile
104 // to make it suitable for the off the record mode. 95 // to make it suitable for the off the record mode.
105 // 96 //
106 //////////////////////////////////////////////////////////////////////////////// 97 ////////////////////////////////////////////////////////////////////////////////
107 class OffTheRecordProfileImpl : public Profile, 98 class OffTheRecordProfileImpl : public Profile,
108 public NotificationObserver { 99 public NotificationObserver {
109 public: 100 public:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 184
194 virtual WebDataService* GetWebDataService(ServiceAccessType sat) { 185 virtual WebDataService* GetWebDataService(ServiceAccessType sat) {
195 if (sat == EXPLICIT_ACCESS) { 186 if (sat == EXPLICIT_ACCESS) {
196 return profile_->GetWebDataService(sat); 187 return profile_->GetWebDataService(sat);
197 } else { 188 } else {
198 NOTREACHED() << "This profile is OffTheRecord"; 189 NOTREACHED() << "This profile is OffTheRecord";
199 return NULL; 190 return NULL;
200 } 191 }
201 } 192 }
202 193
203 virtual PasswordStore* GetPasswordStore(ServiceAccessType sat) {
204 if (sat == EXPLICIT_ACCESS) {
205 return profile_->GetPasswordStore(sat);
206 } else {
207 NOTREACHED() << "This profile is OffTheRecord";
208 return NULL;
209 }
210 }
211
212 virtual PrefService* GetPrefs() { 194 virtual PrefService* GetPrefs() {
213 return profile_->GetPrefs(); 195 return profile_->GetPrefs();
214 } 196 }
215 197
216 virtual TemplateURLModel* GetTemplateURLModel() { 198 virtual TemplateURLModel* GetTemplateURLModel() {
217 return profile_->GetTemplateURLModel(); 199 return profile_->GetTemplateURLModel();
218 } 200 }
219 201
220 virtual TemplateURLFetcher* GetTemplateURLFetcher() { 202 virtual TemplateURLFetcher* GetTemplateURLFetcher() {
221 return profile_->GetTemplateURLFetcher(); 203 return profile_->GetTemplateURLFetcher();
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 DISALLOW_EVIL_CONSTRUCTORS(OffTheRecordProfileImpl); 405 DISALLOW_EVIL_CONSTRUCTORS(OffTheRecordProfileImpl);
424 }; 406 };
425 407
426 ProfileImpl::ProfileImpl(const FilePath& path) 408 ProfileImpl::ProfileImpl(const FilePath& path)
427 : path_(path), 409 : path_(path),
428 request_context_(NULL), 410 request_context_(NULL),
429 media_request_context_(NULL), 411 media_request_context_(NULL),
430 extensions_request_context_(NULL), 412 extensions_request_context_(NULL),
431 history_service_created_(false), 413 history_service_created_(false),
432 created_web_data_service_(false), 414 created_web_data_service_(false),
433 created_password_store_(false),
434 created_download_manager_(false), 415 created_download_manager_(false),
435 created_theme_provider_(false), 416 created_theme_provider_(false),
436 start_time_(Time::Now()), 417 start_time_(Time::Now()),
437 spellchecker_(NULL), 418 spellchecker_(NULL),
438 shutdown_session_service_(false) { 419 shutdown_session_service_(false) {
439 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << 420 DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
440 "profile files to the root directory!"; 421 "profile files to the root directory!";
441 create_session_service_timer_.Start( 422 create_session_service_timer_.Start(
442 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, 423 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this,
443 &ProfileImpl::EnsureSessionServiceCreated); 424 &ProfileImpl::EnsureSessionServiceCreated);
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 778
798 void ProfileImpl::CreateWebDataService() { 779 void ProfileImpl::CreateWebDataService() {
799 DCHECK(!created_web_data_service_ && web_data_service_.get() == NULL); 780 DCHECK(!created_web_data_service_ && web_data_service_.get() == NULL);
800 created_web_data_service_ = true; 781 created_web_data_service_ = true;
801 scoped_refptr<WebDataService> wds(new WebDataService()); 782 scoped_refptr<WebDataService> wds(new WebDataService());
802 if (!wds->Init(GetPath())) 783 if (!wds->Init(GetPath()))
803 return; 784 return;
804 web_data_service_.swap(wds); 785 web_data_service_.swap(wds);
805 } 786 }
806 787
807 PasswordStore* ProfileImpl::GetPasswordStore(ServiceAccessType sat) {
808 if (!created_password_store_)
809 CreatePasswordStore();
810 return password_store_.get();
811 }
812
813 void ProfileImpl::CreatePasswordStore() {
814 DCHECK(!created_password_store_ && password_store_.get() == NULL);
815 created_password_store_ = true;
816 scoped_refptr<PasswordStore> ps;
817 #if defined(OS_LINUX)
818 // Temporarily disabled while we figure some stuff out.
819 // http://code.google.com/p/chromium/issues/detail?id=12351
820 // if (getenv("KDE_FULL_SESSION")) {
821 // ps = new PasswordStoreKWallet();
822 // } else {
823 // ps = new PasswordStoreGnome();
824 // }
825 NOTIMPLEMENTED();
826 #elif defined(OS_WIN)
827 ps = new PasswordStoreWin(GetWebDataService(Profile::IMPLICIT_ACCESS));
828 #else
829 NOTIMPLEMENTED();
830 #endif
831 if (!ps || !ps->Init()) {
832 // Try falling back to the default password manager
833 LOG(WARNING) << "Could not initialise native password manager - "
834 "falling back to default";
835 ps = new PasswordStoreDefault(GetWebDataService(Profile::IMPLICIT_ACCESS));
836 if (!ps->Init())
837 return;
838 }
839 password_store_.swap(ps);
840 }
841
842 DownloadManager* ProfileImpl::GetDownloadManager() { 788 DownloadManager* ProfileImpl::GetDownloadManager() {
843 if (!created_download_manager_) { 789 if (!created_download_manager_) {
844 scoped_refptr<DownloadManager> dlm(new DownloadManager); 790 scoped_refptr<DownloadManager> dlm(new DownloadManager);
845 dlm->Init(this); 791 dlm->Init(this);
846 created_download_manager_ = true; 792 created_download_manager_ = true;
847 download_manager_.swap(dlm); 793 download_manager_.swap(dlm);
848 } 794 }
849 return download_manager_.get(); 795 return download_manager_.get();
850 } 796 }
851 797
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 1011
1066 void ProfileImpl::StopCreateSessionServiceTimer() { 1012 void ProfileImpl::StopCreateSessionServiceTimer() {
1067 create_session_service_timer_.Stop(); 1013 create_session_service_timer_.Stop();
1068 } 1014 }
1069 1015
1070 #ifdef CHROME_PERSONALIZATION 1016 #ifdef CHROME_PERSONALIZATION
1071 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { 1017 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() {
1072 return personalization_.get(); 1018 return personalization_.get();
1073 } 1019 }
1074 #endif 1020 #endif
OLDNEW
« no previous file with comments | « chrome/browser/profile.h ('k') | chrome/chrome.gyp » ('j') | chrome/chrome.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698