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

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

Issue 11640007: Make the UI an observer of downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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_history.h" 10 #include "chrome/browser/download/download_history.h"
11 #include "chrome/browser/download/download_service_factory.h" 11 #include "chrome/browser/download/download_service_factory.h"
12 #include "chrome/browser/download/download_status_updater.h" 12 #include "chrome/browser/download/download_status_updater.h"
13 #include "chrome/browser/download/download_ui_controller.h"
13 #include "chrome/browser/history/history.h" 14 #include "chrome/browser/history/history.h"
14 #include "chrome/browser/history/history_service_factory.h" 15 #include "chrome/browser/history/history_service_factory.h"
15 #include "chrome/browser/net/chrome_net_log.h" 16 #include "chrome/browser/net/chrome_net_log.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
18 #include "content/public/browser/download_manager.h" 19 #include "content/public/browser/download_manager.h"
19 20
20 using content::BrowserContext; 21 using content::BrowserContext;
21 using content::DownloadManager; 22 using content::DownloadManager;
22 using content::DownloadManagerDelegate; 23 using content::DownloadManagerDelegate;
(...skipping 25 matching lines...) Expand all
48 if (!profile_->IsOffTheRecord()) { 49 if (!profile_->IsOffTheRecord()) {
49 HistoryService* hs = HistoryServiceFactory::GetForProfile( 50 HistoryService* hs = HistoryServiceFactory::GetForProfile(
50 profile_, Profile::EXPLICIT_ACCESS); 51 profile_, Profile::EXPLICIT_ACCESS);
51 if (hs) 52 if (hs)
52 download_history_.reset(new DownloadHistory( 53 download_history_.reset(new DownloadHistory(
53 manager, 54 manager,
54 scoped_ptr<DownloadHistory::HistoryAdapter>( 55 scoped_ptr<DownloadHistory::HistoryAdapter>(
55 new DownloadHistory::HistoryAdapter(hs)))); 56 new DownloadHistory::HistoryAdapter(hs))));
56 } 57 }
57 58
59 download_ui_.reset(new DownloadUIController(profile_, manager));
60
58 // Include this download manager in the set monitored by the 61 // Include this download manager in the set monitored by the
59 // global status updater. 62 // global status updater.
60 g_browser_process->download_status_updater()->AddManager(manager); 63 g_browser_process->download_status_updater()->AddManager(manager);
61 64
62 return manager_delegate_.get(); 65 return manager_delegate_.get();
63 } 66 }
64 67
65 DownloadHistory* DownloadService::GetDownloadHistory() { 68 DownloadHistory* DownloadService::GetDownloadHistory() {
66 if (!download_manager_created_) { 69 if (!download_manager_created_) {
67 GetDownloadManagerDelegate(); 70 GetDownloadManagerDelegate();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Normally the DownloadManager would be shutdown later, after the Profile 119 // Normally the DownloadManager would be shutdown later, after the Profile
117 // goes away and BrowserContext's destructor runs. But that would be too 120 // goes away and BrowserContext's destructor runs. But that would be too
118 // late for us since we need to use the profile (indirectly through history 121 // late for us since we need to use the profile (indirectly through history
119 // code) when the DownloadManager is shutting down. So we shut it down 122 // code) when the DownloadManager is shutting down. So we shut it down
120 // manually earlier. See http://crbug.com/131692 123 // manually earlier. See http://crbug.com/131692
121 BrowserContext::GetDownloadManager(profile_)->Shutdown(); 124 BrowserContext::GetDownloadManager(profile_)->Shutdown();
122 } 125 }
123 manager_delegate_ = NULL; 126 manager_delegate_ = NULL;
124 download_history_.reset(); 127 download_history_.reset();
125 } 128 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698