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

Side by Side Diff: chrome/browser/chromeos/drive/download_handler.cc

Issue 14640020: [Resumption 9/11] Handle filename determination for resumed downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 6 months 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
« no previous file with comments | « no previous file | chrome/browser/download/chrome_download_manager_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/chromeos/drive/download_handler.h" 5 #include "chrome/browser/chromeos/drive/download_handler.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/supports_user_data.h" 9 #include "base/supports_user_data.h"
10 #include "chrome/browser/chromeos/drive/drive.pb.h" 10 #include "chrome/browser/chromeos/drive/drive.pb.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 switch (download->GetState()) { 238 switch (download->GetState()) {
239 case DownloadItem::IN_PROGRESS: 239 case DownloadItem::IN_PROGRESS:
240 break; 240 break;
241 241
242 case DownloadItem::COMPLETE: 242 case DownloadItem::COMPLETE:
243 UploadDownloadItem(download); 243 UploadDownloadItem(download);
244 data->set_complete(); 244 data->set_complete();
245 break; 245 break;
246 246
247 case DownloadItem::CANCELLED: 247 case DownloadItem::CANCELLED:
248 download->SetUserData(&kDrivePathKey, NULL);
249 break;
250
248 case DownloadItem::INTERRUPTED: 251 case DownloadItem::INTERRUPTED:
249 download->SetUserData(&kDrivePathKey, NULL); 252 // Interrupted downloads can be resumed. Keep the Drive user data around
253 // so that it can be used when the download resumes. The download is truly
254 // done when it's complete, is cancelled or is removed.
250 break; 255 break;
251 256
252 default: 257 default:
253 NOTREACHED(); 258 NOTREACHED();
254 } 259 }
255 } 260 }
256 261
257 void DownloadHandler::OnEntryFound( 262 void DownloadHandler::OnEntryFound(
258 const base::FilePath& drive_dir_path, 263 const base::FilePath& drive_dir_path,
259 const SubstituteDriveDownloadPathCallback& callback, 264 const SubstituteDriveDownloadPathCallback& callback,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 301 }
297 302
298 void DownloadHandler::UploadDownloadItem(DownloadItem* download) { 303 void DownloadHandler::UploadDownloadItem(DownloadItem* download) {
299 DCHECK(download->IsComplete()); 304 DCHECK(download->IsComplete());
300 file_write_helper_->PrepareWritableFileAndRun( 305 file_write_helper_->PrepareWritableFileAndRun(
301 util::ExtractDrivePath(GetTargetPath(download)), 306 util::ExtractDrivePath(GetTargetPath(download)),
302 base::Bind(&MoveDownloadedFile, download->GetTargetFilePath())); 307 base::Bind(&MoveDownloadedFile, download->GetTargetFilePath()));
303 } 308 }
304 309
305 } // namespace drive 310 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/chrome_download_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698