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

Side by Side Diff: chrome/browser/profiles/off_the_record_profile_impl.cc

Issue 7859001: Added ability to set ChromeDownloadManagerDelegate for testing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Various nits from self-review. Created 9 years, 3 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
OLDNEW
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.h" 5 #include "chrome/browser/profiles/profile.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 virtual PrefService* GetOffTheRecordPrefs() { 309 virtual PrefService* GetOffTheRecordPrefs() {
310 return prefs_; 310 return prefs_;
311 } 311 }
312 312
313 virtual TemplateURLFetcher* GetTemplateURLFetcher() { 313 virtual TemplateURLFetcher* GetTemplateURLFetcher() {
314 return profile_->GetTemplateURLFetcher(); 314 return profile_->GetTemplateURLFetcher();
315 } 315 }
316 316
317 virtual DownloadManager* GetDownloadManager() { 317 virtual DownloadManager* GetDownloadManager() {
318 if (!download_manager_.get()) { 318 if (!download_manager_.get()) {
319 download_manager_delegate_ = new ChromeDownloadManagerDelegate(this); 319 // In case the delegate has already been set by
320 // SetDownloadManagerDelegate.
321 if (!download_manager_delegate_.get())
322 download_manager_delegate_ = new ChromeDownloadManagerDelegate(this);
320 scoped_refptr<DownloadManager> dlm( 323 scoped_refptr<DownloadManager> dlm(
321 new DownloadManager(download_manager_delegate_, 324 new DownloadManager(download_manager_delegate_,
322 g_browser_process->download_status_updater())); 325 g_browser_process->download_status_updater()));
323 dlm->Init(this); 326 dlm->Init(this);
324 download_manager_delegate_->SetDownloadManager(dlm); 327 download_manager_delegate_->SetDownloadManager(dlm);
325 download_manager_.swap(dlm); 328 download_manager_.swap(dlm);
326 } 329 }
327 return download_manager_.get(); 330 return download_manager_.get();
328 } 331 }
329 332
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 } 576 }
574 577
575 virtual prerender::PrerenderManager* GetPrerenderManager() { 578 virtual prerender::PrerenderManager* GetPrerenderManager() {
576 // We do not allow prerendering in OTR profiles at this point. 579 // We do not allow prerendering in OTR profiles at this point.
577 // TODO(tburkard): Figure out if we want to support this, and how, at some 580 // TODO(tburkard): Figure out if we want to support this, and how, at some
578 // point in the future. 581 // point in the future.
579 return NULL; 582 return NULL;
580 } 583 }
581 584
582 private: 585 private:
586 virtual void SetDownloadManagerDelegate(
587 ChromeDownloadManagerDelegate* delegate) {
588 download_manager_delegate_ = delegate;
589 }
590
583 void CreateQuotaManagerAndClients() { 591 void CreateQuotaManagerAndClients() {
584 if (quota_manager_.get()) { 592 if (quota_manager_.get()) {
585 DCHECK(file_system_context_.get()); 593 DCHECK(file_system_context_.get());
586 DCHECK(db_tracker_.get()); 594 DCHECK(db_tracker_.get());
587 DCHECK(webkit_context_.get()); 595 DCHECK(webkit_context_.get());
588 return; 596 return;
589 } 597 }
590 598
591 // All of the clients have to be created and registered with the 599 // All of the clients have to be created and registered with the
592 // QuotaManager prior to the QuotaManger being used. So we do them 600 // QuotaManager prior to the QuotaManger being used. So we do them
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 }; 726 };
719 #endif 727 #endif
720 728
721 Profile* Profile::CreateOffTheRecordProfile() { 729 Profile* Profile::CreateOffTheRecordProfile() {
722 #if defined(OS_CHROMEOS) 730 #if defined(OS_CHROMEOS)
723 if (Profile::IsGuestSession()) 731 if (Profile::IsGuestSession())
724 return new GuestSessionProfile(this); 732 return new GuestSessionProfile(this);
725 #endif 733 #endif
726 return new OffTheRecordProfileImpl(this); 734 return new OffTheRecordProfileImpl(this);
727 } 735 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698