| 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 "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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 delete this; | 82 delete this; |
| 83 } | 83 } |
| 84 | 84 |
| 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, net::Error error) { | 92 void OnDownloadStarted(DownloadItem* item, |
| 93 DownloadInterruptReason interrupt_reason) { |
| 93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 94 if (!item) { | 95 if (!item) { |
| 95 DCHECK_NE(net::OK, error); | 96 DCHECK_NE(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
| 96 on_completed_loop_->PostTask(FROM_HERE, base::Bind(on_completed_, false)); | 97 on_completed_loop_->PostTask(FROM_HERE, base::Bind(on_completed_, false)); |
| 97 return; | 98 return; |
| 98 } | 99 } |
| 99 DCHECK_EQ(net::OK, error); | 100 DCHECK_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
| 100 download_item_ = item; | 101 download_item_ = item; |
| 101 download_item_->AddObserver(this); | 102 download_item_->AddObserver(this); |
| 102 } | 103 } |
| 103 | 104 |
| 104 // DownloadItem::Observer: | 105 // DownloadItem::Observer: |
| 105 virtual void OnDownloadUpdated(DownloadItem* item) OVERRIDE { | 106 virtual void OnDownloadUpdated(DownloadItem* item) OVERRIDE { |
| 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 107 DCHECK_EQ(download_item_, item); | 108 DCHECK_EQ(download_item_, item); |
| 108 DownloadItem::DownloadState state = download_item_->GetState(); | 109 DownloadItem::DownloadState state = download_item_->GetState(); |
| 109 if (state == DownloadItem::COMPLETE || | 110 if (state == DownloadItem::COMPLETE || |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 234 |
| 234 void DragDownloadFile::CheckThread() { | 235 void DragDownloadFile::CheckThread() { |
| 235 #if defined(OS_WIN) | 236 #if defined(OS_WIN) |
| 236 DCHECK(drag_message_loop_ == base::MessageLoop::current()); | 237 DCHECK(drag_message_loop_ == base::MessageLoop::current()); |
| 237 #else | 238 #else |
| 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 239 #endif | 240 #endif |
| 240 } | 241 } |
| 241 | 242 |
| 242 } // namespace content | 243 } // namespace content |
| OLD | NEW |