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

Side by Side Diff: content/browser/download/drag_download_file.cc

Issue 10913015: Reland DownloadManager::GetAllDownloads actually does now (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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) 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 "content/browser/download/drag_download_file.h" 5 #include "content/browser/download/drag_download_file.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "content/browser/download/download_stats.h" 10 #include "content/browser/download/download_stats.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 176 }
177 177
178 void DragDownloadFile::ModelChanged(DownloadManager* manager) { 178 void DragDownloadFile::ModelChanged(DownloadManager* manager) {
179 AssertCurrentlyOnUIThread(); 179 AssertCurrentlyOnUIThread();
180 DCHECK_EQ(manager, download_manager_); 180 DCHECK_EQ(manager, download_manager_);
181 181
182 if (download_item_) 182 if (download_item_)
183 return; 183 return;
184 184
185 std::vector<DownloadItem*> downloads; 185 std::vector<DownloadItem*> downloads;
186 download_manager_->GetTemporaryDownloads(file_path_.DirName(), &downloads); 186 download_manager_->GetAllDownloads(&downloads);
187 for (std::vector<DownloadItem*>::const_iterator i = downloads.begin(); 187 for (std::vector<DownloadItem*>::const_iterator i = downloads.begin();
188 i != downloads.end(); ++i) { 188 i != downloads.end(); ++i) {
189 if ((*i)->GetOriginalUrl() == url_) { 189 DownloadItem* item = *i;
190 download_item_ = *i; 190 if (item->IsTemporary() &&
191 item->GetOriginalUrl() == url_ &&
192 file_path_.DirName() == item->GetTargetFilePath().DirName()) {
193 download_item_ = item;
191 download_item_->AddObserver(this); 194 download_item_->AddObserver(this);
192 break; 195 break;
193 } 196 }
194 } 197 }
195 } 198 }
196 199
197 void DragDownloadFile::OnDownloadUpdated(content::DownloadItem* download) { 200 void DragDownloadFile::OnDownloadUpdated(content::DownloadItem* download) {
198 AssertCurrentlyOnUIThread(); 201 AssertCurrentlyOnUIThread();
199 if (download->IsCancelled()) { 202 if (download->IsCancelled()) {
200 RemoveObservers(); 203 RemoveObservers();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 246
244 void DragDownloadFile::QuitNestedMessageLoop() { 247 void DragDownloadFile::QuitNestedMessageLoop() {
245 AssertCurrentlyOnDragThread(); 248 AssertCurrentlyOnDragThread();
246 249
247 if (is_running_nested_message_loop_) { 250 if (is_running_nested_message_loop_) {
248 is_running_nested_message_loop_ = false; 251 is_running_nested_message_loop_ = false;
249 MessageLoop::current()->Quit(); 252 MessageLoop::current()->Quit();
250 } 253 }
251 } 254 }
252 #endif 255 #endif
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/public/browser/download_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698