Chromium Code Reviews| 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/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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 DownloadSaveInfo save_info; | 132 DownloadSaveInfo save_info; |
| 133 save_info.file_path = file_path_; | 133 save_info.file_path = file_path_; |
| 134 save_info.file_stream = file_stream_; | 134 save_info.file_stream = file_stream_; |
| 135 | 135 |
| 136 download_manager_->DownloadUrl(url_, | 136 download_manager_->DownloadUrl(url_, |
| 137 referrer_, | 137 referrer_, |
| 138 referrer_encoding_, | 138 referrer_encoding_, |
| 139 false, | 139 false, |
| 140 save_info, | 140 save_info, |
| 141 web_contents_); | 141 web_contents_); |
| 142 download_stats::RecordDownloadCount( | 142 download_stats::RecordDownloadSource( |
|
cbentzel
2012/02/06 19:57:29
Most of the other cases record prior to doing the
Randy Smith (Not in Mondays)
2012/02/07 18:20:18
Done.
| |
| 143 download_stats::INITIATED_BY_DRAG_N_DROP_COUNT); | 143 download_stats::INITIATED_BY_DRAG_N_DROP); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void DragDownloadFile::DownloadCompleted(bool is_successful) { | 146 void DragDownloadFile::DownloadCompleted(bool is_successful) { |
| 147 #if defined(OS_WIN) | 147 #if defined(OS_WIN) |
| 148 // If not in drag-and-drop thread, defer the running to it. | 148 // If not in drag-and-drop thread, defer the running to it. |
| 149 if (drag_message_loop_ != MessageLoop::current()) { | 149 if (drag_message_loop_ != MessageLoop::current()) { |
| 150 drag_message_loop_->PostTask( | 150 drag_message_loop_->PostTask( |
| 151 FROM_HERE, | 151 FROM_HERE, |
| 152 base::Bind(&DragDownloadFile::DownloadCompleted, this, is_successful)); | 152 base::Bind(&DragDownloadFile::DownloadCompleted, this, is_successful)); |
| 153 return; | 153 return; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 | 230 |
| 231 void DragDownloadFile::QuitNestedMessageLoop() { | 231 void DragDownloadFile::QuitNestedMessageLoop() { |
| 232 AssertCurrentlyOnDragThread(); | 232 AssertCurrentlyOnDragThread(); |
| 233 | 233 |
| 234 if (is_running_nested_message_loop_) { | 234 if (is_running_nested_message_loop_) { |
| 235 is_running_nested_message_loop_ = false; | 235 is_running_nested_message_loop_ = false; |
| 236 MessageLoop::current()->Quit(); | 236 MessageLoop::current()->Quit(); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 #endif | 239 #endif |
| OLD | NEW |