Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: content/browser/download/drag_download_file.cc

Issue 8503018: Split DownloadItem into an ABC, an Impl, and a Mock. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/download/mock_download_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698