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

Side by Side Diff: chrome/browser/download/download_service.cc

Issue 10704052: Download filename determination refactor (3/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with r147256 Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/download/download_service.h" 5 #include "chrome/browser/download/download_service.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/download/chrome_download_manager_delegate.h" 9 #include "chrome/browser/download/chrome_download_manager_delegate.h"
10 #include "chrome/browser/download/download_service_factory.h" 10 #include "chrome/browser/download/download_service_factory.h"
(...skipping 17 matching lines...) Expand all
28 void DownloadService::OnManagerCreated( 28 void DownloadService::OnManagerCreated(
29 const DownloadService::OnManagerCreatedCallback& cb) { 29 const DownloadService::OnManagerCreatedCallback& cb) {
30 if (download_manager_created_) { 30 if (download_manager_created_) {
31 DownloadManager* dm = BrowserContext::GetDownloadManager(profile_); 31 DownloadManager* dm = BrowserContext::GetDownloadManager(profile_);
32 cb.Run(dm); 32 cb.Run(dm);
33 } else { 33 } else {
34 on_manager_created_callbacks_.push_back(cb); 34 on_manager_created_callbacks_.push_back(cb);
35 } 35 }
36 } 36 }
37 37
38 DownloadManagerDelegate* DownloadService::GetDownloadManagerDelegate() { 38 ChromeDownloadManagerDelegate* DownloadService::GetDownloadManagerDelegate() {
39 DCHECK(!download_manager_created_); 39 DCHECK(!download_manager_created_);
40 download_manager_created_ = true; 40 download_manager_created_ = true;
41 41
42 // In case the delegate has already been set by 42 // In case the delegate has already been set by
43 // SetDownloadManagerDelegateForTesting. 43 // SetDownloadManagerDelegateForTesting.
44 if (!manager_delegate_.get()) 44 if (!manager_delegate_.get())
45 manager_delegate_ = new ChromeDownloadManagerDelegate(profile_); 45 manager_delegate_ = new ChromeDownloadManagerDelegate(profile_);
46 46
47 DownloadManager* dm = BrowserContext::GetDownloadManager(profile_); 47 DownloadManager* dm = BrowserContext::GetDownloadManager(profile_);
48 manager_delegate_->SetDownloadManager(dm); 48 manager_delegate_->SetDownloadManager(dm);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (download_manager_created_) { 102 if (download_manager_created_) {
103 // Normally the DownloadManager would be shutdown later, after the Profile 103 // Normally the DownloadManager would be shutdown later, after the Profile
104 // goes away and BrowserContext's destructor runs. But that would be too 104 // goes away and BrowserContext's destructor runs. But that would be too
105 // late for us since we need to use the profile (indirectly through history 105 // late for us since we need to use the profile (indirectly through history
106 // code) when the DownloadManager is shutting down. So we shut it down 106 // code) when the DownloadManager is shutting down. So we shut it down
107 // manually earlier. See http://crbug.com/131692 107 // manually earlier. See http://crbug.com/131692
108 BrowserContext::GetDownloadManager(profile_)->Shutdown(); 108 BrowserContext::GetDownloadManager(profile_)->Shutdown();
109 } 109 }
110 manager_delegate_.release(); 110 manager_delegate_.release();
111 } 111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698