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