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_GDATA_GDATA_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // | 373 // |
374 // When uploading a new file, adds a new file entry, and store its content | 374 // When uploading a new file, adds a new file entry, and store its content |
375 // from |file_content_path| into the cache. | 375 // from |file_content_path| into the cache. |
376 // | 376 // |
377 // When uploading an existing file, replaces the file entry with a new one, | 377 // When uploading an existing file, replaces the file entry with a new one, |
378 // and clears the dirty bit in the cache. | 378 // and clears the dirty bit in the cache. |
379 // | 379 // |
380 // |callback| will be called on the UI thread upon completion of operation. | 380 // |callback| will be called on the UI thread upon completion of operation. |
381 virtual void AddUploadedFile(UploadMode upload_mode, | 381 virtual void AddUploadedFile(UploadMode upload_mode, |
382 const FilePath& virtual_dir_path, | 382 const FilePath& virtual_dir_path, |
383 DocumentEntry* entry, | 383 scoped_ptr<DocumentEntry> entry, |
384 const FilePath& file_content_path, | 384 const FilePath& file_content_path, |
385 GDataCache::FileOperationType cache_operation, | 385 GDataCache::FileOperationType cache_operation, |
386 const base::Closure& callback) = 0; | 386 const base::Closure& callback) = 0; |
387 }; | 387 }; |
388 | 388 |
389 // The production implementation of GDataFileSystemInterface. | 389 // The production implementation of GDataFileSystemInterface. |
390 class GDataFileSystem : public GDataFileSystemInterface, | 390 class GDataFileSystem : public GDataFileSystemInterface, |
391 public content::NotificationObserver { | 391 public content::NotificationObserver { |
392 public: | 392 public: |
393 GDataFileSystem( | 393 GDataFileSystem( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 const GetFileInfoCallback& callback) OVERRIDE; | 458 const GetFileInfoCallback& callback) OVERRIDE; |
459 virtual void ReadDirectoryByPath( | 459 virtual void ReadDirectoryByPath( |
460 const FilePath& file_path, | 460 const FilePath& file_path, |
461 const ReadDirectoryCallback& callback) OVERRIDE; | 461 const ReadDirectoryCallback& callback) OVERRIDE; |
462 virtual void RequestDirectoryRefresh( | 462 virtual void RequestDirectoryRefresh( |
463 const FilePath& file_path) OVERRIDE; | 463 const FilePath& file_path) OVERRIDE; |
464 virtual void GetAvailableSpace( | 464 virtual void GetAvailableSpace( |
465 const GetAvailableSpaceCallback& callback) OVERRIDE; | 465 const GetAvailableSpaceCallback& callback) OVERRIDE; |
466 virtual void AddUploadedFile(UploadMode upload_mode, | 466 virtual void AddUploadedFile(UploadMode upload_mode, |
467 const FilePath& virtual_dir_path, | 467 const FilePath& virtual_dir_path, |
468 DocumentEntry* entry, | 468 scoped_ptr<DocumentEntry> entry, |
469 const FilePath& file_content_path, | 469 const FilePath& file_content_path, |
470 GDataCache::FileOperationType cache_operation, | 470 GDataCache::FileOperationType cache_operation, |
471 const base::Closure& callback) OVERRIDE; | 471 const base::Closure& callback) OVERRIDE; |
472 | 472 |
473 // content::NotificationObserver implementation. | 473 // content::NotificationObserver implementation. |
474 virtual void Observe(int type, | 474 virtual void Observe(int type, |
475 const content::NotificationSource& source, | 475 const content::NotificationSource& source, |
476 const content::NotificationDetails& details) OVERRIDE; | 476 const content::NotificationDetails& details) OVERRIDE; |
477 | 477 |
478 // Used in tests to inject mock document service. | 478 // Used in tests to inject mock document service. |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 const FilePath& file_path); | 1219 const FilePath& file_path); |
1220 void OnRequestDirectoryRefresh(GetDocumentsParams* params, | 1220 void OnRequestDirectoryRefresh(GetDocumentsParams* params, |
1221 base::PlatformFileError error); | 1221 base::PlatformFileError error); |
1222 void RequestDirectoryRefreshByEntry(const FilePath& directory_path, | 1222 void RequestDirectoryRefreshByEntry(const FilePath& directory_path, |
1223 const std::string& directory_resource_id, | 1223 const std::string& directory_resource_id, |
1224 const FileResourceIdMap& file_map, | 1224 const FileResourceIdMap& file_map, |
1225 GDataEntry* directory_entry); | 1225 GDataEntry* directory_entry); |
1226 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); | 1226 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); |
1227 void AddUploadedFileOnUIThread(UploadMode upload_mode, | 1227 void AddUploadedFileOnUIThread(UploadMode upload_mode, |
1228 const FilePath& virtual_dir_path, | 1228 const FilePath& virtual_dir_path, |
1229 DocumentEntry* entry, | 1229 scoped_ptr<DocumentEntry> entry, |
1230 const FilePath& file_content_path, | 1230 const FilePath& file_content_path, |
1231 GDataCache::FileOperationType cache_operation, | 1231 GDataCache::FileOperationType cache_operation, |
1232 const base::Closure& callback); | 1232 const base::Closure& callback); |
1233 | 1233 |
1234 // All members should be accessed only on UI thread. Do not post tasks to | 1234 // All members should be accessed only on UI thread. Do not post tasks to |
1235 // other threads with base::Unretained(this). | 1235 // other threads with base::Unretained(this). |
1236 | 1236 |
1237 scoped_ptr<GDataRootDirectory> root_; | 1237 scoped_ptr<GDataRootDirectory> root_; |
1238 | 1238 |
1239 // The profile hosts the GDataFileSystem via GDataSystemService. | 1239 // The profile hosts the GDataFileSystem via GDataSystemService. |
(...skipping 28 matching lines...) Expand all Loading... |
1268 | 1268 |
1269 ObserverList<Observer> observers_; | 1269 ObserverList<Observer> observers_; |
1270 | 1270 |
1271 // The token is used to post tasks to the blocking pool in sequence. | 1271 // The token is used to post tasks to the blocking pool in sequence. |
1272 const base::SequencedWorkerPool::SequenceToken sequence_token_; | 1272 const base::SequencedWorkerPool::SequenceToken sequence_token_; |
1273 }; | 1273 }; |
1274 | 1274 |
1275 } // namespace gdata | 1275 } // namespace gdata |
1276 | 1276 |
1277 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 1277 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |