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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/folder_creator.cc

Issue 1873683002: Convert //chrome/browser/sync_file_system from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/sync_file_system/drive_backend/folder_creator.h" 5 #include "chrome/browser/sync_file_system/drive_backend/folder_creator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" 10 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h"
(...skipping 29 matching lines...) Expand all
40 options.visibility = google_apis::drive::FILE_VISIBILITY_PRIVATE; 40 options.visibility = google_apis::drive::FILE_VISIBILITY_PRIVATE;
41 drive_service_->AddNewDirectory( 41 drive_service_->AddNewDirectory(
42 parent_folder_id_, title_, options, 42 parent_folder_id_, title_, options,
43 base::Bind(&FolderCreator::DidCreateFolder, 43 base::Bind(&FolderCreator::DidCreateFolder,
44 weak_ptr_factory_.GetWeakPtr(), callback)); 44 weak_ptr_factory_.GetWeakPtr(), callback));
45 } 45 }
46 46
47 void FolderCreator::DidCreateFolder( 47 void FolderCreator::DidCreateFolder(
48 const FileIDCallback& callback, 48 const FileIDCallback& callback,
49 google_apis::DriveApiErrorCode error, 49 google_apis::DriveApiErrorCode error,
50 scoped_ptr<google_apis::FileResource> entry) { 50 std::unique_ptr<google_apis::FileResource> entry) {
51 SyncStatusCode status = DriveApiErrorCodeToSyncStatusCode(error); 51 SyncStatusCode status = DriveApiErrorCodeToSyncStatusCode(error);
52 if (status != SYNC_STATUS_OK) { 52 if (status != SYNC_STATUS_OK) {
53 callback.Run(std::string(), status); 53 callback.Run(std::string(), status);
54 return; 54 return;
55 } 55 }
56 56
57 drive_service_->SearchByTitle( 57 drive_service_->SearchByTitle(
58 title_, parent_folder_id_, 58 title_, parent_folder_id_,
59 base::Bind(&FolderCreator::DidListFolders, 59 base::Bind(&FolderCreator::DidListFolders,
60 weak_ptr_factory_.GetWeakPtr(), callback, 60 weak_ptr_factory_.GetWeakPtr(), callback,
61 base::Passed(ScopedVector<google_apis::FileResource>()))); 61 base::Passed(ScopedVector<google_apis::FileResource>())));
62 } 62 }
63 63
64 void FolderCreator::DidListFolders( 64 void FolderCreator::DidListFolders(
65 const FileIDCallback& callback, 65 const FileIDCallback& callback,
66 ScopedVector<google_apis::FileResource> candidates, 66 ScopedVector<google_apis::FileResource> candidates,
67 google_apis::DriveApiErrorCode error, 67 google_apis::DriveApiErrorCode error,
68 scoped_ptr<google_apis::FileList> file_list) { 68 std::unique_ptr<google_apis::FileList> file_list) {
69 SyncStatusCode status = DriveApiErrorCodeToSyncStatusCode(error); 69 SyncStatusCode status = DriveApiErrorCodeToSyncStatusCode(error);
70 if (status != SYNC_STATUS_OK) { 70 if (status != SYNC_STATUS_OK) {
71 callback.Run(std::string(), status); 71 callback.Run(std::string(), status);
72 return; 72 return;
73 } 73 }
74 74
75 if (!file_list) { 75 if (!file_list) {
76 NOTREACHED(); 76 NOTREACHED();
77 callback.Run(std::string(), SYNC_STATUS_FAILED); 77 callback.Run(std::string(), SYNC_STATUS_FAILED);
78 return; 78 return;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 if (!metadata_database_->FindFileByFileID(file_id, nullptr)) { 120 if (!metadata_database_->FindFileByFileID(file_id, nullptr)) {
121 callback.Run(std::string(), SYNC_FILE_ERROR_NOT_FOUND); 121 callback.Run(std::string(), SYNC_FILE_ERROR_NOT_FOUND);
122 return; 122 return;
123 } 123 }
124 124
125 callback.Run(file_id, status); 125 callback.Run(file_id, status);
126 } 126 }
127 127
128 } // namespace drive_backend 128 } // namespace drive_backend
129 } // namespace sync_file_system 129 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698