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.h" | 8 #include "base/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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 void DragDownloadFile::Start(ui::DownloadFileObserver* observer) { | 183 void DragDownloadFile::Start(ui::DownloadFileObserver* observer) { |
184 CheckThread(); | 184 CheckThread(); |
185 | 185 |
186 if (state_ != INITIALIZED) | 186 if (state_ != INITIALIZED) |
187 return; | 187 return; |
188 state_ = STARTED; | 188 state_ = STARTED; |
189 | 189 |
190 DCHECK(!observer_.get()); | 190 DCHECK(!observer_.get()); |
191 observer_ = observer; | 191 observer_ = observer; |
192 DCHECK(observer_); | 192 DCHECK(observer_.get()); |
193 | 193 |
194 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( | 194 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
195 &DragDownloadFileUI::InitiateDownload, base::Unretained(drag_ui_), | 195 &DragDownloadFileUI::InitiateDownload, base::Unretained(drag_ui_), |
196 base::Passed(&file_stream_), file_path_)); | 196 base::Passed(&file_stream_), file_path_)); |
197 } | 197 } |
198 | 198 |
199 bool DragDownloadFile::Wait() { | 199 bool DragDownloadFile::Wait() { |
200 CheckThread(); | 200 CheckThread(); |
201 if (state_ == STARTED) | 201 if (state_ == STARTED) |
202 nested_loop_.Run(); | 202 nested_loop_.Run(); |
(...skipping 27 matching lines...) Expand all Loading... |
230 | 230 |
231 void DragDownloadFile::CheckThread() { | 231 void DragDownloadFile::CheckThread() { |
232 #if defined(OS_WIN) | 232 #if defined(OS_WIN) |
233 DCHECK(drag_message_loop_ == base::MessageLoop::current()); | 233 DCHECK(drag_message_loop_ == base::MessageLoop::current()); |
234 #else | 234 #else |
235 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 235 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
236 #endif | 236 #endif |
237 } | 237 } |
238 | 238 |
239 } // namespace content | 239 } // namespace content |
OLD | NEW |