OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_context.h" | 10 #include "content/browser/browser_context.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 void DragDownloadFile::ModelChanged() { | 167 void DragDownloadFile::ModelChanged() { |
168 AssertCurrentlyOnUIThread(); | 168 AssertCurrentlyOnUIThread(); |
169 | 169 |
170 if (download_item_) | 170 if (download_item_) |
171 return; | 171 return; |
172 | 172 |
173 std::vector<DownloadItem*> downloads; | 173 std::vector<DownloadItem*> downloads; |
174 download_manager_->GetTemporaryDownloads(file_path_.DirName(), &downloads); | 174 download_manager_->GetTemporaryDownloads(file_path_.DirName(), &downloads); |
175 for (std::vector<DownloadItem*>::const_iterator i = downloads.begin(); | 175 for (std::vector<DownloadItem*>::const_iterator i = downloads.begin(); |
176 i != downloads.end(); ++i) { | 176 i != downloads.end(); ++i) { |
177 if ((*i)->original_url() == url_) { | 177 if ((*i)->GetOriginalUrl() == url_) { |
178 download_item_ = *i; | 178 download_item_ = *i; |
179 download_item_->AddObserver(this); | 179 download_item_->AddObserver(this); |
180 break; | 180 break; |
181 } | 181 } |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 void DragDownloadFile::OnDownloadUpdated(DownloadItem* download) { | 185 void DragDownloadFile::OnDownloadUpdated(DownloadItem* download) { |
186 AssertCurrentlyOnUIThread(); | 186 AssertCurrentlyOnUIThread(); |
187 if (download->IsCancelled() || download->state() == DownloadItem::REMOVING) { | 187 if (download->IsCancelled() || |
| 188 (download->GetState() == DownloadItem::REMOVING)) { |
188 RemoveObservers(); | 189 RemoveObservers(); |
189 DownloadCompleted(false); | 190 DownloadCompleted(false); |
190 } else if (download->IsComplete()) { | 191 } else if (download->IsComplete()) { |
191 RemoveObservers(); | 192 RemoveObservers(); |
192 DownloadCompleted(true); | 193 DownloadCompleted(true); |
193 } | 194 } |
194 // Ignore other states. | 195 // Ignore other states. |
195 } | 196 } |
196 | 197 |
197 void DragDownloadFile::AssertCurrentlyOnDragThread() { | 198 void DragDownloadFile::AssertCurrentlyOnDragThread() { |
(...skipping 23 matching lines...) Expand all Loading... |
221 | 222 |
222 void DragDownloadFile::QuitNestedMessageLoop() { | 223 void DragDownloadFile::QuitNestedMessageLoop() { |
223 AssertCurrentlyOnDragThread(); | 224 AssertCurrentlyOnDragThread(); |
224 | 225 |
225 if (is_running_nested_message_loop_) { | 226 if (is_running_nested_message_loop_) { |
226 is_running_nested_message_loop_ = false; | 227 is_running_nested_message_loop_ = false; |
227 MessageLoop::current()->Quit(); | 228 MessageLoop::current()->Quit(); |
228 } | 229 } |
229 } | 230 } |
230 #endif | 231 #endif |
OLD | NEW |