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_CHROMEOS_DRIVE_FILE_SYSTEM_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_INTERFACE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_INTERFACE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_INTERFACE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 GetFilesystemMetadataCallback; | 119 GetFilesystemMetadataCallback; |
120 | 120 |
121 // Priority of a job. Higher values are lower priority. | 121 // Priority of a job. Higher values are lower priority. |
122 enum ContextType { | 122 enum ContextType { |
123 USER_INITIATED, | 123 USER_INITIATED, |
124 BACKGROUND, | 124 BACKGROUND, |
125 // Indicates the number of values of this enum. | 125 // Indicates the number of values of this enum. |
126 NUM_CONTEXT_TYPES, | 126 NUM_CONTEXT_TYPES, |
127 }; | 127 }; |
128 | 128 |
129 struct DriveClientContext { | 129 struct ClientContext { |
130 explicit DriveClientContext(ContextType in_type) : type(in_type) {} | 130 explicit ClientContext(ContextType in_type) : type(in_type) {} |
131 ContextType type; | 131 ContextType type; |
132 }; | 132 }; |
133 | 133 |
134 // Option enum to control eligible entries for searchMetadata(). | 134 // Option enum to control eligible entries for searchMetadata(). |
135 // SEARCH_METADATA_ALL is the default to investigate all the entries. | 135 // SEARCH_METADATA_ALL is the default to investigate all the entries. |
136 // SEARCH_METADATA_EXCLUDE_HOSTED_DOCUMENTS excludes the hosted documents. | 136 // SEARCH_METADATA_EXCLUDE_HOSTED_DOCUMENTS excludes the hosted documents. |
137 // SEARCH_METADATA_EXCLUDE_DIRECTORIES excludes the directories from the result. | 137 // SEARCH_METADATA_EXCLUDE_DIRECTORIES excludes the directories from the result. |
138 // SEARCH_METADATA_SHARED_WITH_ME targets only "shared-with-me" entries. | 138 // SEARCH_METADATA_SHARED_WITH_ME targets only "shared-with-me" entries. |
139 // SEARCH_METADATA_OFFLINE targets only "offline" entries. This option can not | 139 // SEARCH_METADATA_OFFLINE targets only "offline" entries. This option can not |
140 // be used with other options. | 140 // be used with other options. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 virtual void GetFileByPath(const base::FilePath& file_path, | 320 virtual void GetFileByPath(const base::FilePath& file_path, |
321 const GetFileCallback& callback) = 0; | 321 const GetFileCallback& callback) = 0; |
322 | 322 |
323 // Gets a file by the given |resource_id| from the Drive server. Used for | 323 // Gets a file by the given |resource_id| from the Drive server. Used for |
324 // fetching pinned-but-not-fetched files. | 324 // fetching pinned-but-not-fetched files. |
325 // | 325 // |
326 // |get_file_callback| must not be null. | 326 // |get_file_callback| must not be null. |
327 // |get_content_callback| may be null. | 327 // |get_content_callback| may be null. |
328 virtual void GetFileByResourceId( | 328 virtual void GetFileByResourceId( |
329 const std::string& resource_id, | 329 const std::string& resource_id, |
330 const DriveClientContext& context, | 330 const ClientContext& context, |
331 const GetFileCallback& get_file_callback, | 331 const GetFileCallback& get_file_callback, |
332 const google_apis::GetContentCallback& get_content_callback) = 0; | 332 const google_apis::GetContentCallback& get_content_callback) = 0; |
333 | 333 |
334 // Gets a file by the given |file_path|. | 334 // Gets a file by the given |file_path|. |
335 // Calls |initialized_callback| when either: | 335 // Calls |initialized_callback| when either: |
336 // 1) The cached file (or JSON file for hosted file) is found, or | 336 // 1) The cached file (or JSON file for hosted file) is found, or |
337 // 2) Starting to download the file from drive server. | 337 // 2) Starting to download the file from drive server. |
338 // In case of 2), the given FilePath is empty, and |get_content_callback| is | 338 // In case of 2), the given FilePath is empty, and |get_content_callback| is |
339 // called repeatedly with downloaded content following the | 339 // called repeatedly with downloaded content following the |
340 // |initialized_callback| invocation. | 340 // |initialized_callback| invocation. |
(...skipping 10 matching lines...) Expand all Loading... |
351 // Updates a file by the given |resource_id| on the Drive server by | 351 // Updates a file by the given |resource_id| on the Drive server by |
352 // uploading an updated version. Used for uploading dirty files. The file | 352 // uploading an updated version. Used for uploading dirty files. The file |
353 // should already be present in the cache. | 353 // should already be present in the cache. |
354 // | 354 // |
355 // TODO(satorux): As of now, the function only handles files with the dirty | 355 // TODO(satorux): As of now, the function only handles files with the dirty |
356 // bit committed. We should eliminate the restriction. crbug.com/134558. | 356 // bit committed. We should eliminate the restriction. crbug.com/134558. |
357 // | 357 // |
358 // |callback| must not be null. | 358 // |callback| must not be null. |
359 virtual void UpdateFileByResourceId( | 359 virtual void UpdateFileByResourceId( |
360 const std::string& resource_id, | 360 const std::string& resource_id, |
361 const DriveClientContext& context, | 361 const ClientContext& context, |
362 const FileOperationCallback& callback) = 0; | 362 const FileOperationCallback& callback) = 0; |
363 | 363 |
364 // Finds an entry (a file or a directory) by |file_path|. This call will also | 364 // Finds an entry (a file or a directory) by |file_path|. This call will also |
365 // retrieve and refresh file system content from server and disk cache. | 365 // retrieve and refresh file system content from server and disk cache. |
366 // | 366 // |
367 // |callback| must not be null. | 367 // |callback| must not be null. |
368 virtual void GetResourceEntryByPath( | 368 virtual void GetResourceEntryByPath( |
369 const base::FilePath& file_path, | 369 const base::FilePath& file_path, |
370 const GetResourceEntryCallback& callback) = 0; | 370 const GetResourceEntryCallback& callback) = 0; |
371 | 371 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 const std::string& md5, | 453 const std::string& md5, |
454 const GetCacheEntryCallback& callback) = 0; | 454 const GetCacheEntryCallback& callback) = 0; |
455 | 455 |
456 // Reloads the file system feeds from the server. | 456 // Reloads the file system feeds from the server. |
457 virtual void Reload() = 0; | 457 virtual void Reload() = 0; |
458 }; | 458 }; |
459 | 459 |
460 } // namespace drive | 460 } // namespace drive |
461 | 461 |
462 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_INTERFACE_H_ | 462 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_INTERFACE_H_ |
OLD | NEW |