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

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

Issue 118047: Reverting 17273 - Fails reliability tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/profile.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 182
192 virtual WebDataService* GetWebDataService(ServiceAccessType sat) { 183 virtual WebDataService* GetWebDataService(ServiceAccessType sat) {
193 if (sat == EXPLICIT_ACCESS) { 184 if (sat == EXPLICIT_ACCESS) {
194 return profile_->GetWebDataService(sat); 185 return profile_->GetWebDataService(sat);
195 } else { 186 } else {
196 NOTREACHED() << "This profile is OffTheRecord"; 187 NOTREACHED() << "This profile is OffTheRecord";
197 return NULL; 188 return NULL;
198 } 189 }
199 } 190 }
200 191
201 virtual PasswordStore* GetPasswordStore(ServiceAccessType sat) {
202 if (sat == EXPLICIT_ACCESS) {
203 return profile_->GetPasswordStore(sat);
204 } else {
205 NOTREACHED() << "This profile is OffTheRecord";
206 return NULL;
207 }
208 }
209
210 virtual PrefService* GetPrefs() { 192 virtual PrefService* GetPrefs() {
211 return profile_->GetPrefs(); 193 return profile_->GetPrefs();
212 } 194 }
213 195
214 virtual TemplateURLModel* GetTemplateURLModel() { 196 virtual TemplateURLModel* GetTemplateURLModel() {
215 return profile_->GetTemplateURLModel(); 197 return profile_->GetTemplateURLModel();
216 } 198 }
217 199
218 virtual TemplateURLFetcher* GetTemplateURLFetcher() { 200 virtual TemplateURLFetcher* GetTemplateURLFetcher() {
219 return profile_->GetTemplateURLFetcher(); 201 return profile_->GetTemplateURLFetcher();
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 DISALLOW_EVIL_CONSTRUCTORS(OffTheRecordProfileImpl); 382 DISALLOW_EVIL_CONSTRUCTORS(OffTheRecordProfileImpl);
401 }; 383 };
402 384
403 ProfileImpl::ProfileImpl(const FilePath& path) 385 ProfileImpl::ProfileImpl(const FilePath& path)
404 : path_(path), 386 : path_(path),
405 request_context_(NULL), 387 request_context_(NULL),
406 media_request_context_(NULL), 388 media_request_context_(NULL),
407 extensions_request_context_(NULL), 389 extensions_request_context_(NULL),
408 history_service_created_(false), 390 history_service_created_(false),
409 created_web_data_service_(false), 391 created_web_data_service_(false),
410 created_password_store_(false),
411 created_download_manager_(false), 392 created_download_manager_(false),
412 created_theme_provider_(false), 393 created_theme_provider_(false),
413 start_time_(Time::Now()), 394 start_time_(Time::Now()),
414 spellchecker_(NULL), 395 spellchecker_(NULL),
415 shutdown_session_service_(false) { 396 shutdown_session_service_(false) {
416 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << 397 DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
417 "profile files to the root directory!"; 398 "profile files to the root directory!";
418 create_session_service_timer_.Start( 399 create_session_service_timer_.Start(
419 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, 400 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this,
420 &ProfileImpl::EnsureSessionServiceCreated); 401 &ProfileImpl::EnsureSessionServiceCreated);
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 755
775 void ProfileImpl::CreateWebDataService() { 756 void ProfileImpl::CreateWebDataService() {
776 DCHECK(!created_web_data_service_ && web_data_service_.get() == NULL); 757 DCHECK(!created_web_data_service_ && web_data_service_.get() == NULL);
777 created_web_data_service_ = true; 758 created_web_data_service_ = true;
778 scoped_refptr<WebDataService> wds(new WebDataService()); 759 scoped_refptr<WebDataService> wds(new WebDataService());
779 if (!wds->Init(GetPath())) 760 if (!wds->Init(GetPath()))
780 return; 761 return;
781 web_data_service_.swap(wds); 762 web_data_service_.swap(wds);
782 } 763 }
783 764
784 PasswordStore* ProfileImpl::GetPasswordStore(ServiceAccessType sat) {
785 if (!created_password_store_)
786 CreatePasswordStore();
787 return password_store_.get();
788 }
789
790 void ProfileImpl::CreatePasswordStore() {
791 DCHECK(!created_password_store_ && password_store_.get() == NULL);
792 created_password_store_ = true;
793 scoped_refptr<PasswordStore> ps;
794 #if defined(OS_LINUX)
795 // Temporarily disabled while we figure some stuff out.
796 // http://code.google.com/p/chromium/issues/detail?id=12351
797 // if (getenv("KDE_FULL_SESSION")) {
798 // ps = new PasswordStoreKWallet();
799 // } else {
800 // ps = new PasswordStoreGnome();
801 // }
802 NOTIMPLEMENTED();
803 #elif defined(OS_WIN)
804 ps = new PasswordStoreWin(GetWebDataService(Profile::IMPLICIT_ACCESS));
805 #else
806 NOTIMPLEMENTED();
807 #endif
808 if (!ps || !ps->Init()) {
809 // Try falling back to the default password manager
810 LOG(WARNING) << "Could not initialise native password manager - "
811 "falling back to default";
812 ps = new PasswordStoreDefault(GetWebDataService(Profile::IMPLICIT_ACCESS));
813 if (!ps->Init())
814 return;
815 }
816 password_store_.swap(ps);
817 }
818
819 DownloadManager* ProfileImpl::GetDownloadManager() { 765 DownloadManager* ProfileImpl::GetDownloadManager() {
820 if (!created_download_manager_) { 766 if (!created_download_manager_) {
821 scoped_refptr<DownloadManager> dlm(new DownloadManager); 767 scoped_refptr<DownloadManager> dlm(new DownloadManager);
822 dlm->Init(this); 768 dlm->Init(this);
823 created_download_manager_ = true; 769 created_download_manager_ = true;
824 download_manager_.swap(dlm); 770 download_manager_.swap(dlm);
825 } 771 }
826 return download_manager_.get(); 772 return download_manager_.get();
827 } 773 }
828 774
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 988
1043 void ProfileImpl::StopCreateSessionServiceTimer() { 989 void ProfileImpl::StopCreateSessionServiceTimer() {
1044 create_session_service_timer_.Stop(); 990 create_session_service_timer_.Stop();
1045 } 991 }
1046 992
1047 #ifdef CHROME_PERSONALIZATION 993 #ifdef CHROME_PERSONALIZATION
1048 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { 994 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() {
1049 return personalization_.get(); 995 return personalization_.get();
1050 } 996 }
1051 #endif 997 #endif
OLDNEW
« no previous file with comments | « chrome/browser/profile.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698