| 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 "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 public: | 40 public: |
| 41 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getEntryProperties", | 41 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getEntryProperties", |
| 42 FILEMANAGERPRIVATE_GETENTRYPROPERTIES) | 42 FILEMANAGERPRIVATE_GETENTRYPROPERTIES) |
| 43 | 43 |
| 44 FileManagerPrivateGetEntryPropertiesFunction(); | 44 FileManagerPrivateGetEntryPropertiesFunction(); |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 virtual ~FileManagerPrivateGetEntryPropertiesFunction(); | 47 virtual ~FileManagerPrivateGetEntryPropertiesFunction(); |
| 48 | 48 |
| 49 // AsyncExtensionFunction overrides. | 49 // AsyncExtensionFunction overrides. |
| 50 virtual bool RunAsync() OVERRIDE; | 50 virtual bool RunAsync() override; |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 void CompleteGetEntryProperties( | 53 void CompleteGetEntryProperties( |
| 54 size_t index, | 54 size_t index, |
| 55 scoped_ptr<api::file_manager_private::EntryProperties> properties, | 55 scoped_ptr<api::file_manager_private::EntryProperties> properties, |
| 56 base::File::Error error); | 56 base::File::Error error); |
| 57 | 57 |
| 58 size_t processed_count_; | 58 size_t processed_count_; |
| 59 std::vector<linked_ptr<api::file_manager_private::EntryProperties> > | 59 std::vector<linked_ptr<api::file_manager_private::EntryProperties> > |
| 60 properties_list_; | 60 properties_list_; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // Implements the chrome.fileManagerPrivate.pinDriveFile method. | 63 // Implements the chrome.fileManagerPrivate.pinDriveFile method. |
| 64 class FileManagerPrivatePinDriveFileFunction | 64 class FileManagerPrivatePinDriveFileFunction |
| 65 : public LoggedAsyncExtensionFunction { | 65 : public LoggedAsyncExtensionFunction { |
| 66 public: | 66 public: |
| 67 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.pinDriveFile", | 67 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.pinDriveFile", |
| 68 FILEMANAGERPRIVATE_PINDRIVEFILE) | 68 FILEMANAGERPRIVATE_PINDRIVEFILE) |
| 69 | 69 |
| 70 protected: | 70 protected: |
| 71 virtual ~FileManagerPrivatePinDriveFileFunction() {} | 71 virtual ~FileManagerPrivatePinDriveFileFunction() {} |
| 72 | 72 |
| 73 // AsyncExtensionFunction overrides. | 73 // AsyncExtensionFunction overrides. |
| 74 virtual bool RunAsync() OVERRIDE; | 74 virtual bool RunAsync() override; |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 // Callback for RunAsync(). | 77 // Callback for RunAsync(). |
| 78 void OnPinStateSet(drive::FileError error); | 78 void OnPinStateSet(drive::FileError error); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // Implements the chrome.fileManagerPrivate.cancelFileTransfers method. | 81 // Implements the chrome.fileManagerPrivate.cancelFileTransfers method. |
| 82 class FileManagerPrivateCancelFileTransfersFunction | 82 class FileManagerPrivateCancelFileTransfersFunction |
| 83 : public LoggedAsyncExtensionFunction { | 83 : public LoggedAsyncExtensionFunction { |
| 84 public: | 84 public: |
| 85 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.cancelFileTransfers", | 85 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.cancelFileTransfers", |
| 86 FILEMANAGERPRIVATE_CANCELFILETRANSFERS) | 86 FILEMANAGERPRIVATE_CANCELFILETRANSFERS) |
| 87 | 87 |
| 88 protected: | 88 protected: |
| 89 virtual ~FileManagerPrivateCancelFileTransfersFunction() {} | 89 virtual ~FileManagerPrivateCancelFileTransfersFunction() {} |
| 90 | 90 |
| 91 // AsyncExtensionFunction overrides. | 91 // AsyncExtensionFunction overrides. |
| 92 virtual bool RunAsync() OVERRIDE; | 92 virtual bool RunAsync() override; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 class FileManagerPrivateSearchDriveFunction | 95 class FileManagerPrivateSearchDriveFunction |
| 96 : public LoggedAsyncExtensionFunction { | 96 : public LoggedAsyncExtensionFunction { |
| 97 public: | 97 public: |
| 98 typedef std::vector<drive::SearchResultInfo> SearchResultInfoList; | 98 typedef std::vector<drive::SearchResultInfo> SearchResultInfoList; |
| 99 | 99 |
| 100 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.searchDrive", | 100 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.searchDrive", |
| 101 FILEMANAGERPRIVATE_SEARCHDRIVE) | 101 FILEMANAGERPRIVATE_SEARCHDRIVE) |
| 102 | 102 |
| 103 protected: | 103 protected: |
| 104 virtual ~FileManagerPrivateSearchDriveFunction() {} | 104 virtual ~FileManagerPrivateSearchDriveFunction() {} |
| 105 | 105 |
| 106 virtual bool RunAsync() OVERRIDE; | 106 virtual bool RunAsync() override; |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 // Callback for Search(). | 109 // Callback for Search(). |
| 110 void OnSearch(drive::FileError error, | 110 void OnSearch(drive::FileError error, |
| 111 const GURL& next_link, | 111 const GURL& next_link, |
| 112 scoped_ptr<std::vector<drive::SearchResultInfo> > result_paths); | 112 scoped_ptr<std::vector<drive::SearchResultInfo> > result_paths); |
| 113 | 113 |
| 114 // Called when |result_paths| in OnSearch() are converted to a list of | 114 // Called when |result_paths| in OnSearch() are converted to a list of |
| 115 // entry definitions. | 115 // entry definitions. |
| 116 void OnEntryDefinitionList( | 116 void OnEntryDefinitionList( |
| 117 const GURL& next_link, | 117 const GURL& next_link, |
| 118 scoped_ptr<SearchResultInfoList> search_result_info_list, | 118 scoped_ptr<SearchResultInfoList> search_result_info_list, |
| 119 scoped_ptr<file_manager::util::EntryDefinitionList> | 119 scoped_ptr<file_manager::util::EntryDefinitionList> |
| 120 entry_definition_list); | 120 entry_definition_list); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 // Similar to FileManagerPrivateSearchDriveFunction but this one is used for | 123 // Similar to FileManagerPrivateSearchDriveFunction but this one is used for |
| 124 // searching drive metadata which is stored locally. | 124 // searching drive metadata which is stored locally. |
| 125 class FileManagerPrivateSearchDriveMetadataFunction | 125 class FileManagerPrivateSearchDriveMetadataFunction |
| 126 : public LoggedAsyncExtensionFunction { | 126 : public LoggedAsyncExtensionFunction { |
| 127 public: | 127 public: |
| 128 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.searchDriveMetadata", | 128 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.searchDriveMetadata", |
| 129 FILEMANAGERPRIVATE_SEARCHDRIVEMETADATA) | 129 FILEMANAGERPRIVATE_SEARCHDRIVEMETADATA) |
| 130 | 130 |
| 131 protected: | 131 protected: |
| 132 virtual ~FileManagerPrivateSearchDriveMetadataFunction() {} | 132 virtual ~FileManagerPrivateSearchDriveMetadataFunction() {} |
| 133 | 133 |
| 134 virtual bool RunAsync() OVERRIDE; | 134 virtual bool RunAsync() override; |
| 135 | 135 |
| 136 private: | 136 private: |
| 137 // Callback for SearchMetadata(); | 137 // Callback for SearchMetadata(); |
| 138 void OnSearchMetadata(drive::FileError error, | 138 void OnSearchMetadata(drive::FileError error, |
| 139 scoped_ptr<drive::MetadataSearchResultVector> results); | 139 scoped_ptr<drive::MetadataSearchResultVector> results); |
| 140 | 140 |
| 141 // Called when |results| in OnSearchMetadata() are converted to a list of | 141 // Called when |results| in OnSearchMetadata() are converted to a list of |
| 142 // entry definitions. | 142 // entry definitions. |
| 143 void OnEntryDefinitionList( | 143 void OnEntryDefinitionList( |
| 144 scoped_ptr<drive::MetadataSearchResultVector> search_result_info_list, | 144 scoped_ptr<drive::MetadataSearchResultVector> search_result_info_list, |
| 145 scoped_ptr<file_manager::util::EntryDefinitionList> | 145 scoped_ptr<file_manager::util::EntryDefinitionList> |
| 146 entry_definition_list); | 146 entry_definition_list); |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 // Implements the chrome.fileManagerPrivate.getDriveConnectionState method. | 149 // Implements the chrome.fileManagerPrivate.getDriveConnectionState method. |
| 150 class FileManagerPrivateGetDriveConnectionStateFunction | 150 class FileManagerPrivateGetDriveConnectionStateFunction |
| 151 : public ChromeSyncExtensionFunction { | 151 : public ChromeSyncExtensionFunction { |
| 152 public: | 152 public: |
| 153 DECLARE_EXTENSION_FUNCTION( | 153 DECLARE_EXTENSION_FUNCTION( |
| 154 "fileManagerPrivate.getDriveConnectionState", | 154 "fileManagerPrivate.getDriveConnectionState", |
| 155 FILEMANAGERPRIVATE_GETDRIVECONNECTIONSTATE); | 155 FILEMANAGERPRIVATE_GETDRIVECONNECTIONSTATE); |
| 156 | 156 |
| 157 protected: | 157 protected: |
| 158 virtual ~FileManagerPrivateGetDriveConnectionStateFunction() {} | 158 virtual ~FileManagerPrivateGetDriveConnectionStateFunction() {} |
| 159 | 159 |
| 160 virtual bool RunSync() OVERRIDE; | 160 virtual bool RunSync() override; |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 // Implements the chrome.fileManagerPrivate.requestAccessToken method. | 163 // Implements the chrome.fileManagerPrivate.requestAccessToken method. |
| 164 class FileManagerPrivateRequestAccessTokenFunction | 164 class FileManagerPrivateRequestAccessTokenFunction |
| 165 : public LoggedAsyncExtensionFunction { | 165 : public LoggedAsyncExtensionFunction { |
| 166 public: | 166 public: |
| 167 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.requestAccessToken", | 167 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.requestAccessToken", |
| 168 FILEMANAGERPRIVATE_REQUESTACCESSTOKEN) | 168 FILEMANAGERPRIVATE_REQUESTACCESSTOKEN) |
| 169 | 169 |
| 170 protected: | 170 protected: |
| 171 virtual ~FileManagerPrivateRequestAccessTokenFunction() {} | 171 virtual ~FileManagerPrivateRequestAccessTokenFunction() {} |
| 172 | 172 |
| 173 // AsyncExtensionFunction overrides. | 173 // AsyncExtensionFunction overrides. |
| 174 virtual bool RunAsync() OVERRIDE; | 174 virtual bool RunAsync() override; |
| 175 | 175 |
| 176 // Callback with a cached auth token (if available) or a fetched one. | 176 // Callback with a cached auth token (if available) or a fetched one. |
| 177 void OnAccessTokenFetched(google_apis::GDataErrorCode code, | 177 void OnAccessTokenFetched(google_apis::GDataErrorCode code, |
| 178 const std::string& access_token); | 178 const std::string& access_token); |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 // Implements the chrome.fileManagerPrivate.getShareUrl method. | 181 // Implements the chrome.fileManagerPrivate.getShareUrl method. |
| 182 class FileManagerPrivateGetShareUrlFunction | 182 class FileManagerPrivateGetShareUrlFunction |
| 183 : public LoggedAsyncExtensionFunction { | 183 : public LoggedAsyncExtensionFunction { |
| 184 public: | 184 public: |
| 185 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getShareUrl", | 185 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getShareUrl", |
| 186 FILEMANAGERPRIVATE_GETSHAREURL) | 186 FILEMANAGERPRIVATE_GETSHAREURL) |
| 187 | 187 |
| 188 protected: | 188 protected: |
| 189 virtual ~FileManagerPrivateGetShareUrlFunction() {} | 189 virtual ~FileManagerPrivateGetShareUrlFunction() {} |
| 190 | 190 |
| 191 // AsyncExtensionFunction overrides. | 191 // AsyncExtensionFunction overrides. |
| 192 virtual bool RunAsync() OVERRIDE; | 192 virtual bool RunAsync() override; |
| 193 | 193 |
| 194 // Callback with an url to the sharing dialog as |share_url|, called by | 194 // Callback with an url to the sharing dialog as |share_url|, called by |
| 195 // FileSystem::GetShareUrl. | 195 // FileSystem::GetShareUrl. |
| 196 void OnGetShareUrl(drive::FileError error, const GURL& share_url); | 196 void OnGetShareUrl(drive::FileError error, const GURL& share_url); |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 // Implements the chrome.fileManagerPrivate.requestDriveShare method. | 199 // Implements the chrome.fileManagerPrivate.requestDriveShare method. |
| 200 class FileManagerPrivateRequestDriveShareFunction | 200 class FileManagerPrivateRequestDriveShareFunction |
| 201 : public LoggedAsyncExtensionFunction { | 201 : public LoggedAsyncExtensionFunction { |
| 202 public: | 202 public: |
| 203 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.requestDriveShare", | 203 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.requestDriveShare", |
| 204 FILEMANAGERPRIVATE_REQUESTDRIVESHARE); | 204 FILEMANAGERPRIVATE_REQUESTDRIVESHARE); |
| 205 | 205 |
| 206 protected: | 206 protected: |
| 207 virtual ~FileManagerPrivateRequestDriveShareFunction() {} | 207 virtual ~FileManagerPrivateRequestDriveShareFunction() {} |
| 208 virtual bool RunAsync() OVERRIDE; | 208 virtual bool RunAsync() override; |
| 209 | 209 |
| 210 private: | 210 private: |
| 211 // Called back after the drive file system operation is finished. | 211 // Called back after the drive file system operation is finished. |
| 212 void OnAddPermission(drive::FileError error); | 212 void OnAddPermission(drive::FileError error); |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 // Implements the chrome.fileManagerPrivate.getDownloadUrl method. | 215 // Implements the chrome.fileManagerPrivate.getDownloadUrl method. |
| 216 class FileManagerPrivateGetDownloadUrlFunction | 216 class FileManagerPrivateGetDownloadUrlFunction |
| 217 : public LoggedAsyncExtensionFunction { | 217 : public LoggedAsyncExtensionFunction { |
| 218 public: | 218 public: |
| 219 FileManagerPrivateGetDownloadUrlFunction(); | 219 FileManagerPrivateGetDownloadUrlFunction(); |
| 220 | 220 |
| 221 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getDownloadUrl", | 221 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getDownloadUrl", |
| 222 FILEMANAGERPRIVATE_GETDOWNLOADURL) | 222 FILEMANAGERPRIVATE_GETDOWNLOADURL) |
| 223 | 223 |
| 224 protected: | 224 protected: |
| 225 virtual ~FileManagerPrivateGetDownloadUrlFunction(); | 225 virtual ~FileManagerPrivateGetDownloadUrlFunction(); |
| 226 | 226 |
| 227 // AsyncExtensionFunction overrides. | 227 // AsyncExtensionFunction overrides. |
| 228 virtual bool RunAsync() OVERRIDE; | 228 virtual bool RunAsync() override; |
| 229 | 229 |
| 230 void OnGetResourceEntry(drive::FileError error, | 230 void OnGetResourceEntry(drive::FileError error, |
| 231 scoped_ptr<drive::ResourceEntry> entry); | 231 scoped_ptr<drive::ResourceEntry> entry); |
| 232 | 232 |
| 233 // Callback with an |access_token|, called by | 233 // Callback with an |access_token|, called by |
| 234 // drive::DriveReadonlyTokenFetcher. | 234 // drive::DriveReadonlyTokenFetcher. |
| 235 void OnTokenFetched(google_apis::GDataErrorCode code, | 235 void OnTokenFetched(google_apis::GDataErrorCode code, |
| 236 const std::string& access_token); | 236 const std::string& access_token); |
| 237 | 237 |
| 238 private: | 238 private: |
| 239 std::string download_url_; | 239 std::string download_url_; |
| 240 scoped_ptr<google_apis::AuthService> auth_service_; | 240 scoped_ptr<google_apis::AuthService> auth_service_; |
| 241 }; | 241 }; |
| 242 | 242 |
| 243 } // namespace extensions | 243 } // namespace extensions |
| 244 | 244 |
| 245 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_DRIVE_H_ | 245 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_DRIVE_H_ |
| OLD | NEW |