| 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" |
| 11 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/chromeos/drive/file_errors.h" | 12 #include "chrome/browser/chromeos/drive/file_errors.h" |
| 11 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 13 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
| 12 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" | 14 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" |
| 13 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 15 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 14 | 16 |
| 15 namespace drive { | 17 namespace drive { |
| 16 class FileCacheEntry; | 18 class FileCacheEntry; |
| 17 class ResourceEntry; | 19 class ResourceEntry; |
| 18 struct SearchResultInfo; | 20 struct SearchResultInfo; |
| 19 } | 21 } |
| 20 | 22 |
| 21 namespace google_apis { | 23 namespace google_apis { |
| 22 class AuthService; | 24 class AuthService; |
| 23 } | 25 } |
| 24 | 26 |
| 25 namespace extensions { | 27 namespace extensions { |
| 26 | 28 |
| 27 namespace api { | 29 namespace api { |
| 28 namespace file_browser_private { | 30 namespace file_browser_private { |
| 29 struct DriveEntryProperties; | 31 struct EntryProperties; |
| 30 } // namespace file_browser_private | 32 } // namespace file_browser_private |
| 31 } // namespace api | 33 } // namespace api |
| 32 | 34 |
| 33 // Retrieves property information for an entry and returns it as a dictionary. | 35 // Retrieves property information for an entry and returns it as a dictionary. |
| 34 // On error, returns a dictionary with the key "error" set to the error number | 36 // On error, returns a dictionary with the key "error" set to the error number |
| 35 // (drive::FileError). | 37 // (base::File::Error). |
| 36 class FileBrowserPrivateGetDriveEntryPropertiesFunction | 38 class FileBrowserPrivateGetEntryPropertiesFunction |
| 37 : public LoggedAsyncExtensionFunction { | 39 : public LoggedAsyncExtensionFunction { |
| 38 public: | 40 public: |
| 39 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getDriveEntryProperties", | 41 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getEntryProperties", |
| 40 FILEBROWSERPRIVATE_GETDRIVEFILEPROPERTIES) | 42 FILEBROWSERPRIVATE_GETENTRYPROPERTIES) |
| 41 | 43 |
| 42 FileBrowserPrivateGetDriveEntryPropertiesFunction(); | 44 FileBrowserPrivateGetEntryPropertiesFunction(); |
| 43 | 45 |
| 44 protected: | 46 protected: |
| 45 virtual ~FileBrowserPrivateGetDriveEntryPropertiesFunction(); | 47 virtual ~FileBrowserPrivateGetEntryPropertiesFunction(); |
| 46 | 48 |
| 47 // AsyncExtensionFunction overrides. | 49 // AsyncExtensionFunction overrides. |
| 48 virtual bool RunAsync() OVERRIDE; | 50 virtual bool RunAsync() OVERRIDE; |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 void CompleteGetFileProperties(drive::FileError error); | 53 void CompleteGetEntryProperties( |
| 54 size_t index, |
| 55 scoped_ptr<api::file_browser_private::EntryProperties> properties, |
| 56 base::File::Error error); |
| 52 | 57 |
| 53 size_t processed_count_; | 58 size_t processed_count_; |
| 54 std::vector<linked_ptr<api::file_browser_private::DriveEntryProperties> > | 59 std::vector<linked_ptr<api::file_browser_private::EntryProperties> > |
| 55 properties_list_; | 60 properties_list_; |
| 56 }; | 61 }; |
| 57 | 62 |
| 58 // Implements the chrome.fileBrowserPrivate.pinDriveFile method. | 63 // Implements the chrome.fileBrowserPrivate.pinDriveFile method. |
| 59 class FileBrowserPrivatePinDriveFileFunction | 64 class FileBrowserPrivatePinDriveFileFunction |
| 60 : public LoggedAsyncExtensionFunction { | 65 : public LoggedAsyncExtensionFunction { |
| 61 public: | 66 public: |
| 62 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.pinDriveFile", | 67 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.pinDriveFile", |
| 63 FILEBROWSERPRIVATE_PINDRIVEFILE) | 68 FILEBROWSERPRIVATE_PINDRIVEFILE) |
| 64 | 69 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 const std::string& access_token); | 273 const std::string& access_token); |
| 269 | 274 |
| 270 private: | 275 private: |
| 271 std::string download_url_; | 276 std::string download_url_; |
| 272 scoped_ptr<google_apis::AuthService> auth_service_; | 277 scoped_ptr<google_apis::AuthService> auth_service_; |
| 273 }; | 278 }; |
| 274 | 279 |
| 275 } // namespace extensions | 280 } // namespace extensions |
| 276 | 281 |
| 277 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_DRIVE_H_ | 282 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_DRIVE_H_ |
| OLD | NEW |