| 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 COMPONENTS_DRIVE_FILE_SYSTEM_INTERFACE_H_ | 5 #ifndef COMPONENTS_DRIVE_FILE_SYSTEM_INTERFACE_H_ |
| 6 #define COMPONENTS_DRIVE_FILE_SYSTEM_INTERFACE_H_ | 6 #define COMPONENTS_DRIVE_FILE_SYSTEM_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "components/drive/drive.pb.h" | 14 #include "components/drive/drive.pb.h" |
| 13 #include "components/drive/file_system_metadata.h" | 15 #include "components/drive/file_system_metadata.h" |
| 14 #include "components/drive/resource_metadata.h" | 16 #include "components/drive/resource_metadata.h" |
| 15 #include "google_apis/drive/base_requests.h" | 17 #include "google_apis/drive/base_requests.h" |
| 16 #include "google_apis/drive/drive_api_requests.h" | 18 #include "google_apis/drive/drive_api_requests.h" |
| 17 | 19 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // modification to the cache is done. Otherwise, Drive file system does not | 114 // modification to the cache is done. Otherwise, Drive file system does not |
| 113 // pick up the file for uploading. | 115 // pick up the file for uploading. |
| 114 // |close_callback| must not be called more than once. | 116 // |close_callback| must not be called more than once. |
| 115 typedef base::Callback<void(FileError error, | 117 typedef base::Callback<void(FileError error, |
| 116 const base::FilePath& file_path, | 118 const base::FilePath& file_path, |
| 117 const base::Closure& close_callback)> | 119 const base::Closure& close_callback)> |
| 118 OpenFileCallback; | 120 OpenFileCallback; |
| 119 | 121 |
| 120 // Used to get available space for the account from Drive. | 122 // Used to get available space for the account from Drive. |
| 121 typedef base::Callback<void(FileError error, | 123 typedef base::Callback<void(FileError error, |
| 122 int64 bytes_total, | 124 int64_t bytes_total, |
| 123 int64 bytes_used)> GetAvailableSpaceCallback; | 125 int64_t bytes_used)> GetAvailableSpaceCallback; |
| 124 | 126 |
| 125 // Used to get the url to the sharing dialog. | 127 // Used to get the url to the sharing dialog. |
| 126 typedef base::Callback<void(FileError error, | 128 typedef base::Callback<void(FileError error, |
| 127 const GURL& share_url)> GetShareUrlCallback; | 129 const GURL& share_url)> GetShareUrlCallback; |
| 128 | 130 |
| 129 // Used to get filesystem metadata. | 131 // Used to get filesystem metadata. |
| 130 typedef base::Callback<void(const FileSystemMetadata&)> | 132 typedef base::Callback<void(const FileSystemMetadata&)> |
| 131 GetFilesystemMetadataCallback; | 133 GetFilesystemMetadataCallback; |
| 132 | 134 |
| 133 // Used to mark cached files mounted. | 135 // Used to mark cached files mounted. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 // |last_access_time|, |last_modified_time| and |callback| must not be null. | 303 // |last_access_time|, |last_modified_time| and |callback| must not be null. |
| 302 virtual void TouchFile(const base::FilePath& file_path, | 304 virtual void TouchFile(const base::FilePath& file_path, |
| 303 const base::Time& last_access_time, | 305 const base::Time& last_access_time, |
| 304 const base::Time& last_modified_time, | 306 const base::Time& last_modified_time, |
| 305 const FileOperationCallback& callback) = 0; | 307 const FileOperationCallback& callback) = 0; |
| 306 | 308 |
| 307 // Truncates the file content at |file_path| to the |length|. | 309 // Truncates the file content at |file_path| to the |length|. |
| 308 // | 310 // |
| 309 // |callback| must not be null. | 311 // |callback| must not be null. |
| 310 virtual void TruncateFile(const base::FilePath& file_path, | 312 virtual void TruncateFile(const base::FilePath& file_path, |
| 311 int64 length, | 313 int64_t length, |
| 312 const FileOperationCallback& callback) = 0; | 314 const FileOperationCallback& callback) = 0; |
| 313 | 315 |
| 314 // Pins a file at |file_path|. | 316 // Pins a file at |file_path|. |
| 315 // | 317 // |
| 316 // |callback| must not be null. | 318 // |callback| must not be null. |
| 317 virtual void Pin(const base::FilePath& file_path, | 319 virtual void Pin(const base::FilePath& file_path, |
| 318 const FileOperationCallback& callback) = 0; | 320 const FileOperationCallback& callback) = 0; |
| 319 | 321 |
| 320 // Unpins a file at |file_path|. | 322 // Unpins a file at |file_path|. |
| 321 // | 323 // |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 // Resets local data. | 455 // Resets local data. |
| 454 virtual void Reset(const FileOperationCallback& callback) = 0; | 456 virtual void Reset(const FileOperationCallback& callback) = 0; |
| 455 | 457 |
| 456 // Finds a path of an entry (a file or a directory) by |resource_id|. | 458 // Finds a path of an entry (a file or a directory) by |resource_id|. |
| 457 virtual void GetPathFromResourceId(const std::string& resource_id, | 459 virtual void GetPathFromResourceId(const std::string& resource_id, |
| 458 const GetFilePathCallback& callback) = 0; | 460 const GetFilePathCallback& callback) = 0; |
| 459 | 461 |
| 460 // Free drive caches if needed to secure given available spaces. |callback| | 462 // Free drive caches if needed to secure given available spaces. |callback| |
| 461 // takes whether given bytes are available or not. | 463 // takes whether given bytes are available or not. |
| 462 virtual void FreeDiskSpaceIfNeededFor( | 464 virtual void FreeDiskSpaceIfNeededFor( |
| 463 int64 num_bytes, | 465 int64_t num_bytes, |
| 464 const FreeDiskSpaceCallback& callback) = 0; | 466 const FreeDiskSpaceCallback& callback) = 0; |
| 465 | 467 |
| 466 // Calculates evictable cache size. | 468 // Calculates evictable cache size. |
| 467 // |callback| must not be null. | 469 // |callback| must not be null. |
| 468 virtual void CalculateEvictableCacheSize( | 470 virtual void CalculateEvictableCacheSize( |
| 469 const EvictableCacheSizeCallback& callback) = 0; | 471 const EvictableCacheSizeCallback& callback) = 0; |
| 470 }; | 472 }; |
| 471 | 473 |
| 472 } // namespace drive | 474 } // namespace drive |
| 473 | 475 |
| 474 #endif // COMPONENTS_DRIVE_FILE_SYSTEM_INTERFACE_H_ | 476 #endif // COMPONENTS_DRIVE_FILE_SYSTEM_INTERFACE_H_ |
| OLD | NEW |