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

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: Fix GCC build 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
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
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::INTERRUPTED:
hashimoto 2013/06/03 06:31:03 nit: Please make this the same order as written in
asanka 2013/06/03 18:35:31 Done.
248 // Interrupted downloads can be resumed. Keep the Drive user data around
249 // so that it can be used when the download resumes. The download is truly
250 // done when it's complete, is cancelled or is removed.
251 break;
252
247 case DownloadItem::CANCELLED: 253 case DownloadItem::CANCELLED:
248 case DownloadItem::INTERRUPTED:
249 download->SetUserData(&kDrivePathKey, NULL); 254 download->SetUserData(&kDrivePathKey, NULL);
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,
(...skipping 37 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

Powered by Google App Engine
This is Rietveld 408576698