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

Side by Side Diff: chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/fileapi/fileapi_worker.h" 5 #include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // Runs |callback| with the File::Error converted from |error|. 51 // Runs |callback| with the File::Error converted from |error|.
52 void RunStatusCallbackByFileError(const StatusCallback& callback, 52 void RunStatusCallbackByFileError(const StatusCallback& callback,
53 FileError error) { 53 FileError error) {
54 callback.Run(FileErrorToBaseFileError(error)); 54 callback.Run(FileErrorToBaseFileError(error));
55 } 55 }
56 56
57 // Runs |callback| with arguments converted from |error| and |entry|. 57 // Runs |callback| with arguments converted from |error| and |entry|.
58 void RunGetFileInfoCallback(const GetFileInfoCallback& callback, 58 void RunGetFileInfoCallback(const GetFileInfoCallback& callback,
59 FileError error, 59 FileError error,
60 scoped_ptr<ResourceEntry> entry) { 60 std::unique_ptr<ResourceEntry> entry) {
61 if (error != FILE_ERROR_OK) { 61 if (error != FILE_ERROR_OK) {
62 callback.Run(FileErrorToBaseFileError(error), base::File::Info()); 62 callback.Run(FileErrorToBaseFileError(error), base::File::Info());
63 return; 63 return;
64 } 64 }
65 65
66 DCHECK(entry); 66 DCHECK(entry);
67 base::File::Info file_info; 67 base::File::Info file_info;
68 ConvertResourceEntryToFileInfo(*entry, &file_info); 68 ConvertResourceEntryToFileInfo(*entry, &file_info);
69 callback.Run(base::File::FILE_OK, file_info); 69 callback.Run(base::File::FILE_OK, file_info);
70 } 70 }
71 71
72 // Runs |callback| with entries. 72 // Runs |callback| with entries.
73 void RunReadDirectoryCallbackWithEntries( 73 void RunReadDirectoryCallbackWithEntries(
74 const ReadDirectoryCallback& callback, 74 const ReadDirectoryCallback& callback,
75 scoped_ptr<ResourceEntryVector> resource_entries) { 75 std::unique_ptr<ResourceEntryVector> resource_entries) {
76 DCHECK(resource_entries); 76 DCHECK(resource_entries);
77 77
78 std::vector<storage::DirectoryEntry> entries; 78 std::vector<storage::DirectoryEntry> entries;
79 // Convert drive files to File API's directory entry. 79 // Convert drive files to File API's directory entry.
80 entries.reserve(resource_entries->size()); 80 entries.reserve(resource_entries->size());
81 for (size_t i = 0; i < resource_entries->size(); ++i) { 81 for (size_t i = 0; i < resource_entries->size(); ++i) {
82 const ResourceEntry& resource_entry = (*resource_entries)[i]; 82 const ResourceEntry& resource_entry = (*resource_entries)[i];
83 storage::DirectoryEntry entry; 83 storage::DirectoryEntry entry;
84 entry.name = resource_entry.base_name(); 84 entry.name = resource_entry.base_name();
85 85
(...skipping 10 matching lines...) Expand all
96 FileError error) { 96 FileError error) {
97 callback.Run(FileErrorToBaseFileError(error), 97 callback.Run(FileErrorToBaseFileError(error),
98 std::vector<storage::DirectoryEntry>(), 98 std::vector<storage::DirectoryEntry>(),
99 false /*has_more*/); 99 false /*has_more*/);
100 } 100 }
101 101
102 // Runs |callback| with arguments based on |error|, |local_path| and |entry|. 102 // Runs |callback| with arguments based on |error|, |local_path| and |entry|.
103 void RunCreateSnapshotFileCallback(const CreateSnapshotFileCallback& callback, 103 void RunCreateSnapshotFileCallback(const CreateSnapshotFileCallback& callback,
104 FileError error, 104 FileError error,
105 const base::FilePath& local_path, 105 const base::FilePath& local_path,
106 scoped_ptr<ResourceEntry> entry) { 106 std::unique_ptr<ResourceEntry> entry) {
107 if (error != FILE_ERROR_OK) { 107 if (error != FILE_ERROR_OK) {
108 callback.Run(FileErrorToBaseFileError(error), 108 callback.Run(FileErrorToBaseFileError(error),
109 base::File::Info(), 109 base::File::Info(),
110 base::FilePath(), 110 base::FilePath(),
111 storage::ScopedFile::ScopeOutPolicy()); 111 storage::ScopedFile::ScopeOutPolicy());
112 return; 112 return;
113 } 113 }
114 114
115 DCHECK(entry); 115 DCHECK(entry);
116 116
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 const StatusCallback& callback, 361 const StatusCallback& callback,
362 FileSystemInterface* file_system) { 362 FileSystemInterface* file_system) {
363 DCHECK_CURRENTLY_ON(BrowserThread::UI); 363 DCHECK_CURRENTLY_ON(BrowserThread::UI);
364 file_system->TouchFile(file_path, last_access_time, last_modified_time, 364 file_system->TouchFile(file_path, last_access_time, last_modified_time,
365 base::Bind(&RunStatusCallbackByFileError, callback)); 365 base::Bind(&RunStatusCallbackByFileError, callback));
366 366
367 } 367 }
368 368
369 } // namespace fileapi_internal 369 } // namespace fileapi_internal
370 } // namespace drive 370 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698