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

Side by Side Diff: chrome/browser/profiles/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_impl.h" 5 #include "chrome/browser/profiles/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/environment.h" 9 #include "base/environment.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 1257
1258 if (!ps || !ps->Init()) { 1258 if (!ps || !ps->Init()) {
1259 NOTREACHED() << "Could not initialize password manager."; 1259 NOTREACHED() << "Could not initialize password manager.";
1260 return; 1260 return;
1261 } 1261 }
1262 password_store_.swap(ps); 1262 password_store_.swap(ps);
1263 } 1263 }
1264 1264
1265 DownloadManager* ProfileImpl::GetDownloadManager() { 1265 DownloadManager* ProfileImpl::GetDownloadManager() {
1266 if (!created_download_manager_) { 1266 if (!created_download_manager_) {
1267 download_manager_delegate_= new ChromeDownloadManagerDelegate(this); 1267 // In case the delegate has already been set by SetDownloadManagerDelegate.
1268 if (!download_manager_delegate_.get())
1269 download_manager_delegate_= new ChromeDownloadManagerDelegate(this);
1268 scoped_refptr<DownloadManager> dlm( 1270 scoped_refptr<DownloadManager> dlm(
1269 new DownloadManager(download_manager_delegate_, 1271 new DownloadManager(download_manager_delegate_,
1270 g_browser_process->download_status_updater())); 1272 g_browser_process->download_status_updater()));
1271 dlm->Init(this); 1273 dlm->Init(this);
1272 download_manager_delegate_->SetDownloadManager(dlm); 1274 download_manager_delegate_->SetDownloadManager(dlm);
1273 created_download_manager_ = true; 1275 created_download_manager_ = true;
1274 download_manager_.swap(dlm); 1276 download_manager_.swap(dlm);
1275 } 1277 }
1276 return download_manager_.get(); 1278 return download_manager_.get();
1277 } 1279 }
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 #endif 1730 #endif
1729 } 1731 }
1730 return prerender_manager_.get(); 1732 return prerender_manager_.get();
1731 } 1733 }
1732 1734
1733 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { 1735 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() {
1734 if (!spellcheck_profile_.get()) 1736 if (!spellcheck_profile_.get())
1735 spellcheck_profile_.reset(new SpellCheckProfile()); 1737 spellcheck_profile_.reset(new SpellCheckProfile());
1736 return spellcheck_profile_.get(); 1738 return spellcheck_profile_.get();
1737 } 1739 }
1740
1741 void ProfileImpl::SetDownloadManagerDelegate(
1742 ChromeDownloadManagerDelegate* delegate) {
1743 download_manager_delegate_ = delegate;
1744 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698