| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_API_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 11 #include "chrome/browser/sync_file_system/conflict_resolution_policy.h" | 11 #include "chrome/browser/sync_file_system/conflict_resolution_policy.h" |
| 12 #include "chrome/browser/sync_file_system/sync_file_status.h" | 12 #include "chrome/browser/sync_file_system/sync_file_status.h" |
| 13 #include "chrome/browser/sync_file_system/sync_status_code.h" | 13 #include "chrome/browser/sync_file_system/sync_status_code.h" |
| 14 #include "chrome/common/extensions/api/sync_file_system.h" | 14 #include "chrome/common/extensions/api/sync_file_system.h" |
| 15 #include "webkit/browser/fileapi/file_system_url.h" | 15 #include "webkit/browser/fileapi/file_system_url.h" |
| 16 #include "webkit/common/quota/quota_types.h" | 16 #include "webkit/common/quota/quota_types.h" |
| 17 | 17 |
| 18 namespace fileapi { | 18 namespace storage { |
| 19 class FileSystemContext; | 19 class FileSystemContext; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| 23 | 23 |
| 24 class SyncFileSystemDeleteFileSystemFunction | 24 class SyncFileSystemDeleteFileSystemFunction |
| 25 : public ChromeAsyncExtensionFunction { | 25 : public ChromeAsyncExtensionFunction { |
| 26 public: | 26 public: |
| 27 // TODO(kinuko,calvinlo): Uncomment this or delete this class when | 27 // TODO(kinuko,calvinlo): Uncomment this or delete this class when |
| 28 // we decide if we want to revive this function. | 28 // we decide if we want to revive this function. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 SYNCFILESYSTEM_GETFILESYNCSTATUSES) | 60 SYNCFILESYSTEM_GETFILESYNCSTATUSES) |
| 61 SyncFileSystemGetFileStatusesFunction(); | 61 SyncFileSystemGetFileStatusesFunction(); |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 virtual ~SyncFileSystemGetFileStatusesFunction(); | 64 virtual ~SyncFileSystemGetFileStatusesFunction(); |
| 65 virtual bool RunAsync() OVERRIDE; | 65 virtual bool RunAsync() OVERRIDE; |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 typedef std::pair<sync_file_system::SyncStatusCode, | 68 typedef std::pair<sync_file_system::SyncStatusCode, |
| 69 sync_file_system::SyncFileStatus> FileStatusPair; | 69 sync_file_system::SyncFileStatus> FileStatusPair; |
| 70 typedef std::map<fileapi::FileSystemURL, FileStatusPair, | 70 typedef std::map<storage::FileSystemURL, |
| 71 fileapi::FileSystemURL::Comparator> URLToStatusMap; | 71 FileStatusPair, |
| 72 storage::FileSystemURL::Comparator> URLToStatusMap; |
| 72 | 73 |
| 73 void DidGetFileStatus( | 74 void DidGetFileStatus(const storage::FileSystemURL& file_system_url, |
| 74 const fileapi::FileSystemURL& file_system_url, | 75 sync_file_system::SyncStatusCode sync_status_code, |
| 75 sync_file_system::SyncStatusCode sync_status_code, | 76 sync_file_system::SyncFileStatus sync_file_statuses); |
| 76 sync_file_system::SyncFileStatus sync_file_statuses); | |
| 77 | 77 |
| 78 unsigned int num_expected_results_; | 78 unsigned int num_expected_results_; |
| 79 unsigned int num_results_received_; | 79 unsigned int num_results_received_; |
| 80 URLToStatusMap file_sync_statuses_; | 80 URLToStatusMap file_sync_statuses_; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 class SyncFileSystemGetUsageAndQuotaFunction | 83 class SyncFileSystemGetUsageAndQuotaFunction |
| 84 : public ChromeAsyncExtensionFunction { | 84 : public ChromeAsyncExtensionFunction { |
| 85 public: | 85 public: |
| 86 DECLARE_EXTENSION_FUNCTION("syncFileSystem.getUsageAndQuota", | 86 DECLARE_EXTENSION_FUNCTION("syncFileSystem.getUsageAndQuota", |
| 87 SYNCFILESYSTEM_GETUSAGEANDQUOTA) | 87 SYNCFILESYSTEM_GETUSAGEANDQUOTA) |
| 88 | 88 |
| 89 protected: | 89 protected: |
| 90 virtual ~SyncFileSystemGetUsageAndQuotaFunction() {} | 90 virtual ~SyncFileSystemGetUsageAndQuotaFunction() {} |
| 91 virtual bool RunAsync() OVERRIDE; | 91 virtual bool RunAsync() OVERRIDE; |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 void DidGetUsageAndQuota(quota::QuotaStatusCode status, | 94 void DidGetUsageAndQuota(storage::QuotaStatusCode status, |
| 95 int64 usage, | 95 int64 usage, |
| 96 int64 quota); | 96 int64 quota); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 class SyncFileSystemRequestFileSystemFunction | 99 class SyncFileSystemRequestFileSystemFunction |
| 100 : public ChromeAsyncExtensionFunction { | 100 : public ChromeAsyncExtensionFunction { |
| 101 public: | 101 public: |
| 102 DECLARE_EXTENSION_FUNCTION("syncFileSystem.requestFileSystem", | 102 DECLARE_EXTENSION_FUNCTION("syncFileSystem.requestFileSystem", |
| 103 SYNCFILESYSTEM_REQUESTFILESYSTEM) | 103 SYNCFILESYSTEM_REQUESTFILESYSTEM) |
| 104 | 104 |
| 105 protected: | 105 protected: |
| 106 virtual ~SyncFileSystemRequestFileSystemFunction() {} | 106 virtual ~SyncFileSystemRequestFileSystemFunction() {} |
| 107 virtual bool RunAsync() OVERRIDE; | 107 virtual bool RunAsync() OVERRIDE; |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 typedef SyncFileSystemRequestFileSystemFunction self; | 110 typedef SyncFileSystemRequestFileSystemFunction self; |
| 111 | 111 |
| 112 // Returns the file system context for this extension. | 112 // Returns the file system context for this extension. |
| 113 fileapi::FileSystemContext* GetFileSystemContext(); | 113 storage::FileSystemContext* GetFileSystemContext(); |
| 114 | 114 |
| 115 void DidOpenFileSystem(const GURL& root_url, | 115 void DidOpenFileSystem(const GURL& root_url, |
| 116 const std::string& file_system_name, | 116 const std::string& file_system_name, |
| 117 base::File::Error error); | 117 base::File::Error error); |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 class SyncFileSystemSetConflictResolutionPolicyFunction | 120 class SyncFileSystemSetConflictResolutionPolicyFunction |
| 121 : public ChromeSyncExtensionFunction { | 121 : public ChromeSyncExtensionFunction { |
| 122 public: | 122 public: |
| 123 DECLARE_EXTENSION_FUNCTION("syncFileSystem.setConflictResolutionPolicy", | 123 DECLARE_EXTENSION_FUNCTION("syncFileSystem.setConflictResolutionPolicy", |
| (...skipping 22 matching lines...) Expand all Loading... |
| 146 SYNCFILESYSTEM_GETSERVICESTATUS) | 146 SYNCFILESYSTEM_GETSERVICESTATUS) |
| 147 | 147 |
| 148 protected: | 148 protected: |
| 149 virtual ~SyncFileSystemGetServiceStatusFunction() {} | 149 virtual ~SyncFileSystemGetServiceStatusFunction() {} |
| 150 virtual bool RunSync() OVERRIDE; | 150 virtual bool RunSync() OVERRIDE; |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 } // namespace extensions | 153 } // namespace extensions |
| 154 | 154 |
| 155 #endif // CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_API_H
_ | 155 #endif // CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_API_H
_ |
| OLD | NEW |