OLD | NEW |
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 // This file provides Drive specific API functions. | 5 // This file provides Drive specific API functions. |
6 | 6 |
7 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_DRIVE_H_ | 7 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_DRIVE_H_ |
8 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_DRIVE_H_ | 8 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_DRIVE_H_ |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
11 | 11 |
| 12 #include <memory> |
12 #include <string> | 13 #include <string> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/files/file.h" | 16 #include "base/files/file.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" | 17 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" |
18 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 18 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
19 #include "components/drive/file_errors.h" | 19 #include "components/drive/file_errors.h" |
20 #include "components/drive/file_system_interface.h" | 20 #include "components/drive/file_system_interface.h" |
21 | 21 |
22 namespace drive { | 22 namespace drive { |
23 class FileCacheEntry; | 23 class FileCacheEntry; |
24 class ResourceEntry; | 24 class ResourceEntry; |
25 struct SearchResultInfo; | 25 struct SearchResultInfo; |
26 } | 26 } |
(...skipping 24 matching lines...) Expand all Loading... |
51 protected: | 51 protected: |
52 ~FileManagerPrivateInternalGetEntryPropertiesFunction() override; | 52 ~FileManagerPrivateInternalGetEntryPropertiesFunction() override; |
53 | 53 |
54 // AsyncExtensionFunction overrides. | 54 // AsyncExtensionFunction overrides. |
55 bool RunAsync() override; | 55 bool RunAsync() override; |
56 | 56 |
57 private: | 57 private: |
58 void CompleteGetEntryProperties( | 58 void CompleteGetEntryProperties( |
59 size_t index, | 59 size_t index, |
60 const storage::FileSystemURL& url, | 60 const storage::FileSystemURL& url, |
61 scoped_ptr<api::file_manager_private::EntryProperties> properties, | 61 std::unique_ptr<api::file_manager_private::EntryProperties> properties, |
62 base::File::Error error); | 62 base::File::Error error); |
63 | 63 |
64 size_t processed_count_; | 64 size_t processed_count_; |
65 std::vector<api::file_manager_private::EntryProperties> properties_list_; | 65 std::vector<api::file_manager_private::EntryProperties> properties_list_; |
66 }; | 66 }; |
67 | 67 |
68 // Implements the chrome.fileManagerPrivate.pinDriveFile method. | 68 // Implements the chrome.fileManagerPrivate.pinDriveFile method. |
69 class FileManagerPrivateInternalPinDriveFileFunction | 69 class FileManagerPrivateInternalPinDriveFileFunction |
70 : public LoggedAsyncExtensionFunction { | 70 : public LoggedAsyncExtensionFunction { |
71 public: | 71 public: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.searchDrive", | 119 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.searchDrive", |
120 FILEMANAGERPRIVATE_SEARCHDRIVE) | 120 FILEMANAGERPRIVATE_SEARCHDRIVE) |
121 | 121 |
122 protected: | 122 protected: |
123 ~FileManagerPrivateSearchDriveFunction() override {} | 123 ~FileManagerPrivateSearchDriveFunction() override {} |
124 | 124 |
125 bool RunAsync() override; | 125 bool RunAsync() override; |
126 | 126 |
127 private: | 127 private: |
128 // Callback for Search(). | 128 // Callback for Search(). |
129 void OnSearch(drive::FileError error, | 129 void OnSearch( |
130 const GURL& next_link, | 130 drive::FileError error, |
131 scoped_ptr<std::vector<drive::SearchResultInfo> > result_paths); | 131 const GURL& next_link, |
| 132 std::unique_ptr<std::vector<drive::SearchResultInfo>> result_paths); |
132 | 133 |
133 // Called when |result_paths| in OnSearch() are converted to a list of | 134 // Called when |result_paths| in OnSearch() are converted to a list of |
134 // entry definitions. | 135 // entry definitions. |
135 void OnEntryDefinitionList( | 136 void OnEntryDefinitionList( |
136 const GURL& next_link, | 137 const GURL& next_link, |
137 scoped_ptr<SearchResultInfoList> search_result_info_list, | 138 std::unique_ptr<SearchResultInfoList> search_result_info_list, |
138 scoped_ptr<file_manager::util::EntryDefinitionList> | 139 std::unique_ptr<file_manager::util::EntryDefinitionList> |
139 entry_definition_list); | 140 entry_definition_list); |
140 }; | 141 }; |
141 | 142 |
142 // Similar to FileManagerPrivateSearchDriveFunction but this one is used for | 143 // Similar to FileManagerPrivateSearchDriveFunction but this one is used for |
143 // searching drive metadata which is stored locally. | 144 // searching drive metadata which is stored locally. |
144 class FileManagerPrivateSearchDriveMetadataFunction | 145 class FileManagerPrivateSearchDriveMetadataFunction |
145 : public LoggedAsyncExtensionFunction { | 146 : public LoggedAsyncExtensionFunction { |
146 public: | 147 public: |
147 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.searchDriveMetadata", | 148 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.searchDriveMetadata", |
148 FILEMANAGERPRIVATE_SEARCHDRIVEMETADATA) | 149 FILEMANAGERPRIVATE_SEARCHDRIVEMETADATA) |
149 | 150 |
150 protected: | 151 protected: |
151 ~FileManagerPrivateSearchDriveMetadataFunction() override {} | 152 ~FileManagerPrivateSearchDriveMetadataFunction() override {} |
152 | 153 |
153 bool RunAsync() override; | 154 bool RunAsync() override; |
154 | 155 |
155 private: | 156 private: |
156 // Callback for SearchMetadata(); | 157 // Callback for SearchMetadata(); |
157 void OnSearchMetadata(drive::FileError error, | 158 void OnSearchMetadata( |
158 scoped_ptr<drive::MetadataSearchResultVector> results); | 159 drive::FileError error, |
| 160 std::unique_ptr<drive::MetadataSearchResultVector> results); |
159 | 161 |
160 // Called when |results| in OnSearchMetadata() are converted to a list of | 162 // Called when |results| in OnSearchMetadata() are converted to a list of |
161 // entry definitions. | 163 // entry definitions. |
162 void OnEntryDefinitionList( | 164 void OnEntryDefinitionList( |
163 scoped_ptr<drive::MetadataSearchResultVector> search_result_info_list, | 165 std::unique_ptr<drive::MetadataSearchResultVector> |
164 scoped_ptr<file_manager::util::EntryDefinitionList> | 166 search_result_info_list, |
| 167 std::unique_ptr<file_manager::util::EntryDefinitionList> |
165 entry_definition_list); | 168 entry_definition_list); |
166 }; | 169 }; |
167 | 170 |
168 // Implements the chrome.fileManagerPrivate.getDriveConnectionState method. | 171 // Implements the chrome.fileManagerPrivate.getDriveConnectionState method. |
169 class FileManagerPrivateGetDriveConnectionStateFunction | 172 class FileManagerPrivateGetDriveConnectionStateFunction |
170 : public ChromeSyncExtensionFunction { | 173 : public ChromeSyncExtensionFunction { |
171 public: | 174 public: |
172 DECLARE_EXTENSION_FUNCTION( | 175 DECLARE_EXTENSION_FUNCTION( |
173 "fileManagerPrivate.getDriveConnectionState", | 176 "fileManagerPrivate.getDriveConnectionState", |
174 FILEMANAGERPRIVATE_GETDRIVECONNECTIONSTATE); | 177 FILEMANAGERPRIVATE_GETDRIVECONNECTIONSTATE); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getDownloadUrl", | 243 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getDownloadUrl", |
241 FILEMANAGERPRIVATEINTERNAL_GETDOWNLOADURL) | 244 FILEMANAGERPRIVATEINTERNAL_GETDOWNLOADURL) |
242 | 245 |
243 protected: | 246 protected: |
244 ~FileManagerPrivateInternalGetDownloadUrlFunction() override; | 247 ~FileManagerPrivateInternalGetDownloadUrlFunction() override; |
245 | 248 |
246 // AsyncExtensionFunction overrides. | 249 // AsyncExtensionFunction overrides. |
247 bool RunAsync() override; | 250 bool RunAsync() override; |
248 | 251 |
249 void OnGetResourceEntry(drive::FileError error, | 252 void OnGetResourceEntry(drive::FileError error, |
250 scoped_ptr<drive::ResourceEntry> entry); | 253 std::unique_ptr<drive::ResourceEntry> entry); |
251 | 254 |
252 // Callback with an |access_token|, called by | 255 // Callback with an |access_token|, called by |
253 // drive::DriveReadonlyTokenFetcher. | 256 // drive::DriveReadonlyTokenFetcher. |
254 void OnTokenFetched(google_apis::DriveApiErrorCode code, | 257 void OnTokenFetched(google_apis::DriveApiErrorCode code, |
255 const std::string& access_token); | 258 const std::string& access_token); |
256 | 259 |
257 private: | 260 private: |
258 GURL download_url_; | 261 GURL download_url_; |
259 scoped_ptr<google_apis::AuthService> auth_service_; | 262 std::unique_ptr<google_apis::AuthService> auth_service_; |
260 }; | 263 }; |
261 | 264 |
262 } // namespace extensions | 265 } // namespace extensions |
263 | 266 |
264 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_DRIVE_H_ | 267 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_DRIVE_H_ |
OLD | NEW |