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

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

Issue 10700024: Revert 144807 - Rewrite DownloadsApiTest in C++. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/downloads/downloads_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chrome_download_manager_delegate.h" 5 #include "chrome/browser/download/chrome_download_manager_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() { 112 ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
113 } 113 }
114 114
115 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { 115 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) {
116 download_manager_ = dm; 116 download_manager_ = dm;
117 download_history_.reset(new DownloadHistory(profile_)); 117 download_history_.reset(new DownloadHistory(profile_));
118 download_history_->Load( 118 download_history_->Load(
119 base::Bind(&DownloadManager::OnPersistentStoreQueryComplete, 119 base::Bind(&DownloadManager::OnPersistentStoreQueryComplete,
120 base::Unretained(dm))); 120 base::Unretained(dm)));
121 extension_event_router_.reset(new ExtensionDownloadsEventRouter( 121 extension_event_router_.reset(new ExtensionDownloadsEventRouter(profile_));
122 profile_, download_manager_));
123 } 122 }
124 123
125 void ChromeDownloadManagerDelegate::Shutdown() { 124 void ChromeDownloadManagerDelegate::Shutdown() {
126 download_history_.reset(); 125 download_history_.reset();
127 download_prefs_.reset(); 126 download_prefs_.reset();
128 } 127 }
129 128
130 DownloadId ChromeDownloadManagerDelegate::GetNextId() { 129 DownloadId ChromeDownloadManagerDelegate::GetNextId() {
131 if (!profile_->IsOffTheRecord()) 130 if (!profile_->IsOffTheRecord())
132 return DownloadId(this, next_download_id_++); 131 return DownloadId(this, next_download_id_++);
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 int32 download_id, int64 db_handle) { 850 int32 download_id, int64 db_handle) {
852 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 851 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
853 // call this function with an invalid |db_handle|. For instance, this can 852 // call this function with an invalid |db_handle|. For instance, this can
854 // happen when the history database is offline. We cannot have multiple 853 // happen when the history database is offline. We cannot have multiple
855 // DownloadItems with the same invalid db_handle, so we need to assign a 854 // DownloadItems with the same invalid db_handle, so we need to assign a
856 // unique |db_handle| here. 855 // unique |db_handle| here.
857 if (db_handle == DownloadItem::kUninitializedHandle) 856 if (db_handle == DownloadItem::kUninitializedHandle)
858 db_handle = download_history_->GetNextFakeDbHandle(); 857 db_handle = download_history_->GetNextFakeDbHandle();
859 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 858 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
860 } 859 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/downloads/downloads_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698