| 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_DRIVE_FILE_SYSTEM_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_INTERFACE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/browser/chromeos/drive/drive_cache.h" | 12 #include "chrome/browser/chromeos/drive/drive_cache.h" |
| 13 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" | 13 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" |
| 14 #include "chrome/browser/google_apis/gdata_operations.h" | 14 #include "chrome/browser/google_apis/gdata_operations.h" |
| 15 | 15 |
| 16 namespace gdata { | 16 namespace gdata { |
| 17 class DocumentEntry; |
| 18 } |
| 17 | 19 |
| 18 class DocumentEntry; | 20 namespace drive { |
| 21 |
| 19 class DriveEntryProto; | 22 class DriveEntryProto; |
| 20 class DriveFileSystemObserver; | 23 class DriveFileSystemObserver; |
| 21 | 24 |
| 22 typedef std::vector<DriveEntryProto> DriveEntryProtoVector; | 25 typedef std::vector<DriveEntryProto> DriveEntryProtoVector; |
| 23 | 26 |
| 24 // Information about search result returned by Search Async callback. | 27 // Information about search result returned by Search Async callback. |
| 25 // This is data needed to create a file system entry that will be used by file | 28 // This is data needed to create a file system entry that will be used by file |
| 26 // browser. | 29 // browser. |
| 27 struct SearchResultInfo { | 30 struct SearchResultInfo { |
| 28 SearchResultInfo(const FilePath& in_path, bool in_is_directory) | 31 SearchResultInfo(const FilePath& in_path, bool in_is_directory) |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // system in order to be retrieved. If the file is not cached, the file | 238 // system in order to be retrieved. If the file is not cached, the file |
| 236 // will be downloaded through GData API or Drive V2 API. | 239 // will be downloaded through GData API or Drive V2 API. |
| 237 // | 240 // |
| 238 // Can be called from UI/IO thread. |get_file_callback| and | 241 // Can be called from UI/IO thread. |get_file_callback| and |
| 239 // |get_content_callback| are run on the calling thread. | 242 // |get_content_callback| are run on the calling thread. |
| 240 // |get_file_callback| must not be null. | 243 // |get_file_callback| must not be null. |
| 241 // |get_content_callback| may be null. | 244 // |get_content_callback| may be null. |
| 242 virtual void GetFileByPath( | 245 virtual void GetFileByPath( |
| 243 const FilePath& file_path, | 246 const FilePath& file_path, |
| 244 const GetFileCallback& get_file_callback, | 247 const GetFileCallback& get_file_callback, |
| 245 const GetContentCallback& get_content_callback) = 0; | 248 const gdata::GetContentCallback& get_content_callback) = 0; |
| 246 | 249 |
| 247 // Gets a file by the given |resource_id| from the Drive server. Used for | 250 // Gets a file by the given |resource_id| from the Drive server. Used for |
| 248 // fetching pinned-but-not-fetched files. | 251 // fetching pinned-but-not-fetched files. |
| 249 // | 252 // |
| 250 // Can be called from UI/IO thread. |get_file_callback| and | 253 // Can be called from UI/IO thread. |get_file_callback| and |
| 251 // |get_content_callback| are run on the calling thread. | 254 // |get_content_callback| are run on the calling thread. |
| 252 // |get_file_callback| must not be null. | 255 // |get_file_callback| must not be null. |
| 253 // |get_content_callback| may be null. | 256 // |get_content_callback| may be null. |
| 254 virtual void GetFileByResourceId( | 257 virtual void GetFileByResourceId( |
| 255 const std::string& resource_id, | 258 const std::string& resource_id, |
| 256 const GetFileCallback& get_file_callback, | 259 const GetFileCallback& get_file_callback, |
| 257 const GetContentCallback& get_content_callback) = 0; | 260 const gdata::GetContentCallback& get_content_callback) = 0; |
| 258 | 261 |
| 259 // Updates a file by the given |resource_id| on the Drive server by | 262 // Updates a file by the given |resource_id| on the Drive server by |
| 260 // uploading an updated version. Used for uploading dirty files. The file | 263 // uploading an updated version. Used for uploading dirty files. The file |
| 261 // should already be present in the cache. | 264 // should already be present in the cache. |
| 262 // | 265 // |
| 263 // TODO(satorux): As of now, the function only handles files with the dirty | 266 // TODO(satorux): As of now, the function only handles files with the dirty |
| 264 // bit committed. We should eliminate the restriction. crbug.com/134558. | 267 // bit committed. We should eliminate the restriction. crbug.com/134558. |
| 265 // | 268 // |
| 266 // Can be called from UI/IO thread. |callback| and is run on the calling | 269 // Can be called from UI/IO thread. |callback| and is run on the calling |
| 267 // thread. |callback| must not be null. | 270 // thread. |callback| must not be null. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 // Adds a file entry from |doc_entry| under |directory_path|, and modifies | 323 // Adds a file entry from |doc_entry| under |directory_path|, and modifies |
| 321 // the cache state. | 324 // the cache state. |
| 322 // | 325 // |
| 323 // When uploading a new file, adds a new file entry, and store its content | 326 // When uploading a new file, adds a new file entry, and store its content |
| 324 // from |file_content_path| into the cache. | 327 // from |file_content_path| into the cache. |
| 325 // | 328 // |
| 326 // When uploading an existing file, replaces the file entry with a new one, | 329 // When uploading an existing file, replaces the file entry with a new one, |
| 327 // and clears the dirty bit in the cache. | 330 // and clears the dirty bit in the cache. |
| 328 // | 331 // |
| 329 // |callback| will be called on the UI thread upon completion of operation. | 332 // |callback| will be called on the UI thread upon completion of operation. |
| 330 virtual void AddUploadedFile(UploadMode upload_mode, | 333 virtual void AddUploadedFile(gdata::UploadMode upload_mode, |
| 331 const FilePath& directory_path, | 334 const FilePath& directory_path, |
| 332 scoped_ptr<DocumentEntry> doc_entry, | 335 scoped_ptr<gdata::DocumentEntry> doc_entry, |
| 333 const FilePath& file_content_path, | 336 const FilePath& file_content_path, |
| 334 DriveCache::FileOperationType cache_operation, | 337 DriveCache::FileOperationType cache_operation, |
| 335 const base::Closure& callback) = 0; | 338 const base::Closure& callback) = 0; |
| 336 | 339 |
| 337 // Updates the data associated with the file referenced by |resource_id| and | 340 // Updates the data associated with the file referenced by |resource_id| and |
| 338 // |md5|. The data is copied from |file_content_path|. | 341 // |md5|. The data is copied from |file_content_path|. |
| 339 // | 342 // |
| 340 // |callback| will be called on the UI thread upon completion of operation. | 343 // |callback| will be called on the UI thread upon completion of operation. |
| 341 virtual void UpdateEntryData(const std::string& resource_id, | 344 virtual void UpdateEntryData(const std::string& resource_id, |
| 342 const std::string& md5, | 345 const std::string& md5, |
| 343 scoped_ptr<DocumentEntry> entry, | 346 scoped_ptr<gdata::DocumentEntry> entry, |
| 344 const FilePath& file_content_path, | 347 const FilePath& file_content_path, |
| 345 const base::Closure& callback) = 0; | 348 const base::Closure& callback) = 0; |
| 346 }; | 349 }; |
| 347 | 350 |
| 348 } // namespace gdata | 351 } // namespace drive |
| 349 | 352 |
| 350 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_INTERFACE_H_ | 353 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_INTERFACE_H_ |
| OLD | NEW |