OLD | NEW |
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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 private: | 90 private: |
91 ~DragDownloadFileUI() override { | 91 ~DragDownloadFileUI() override { |
92 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 92 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
93 if (download_item_) | 93 if (download_item_) |
94 download_item_->RemoveObserver(this); | 94 download_item_->RemoveObserver(this); |
95 } | 95 } |
96 | 96 |
97 void OnDownloadStarted(DownloadItem* item, | 97 void OnDownloadStarted(DownloadItem* item, |
98 DownloadInterruptReason interrupt_reason) { | 98 DownloadInterruptReason interrupt_reason) { |
99 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 99 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
100 if (!item) { | 100 if (!item || item->GetState() != DownloadItem::IN_PROGRESS) { |
101 DCHECK_NE(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); | 101 DCHECK_NE(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
102 on_completed_loop_->task_runner()->PostTask( | 102 on_completed_loop_->task_runner()->PostTask( |
103 FROM_HERE, base::Bind(on_completed_, false)); | 103 FROM_HERE, base::Bind(on_completed_, false)); |
104 return; | 104 return; |
105 } | 105 } |
106 DCHECK_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); | 106 DCHECK_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
107 download_item_ = item; | 107 download_item_ = item; |
108 download_item_->AddObserver(this); | 108 download_item_->AddObserver(this); |
109 } | 109 } |
110 | 110 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 void DragDownloadFile::CheckThread() { | 242 void DragDownloadFile::CheckThread() { |
243 #if defined(OS_WIN) | 243 #if defined(OS_WIN) |
244 DCHECK(drag_message_loop_ == base::MessageLoop::current()); | 244 DCHECK(drag_message_loop_ == base::MessageLoop::current()); |
245 #else | 245 #else |
246 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 246 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
247 #endif | 247 #endif |
248 } | 248 } |
249 | 249 |
250 } // namespace content | 250 } // namespace content |
OLD | NEW |