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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_download_observer.cc

Issue 10735059: gdata cleanup: Make GDataFileSystem::AddUploadedFile() take scoped_ptr<DocumentEntry>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/gdata/gdata_download_observer.h" 5 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "chrome/browser/chromeos/gdata/gdata.pb.h" 9 #include "chrome/browser/chromeos/gdata/gdata.pb.h"
10 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" 10 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h"
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 512
513 void GDataDownloadObserver::MoveFileToGDataCache(DownloadItem* download) { 513 void GDataDownloadObserver::MoveFileToGDataCache(DownloadItem* download) {
514 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 514 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
515 515
516 UploadingExternalData* data = GetUploadingExternalData(download); 516 UploadingExternalData* data = GetUploadingExternalData(download);
517 if (!data) { 517 if (!data) {
518 NOTREACHED(); 518 NOTREACHED();
519 return; 519 return;
520 } 520 }
521 521
522 // Take ownership of the DocumentEntry object. It will be released upon 522 // Take ownership of the DocumentEntry object. It will be released upon
achuithb 2012/07/11 18:56:22 Maybe update this statement to note that ownership
hshi1 2012/07/11 19:25:44 Done.
523 // completion of the AddUploadedFile() call below. 523 // completion of the AddUploadedFile() call below.
524 DocumentEntry* entry = data->entry_passed().release(); 524 scoped_ptr<DocumentEntry> entry = data->entry_passed();
525 if (!entry) { 525 if (!entry.get()) {
526 NOTREACHED(); 526 NOTREACHED();
527 return; 527 return;
528 } 528 }
529 529
530 // Move downloaded file to gdata cache. Note that |content_file_path| should 530 // Move downloaded file to gdata cache. Note that |content_file_path| should
531 // use the final target path when the download item is in COMPLETE state. 531 // use the final target path when the download item is in COMPLETE state.
532 file_system_->AddUploadedFile(UPLOAD_NEW_FILE, 532 file_system_->AddUploadedFile(UPLOAD_NEW_FILE,
533 data->virtual_dir_path(), 533 data->virtual_dir_path(),
534 entry, 534 entry.Pass(),
535 download->GetTargetFilePath(), 535 download->GetTargetFilePath(),
536 GDataCache::FILE_OPERATION_MOVE, 536 GDataCache::FILE_OPERATION_MOVE,
537 base::Bind(&base::DeletePointer<DocumentEntry>, 537 base::Bind(&base::DoNothing));
538 entry));
539 } 538 }
540 539
541 } // namespace gdata 540 } // namespace gdata
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_file_system.h » ('j') | chrome/browser/chromeos/gdata/gdata_file_system.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698