Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system.h

Issue 10690028: gdata: Get rid of GDataFileSystem::GetCacheState() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 typedef base::Callback<void(base::PlatformFileError error, 96 typedef base::Callback<void(base::PlatformFileError error,
97 int64 bytes_total, 97 int64 bytes_total,
98 int64 bytes_used)> 98 int64 bytes_used)>
99 GetAvailableSpaceCallback; 99 GetAvailableSpaceCallback;
100 100
101 // Used by GDataFileSystem::GetDocumentResourceIdOnBlockingPool to return 101 // Used by GDataFileSystem::GetDocumentResourceIdOnBlockingPool to return
102 // the resource ID read from a document JSON file on the local file system. 102 // the resource ID read from a document JSON file on the local file system.
103 typedef base::Callback<void(const std::string& resource_id)> 103 typedef base::Callback<void(const std::string& resource_id)>
104 GetDocumentResourceIdCallback; 104 GetDocumentResourceIdCallback;
105 105
106 // Callback for GetCacheState operation.
107 typedef base::Callback<void(base::PlatformFileError error,
108 int cache_state)> GetCacheStateCallback;
109
110 // GData file system abstraction layer. 106 // GData file system abstraction layer.
111 // The interface is defined to make GDataFileSystem mockable. 107 // The interface is defined to make GDataFileSystem mockable.
112 class GDataFileSystemInterface { 108 class GDataFileSystemInterface {
113 public: 109 public:
114 virtual ~GDataFileSystemInterface() {} 110 virtual ~GDataFileSystemInterface() {}
115 111
116 // Used to notify events on the file system. 112 // Used to notify events on the file system.
117 // All events are notified on UI thread. 113 // All events are notified on UI thread.
118 class Observer { 114 class Observer {
119 public: 115 public:
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // 286 //
291 // TODO(satorux): As of now, the function only handles files with the dirty 287 // TODO(satorux): As of now, the function only handles files with the dirty
292 // bit committed. We should eliminate the restriction. crbug.com/134558. 288 // bit committed. We should eliminate the restriction. crbug.com/134558.
293 // 289 //
294 // Can be called from UI/IO thread. |callback| and is run on the calling 290 // Can be called from UI/IO thread. |callback| and is run on the calling
295 // thread. 291 // thread.
296 virtual void UpdateFileByResourceId( 292 virtual void UpdateFileByResourceId(
297 const std::string& resource_id, 293 const std::string& resource_id,
298 const FileOperationCallback& callback) = 0; 294 const FileOperationCallback& callback) = 0;
299 295
300 // Gets the cache state of file corresponding to |resource_id| and |md5| if it
301 // exists on disk.
302 // Initializes cache if it has not been initialized.
303 // Upon completion, |callback| is invoked on the thread where this method was
304 // called with the cache state if file exists in cache or CACHE_STATE_NONE
305 // otherwise.
306 virtual void GetCacheState(const std::string& resource_id,
307 const std::string& md5,
308 const GetCacheStateCallback& callback) = 0;
309
310 // Finds an entry (a file or a directory) by |file_path|. This call will also 296 // Finds an entry (a file or a directory) by |file_path|. This call will also
311 // retrieve and refresh file system content from server and disk cache. 297 // retrieve and refresh file system content from server and disk cache.
312 // 298 //
313 // Can be called from UI/IO thread. |callback| is run on the calling thread. 299 // Can be called from UI/IO thread. |callback| is run on the calling thread.
314 virtual void GetEntryInfoByPath(const FilePath& file_path, 300 virtual void GetEntryInfoByPath(const FilePath& file_path,
315 const GetEntryInfoCallback& callback) = 0; 301 const GetEntryInfoCallback& callback) = 0;
316 302
317 // Finds a file (not a directory) by |file_path|. This call will also 303 // Finds a file (not a directory) by |file_path|. This call will also
318 // retrieve and refresh file system content from server and disk cache. 304 // retrieve and refresh file system content from server and disk cache.
319 // 305 //
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 const FilePath& file_path, 413 const FilePath& file_path,
428 const GetFileCallback& get_file_callback, 414 const GetFileCallback& get_file_callback,
429 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE; 415 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE;
430 virtual void GetFileByResourceId( 416 virtual void GetFileByResourceId(
431 const std::string& resource_id, 417 const std::string& resource_id,
432 const GetFileCallback& get_file_callback, 418 const GetFileCallback& get_file_callback,
433 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE; 419 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE;
434 virtual void UpdateFileByResourceId( 420 virtual void UpdateFileByResourceId(
435 const std::string& resource_id, 421 const std::string& resource_id,
436 const FileOperationCallback& callback) OVERRIDE; 422 const FileOperationCallback& callback) OVERRIDE;
437 virtual void GetCacheState(const std::string& resource_id,
438 const std::string& md5,
439 const GetCacheStateCallback& callback) OVERRIDE;
440 virtual void GetEntryInfoByPath( 423 virtual void GetEntryInfoByPath(
441 const FilePath& file_path, 424 const FilePath& file_path,
442 const GetEntryInfoCallback& callback) OVERRIDE; 425 const GetEntryInfoCallback& callback) OVERRIDE;
443 virtual void GetFileInfoByPath( 426 virtual void GetFileInfoByPath(
444 const FilePath& file_path, 427 const FilePath& file_path,
445 const GetFileInfoCallback& callback) OVERRIDE; 428 const GetFileInfoCallback& callback) OVERRIDE;
446 virtual void ReadDirectoryByPath( 429 virtual void ReadDirectoryByPath(
447 const FilePath& file_path, 430 const FilePath& file_path,
448 const ReadDirectoryCallback& callback) OVERRIDE; 431 const ReadDirectoryCallback& callback) OVERRIDE;
449 virtual void RequestDirectoryRefresh( 432 virtual void RequestDirectoryRefresh(
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 // Callback for handling file downloading requests. 821 // Callback for handling file downloading requests.
839 void OnFileDownloaded( 822 void OnFileDownloaded(
840 const GetFileFromCacheParams& params, 823 const GetFileFromCacheParams& params,
841 GDataErrorCode status, 824 GDataErrorCode status,
842 const GURL& content_url, 825 const GURL& content_url,
843 const FilePath& downloaded_file_path); 826 const FilePath& downloaded_file_path);
844 827
845 // Unpins file if cache entry is pinned. 828 // Unpins file if cache entry is pinned.
846 void UnpinIfPinned(const std::string& resource_id, 829 void UnpinIfPinned(const std::string& resource_id,
847 const std::string& md5, 830 const std::string& md5,
848 GDataCache::CacheEntry* cache_entry, 831 bool success,
849 bool* cache_entry_is_valid); 832 const GDataCache::CacheEntry& cache_entry);
850 833
851 // Similar to OnFileDownloaded() but takes |has_enough_space| so we report 834 // Similar to OnFileDownloaded() but takes |has_enough_space| so we report
852 // an error in case we don't have enough disk space. 835 // an error in case we don't have enough disk space.
853 void OnFileDownloadedAndSpaceChecked( 836 void OnFileDownloadedAndSpaceChecked(
854 const GetFileFromCacheParams& params, 837 const GetFileFromCacheParams& params,
855 GDataErrorCode status, 838 GDataErrorCode status,
856 const GURL& content_url, 839 const GURL& content_url,
857 const FilePath& downloaded_file_path, 840 const FilePath& downloaded_file_path,
858 bool* has_enough_space); 841 bool* has_enough_space);
859 842
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 const GetFileInfoCallback& callback); 1134 const GetFileInfoCallback& callback);
1152 void FindEntryByResourceIdOnUIThread(const std::string& resource_id, 1135 void FindEntryByResourceIdOnUIThread(const std::string& resource_id,
1153 const FindEntryCallback& callback); 1136 const FindEntryCallback& callback);
1154 void ReadDirectoryByPathAsyncOnUIThread( 1137 void ReadDirectoryByPathAsyncOnUIThread(
1155 const FilePath& file_path, 1138 const FilePath& file_path,
1156 const ReadDirectoryCallback& callback); 1139 const ReadDirectoryCallback& callback);
1157 void RequestDirectoryRefreshOnUIThread( 1140 void RequestDirectoryRefreshOnUIThread(
1158 const FilePath& file_path); 1141 const FilePath& file_path);
1159 void OnRequestDirectoryRefresh(GetDocumentsParams* params, 1142 void OnRequestDirectoryRefresh(GetDocumentsParams* params,
1160 base::PlatformFileError error); 1143 base::PlatformFileError error);
1161 void GetCacheStateOnUIThread(const std::string& resource_id,
1162 const std::string& md5,
1163 const GetCacheStateCallback& callback);
1164 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); 1144 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback);
1165 void AddUploadedFileOnUIThread(UploadMode upload_mode, 1145 void AddUploadedFileOnUIThread(UploadMode upload_mode,
1166 const FilePath& virtual_dir_path, 1146 const FilePath& virtual_dir_path,
1167 DocumentEntry* entry, 1147 DocumentEntry* entry,
1168 const FilePath& file_content_path, 1148 const FilePath& file_content_path,
1169 GDataCache::FileOperationType cache_operation, 1149 GDataCache::FileOperationType cache_operation,
1170 const base::Closure& callback); 1150 const base::Closure& callback);
1171 1151
1172 // All members should be accessed only on UI thread. Do not post tasks to 1152 // All members should be accessed only on UI thread. Do not post tasks to
1173 // other threads with base::Unretained(this). 1153 // other threads with base::Unretained(this).
(...skipping 29 matching lines...) Expand all
1203 1183
1204 ObserverList<Observer> observers_; 1184 ObserverList<Observer> observers_;
1205 1185
1206 // The token is used to post tasks to the blocking pool in sequence. 1186 // The token is used to post tasks to the blocking pool in sequence.
1207 const base::SequencedWorkerPool::SequenceToken sequence_token_; 1187 const base::SequencedWorkerPool::SequenceToken sequence_token_;
1208 }; 1188 };
1209 1189
1210 } // namespace gdata 1190 } // namespace gdata
1211 1191
1212 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 1192 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698