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

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

Issue 148133007: [Downloads] Always call DM::StartDownload() for explicit downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/browser/download/download_stats.h" 9 #include "content/browser/download/download_stats.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 private: 85 private:
86 virtual ~DragDownloadFileUI() { 86 virtual ~DragDownloadFileUI() {
87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
88 if (download_item_) 88 if (download_item_)
89 download_item_->RemoveObserver(this); 89 download_item_->RemoveObserver(this);
90 } 90 }
91 91
92 void OnDownloadStarted(DownloadItem* item, 92 void OnDownloadStarted(DownloadItem* item,
93 DownloadInterruptReason interrupt_reason) { 93 DownloadInterruptReason interrupt_reason) {
94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
95 if (!item) { 95 if (interrupt_reason != DOWNLOAD_INTERRUPT_REASON_NONE) {
96 DCHECK_NE(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason);
97 on_completed_loop_->PostTask(FROM_HERE, base::Bind(on_completed_, false)); 96 on_completed_loop_->PostTask(FROM_HERE, base::Bind(on_completed_, false));
98 return; 97 return;
99 } 98 }
100 DCHECK_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason);
101 download_item_ = item; 99 download_item_ = item;
102 download_item_->AddObserver(this); 100 download_item_->AddObserver(this);
103 } 101 }
104 102
105 // DownloadItem::Observer: 103 // DownloadItem::Observer:
106 virtual void OnDownloadUpdated(DownloadItem* item) OVERRIDE { 104 virtual void OnDownloadUpdated(DownloadItem* item) OVERRIDE {
107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
108 DCHECK_EQ(download_item_, item); 106 DCHECK_EQ(download_item_, item);
109 DownloadItem::DownloadState state = download_item_->GetState(); 107 DownloadItem::DownloadState state = download_item_->GetState();
110 if (state == DownloadItem::COMPLETE || 108 if (state == DownloadItem::COMPLETE ||
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 232
235 void DragDownloadFile::CheckThread() { 233 void DragDownloadFile::CheckThread() {
236 #if defined(OS_WIN) 234 #if defined(OS_WIN)
237 DCHECK(drag_message_loop_ == base::MessageLoop::current()); 235 DCHECK(drag_message_loop_ == base::MessageLoop::current());
238 #else 236 #else
239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 237 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
240 #endif 238 #endif
241 } 239 }
242 240
243 } // namespace content 241 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698