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

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: Merged to TOT. Again. 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/off_the_record_profile_impl.h" 5 #include "chrome/browser/profiles/off_the_record_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/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 PrefService* OffTheRecordProfileImpl::GetOffTheRecordPrefs() { 319 PrefService* OffTheRecordProfileImpl::GetOffTheRecordPrefs() {
320 return prefs_; 320 return prefs_;
321 } 321 }
322 322
323 TemplateURLFetcher* OffTheRecordProfileImpl::GetTemplateURLFetcher() { 323 TemplateURLFetcher* OffTheRecordProfileImpl::GetTemplateURLFetcher() {
324 return profile_->GetTemplateURLFetcher(); 324 return profile_->GetTemplateURLFetcher();
325 } 325 }
326 326
327 DownloadManager* OffTheRecordProfileImpl::GetDownloadManager() { 327 DownloadManager* OffTheRecordProfileImpl::GetDownloadManager() {
328 if (!download_manager_.get()) { 328 if (!download_manager_.get()) {
329 download_manager_delegate_ = new ChromeDownloadManagerDelegate(this); 329 // In case the delegate has already been set by
330 // SetDownloadManagerDelegate.
331 if (!download_manager_delegate_.get())
332 download_manager_delegate_ = new ChromeDownloadManagerDelegate(this);
330 scoped_refptr<DownloadManager> dlm( 333 scoped_refptr<DownloadManager> dlm(
331 new DownloadManager(download_manager_delegate_, 334 new DownloadManager(download_manager_delegate_,
332 g_browser_process->download_status_updater())); 335 g_browser_process->download_status_updater()));
333 dlm->Init(this); 336 dlm->Init(this);
334 download_manager_delegate_->SetDownloadManager(dlm); 337 download_manager_delegate_->SetDownloadManager(dlm);
335 download_manager_.swap(dlm); 338 download_manager_.swap(dlm);
336 } 339 }
337 return download_manager_.get(); 340 return download_manager_.get();
338 } 341 }
339 342
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 const NotificationDetails& details) { 611 const NotificationDetails& details) {
609 if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) { 612 if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) {
610 const std::string& host = *(Details<const std::string>(details).ptr()); 613 const std::string& host = *(Details<const std::string>(details).ptr());
611 if (!host.empty()) { 614 if (!host.empty()) {
612 double level = profile_->GetHostZoomMap()->GetZoomLevel(host); 615 double level = profile_->GetHostZoomMap()->GetZoomLevel(host);
613 GetHostZoomMap()->SetZoomLevel(host, level); 616 GetHostZoomMap()->SetZoomLevel(host, level);
614 } 617 }
615 } 618 }
616 } 619 }
617 620
621 void OffTheRecordProfileImpl::SetDownloadManagerDelegate(
622 ChromeDownloadManagerDelegate* delegate) {
623 download_manager_delegate_ = delegate;
624 }
625
618 void OffTheRecordProfileImpl::CreateQuotaManagerAndClients() { 626 void OffTheRecordProfileImpl::CreateQuotaManagerAndClients() {
619 if (quota_manager_.get()) { 627 if (quota_manager_.get()) {
620 DCHECK(file_system_context_.get()); 628 DCHECK(file_system_context_.get());
621 DCHECK(db_tracker_.get()); 629 DCHECK(db_tracker_.get());
622 DCHECK(webkit_context_.get()); 630 DCHECK(webkit_context_.get());
623 return; 631 return;
624 } 632 }
625 633
626 // All of the clients have to be created and registered with the 634 // All of the clients have to be created and registered with the
627 // QuotaManager prior to the QuotaManger being used. So we do them 635 // QuotaManager prior to the QuotaManger being used. So we do them
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 694
687 Profile* Profile::CreateOffTheRecordProfile() { 695 Profile* Profile::CreateOffTheRecordProfile() {
688 #if defined(OS_CHROMEOS) 696 #if defined(OS_CHROMEOS)
689 if (Profile::IsGuestSession()) 697 if (Profile::IsGuestSession())
690 return new GuestSessionProfile(this); 698 return new GuestSessionProfile(this);
691 #endif 699 #endif
692 OffTheRecordProfileImpl* profile = new OffTheRecordProfileImpl(this); 700 OffTheRecordProfileImpl* profile = new OffTheRecordProfileImpl(this);
693 profile->Init(); 701 profile->Init();
694 return profile; 702 return profile;
695 } 703 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.h ('k') | chrome/browser/profiles/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698