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

Unified Diff: chrome/browser/chromeos/gdata/gdata_file_system.h

Issue 10008100: gdata: Support mouting archive file in GData cache (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: gdata: Support mounting archive files in GData cache Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/gdata/gdata_file_system.h
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.h b/chrome/browser/chromeos/gdata/gdata_file_system.h
index c238e2f6edc9f5fedbbe1692536ac3cbef3d91f0..49839b082945a65d4757429cb51074752490b7cb 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.h
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.h
@@ -71,6 +71,11 @@ typedef base::Callback<void(base::PlatformFileError error,
GDataFileType file_type)>
GetFileCallback;
+// Callback for SetMountedState.
+typedef base::Callback<void(base::PlatformFileError error,
+ const FilePath& file_path)>
+ SetMountedStateCallback;
+
// Used for file operations like removing files.
typedef base::Callback<void(base::PlatformFileError error,
base::ListValue* feed_list)>
@@ -183,6 +188,7 @@ class GDataFileSystemInterface {
enum CachedFileOrigin {
CACHED_FILE_FROM_SERVER = 0,
CACHED_FILE_LOCALLY_MODIFIED,
+ CACHED_FILE_MOUNTED,
};
// Enum defining type of file operation e.g. copy or move, etc.
@@ -356,6 +362,10 @@ class GDataFileSystemInterface {
virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path,
GDataFileProperties* properties) = 0;
+ // Returns true if the given path is under gdata cache directory, i.e.
+ // <user_profile_dir>/GCache/v1
+ virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const = 0;
+
// Returns the tmp sub-directory under gdata cache directory, i.e.
// <user_profile_dir>/GCache/v1/tmp
virtual FilePath GetGDataCacheTmpDirectory() const = 0;
@@ -391,6 +401,12 @@ class GDataFileSystemInterface {
virtual void SetPinState(const FilePath& file_path, bool to_pin,
const FileOperationCallback& callback) = 0;
+ // Mark or unmark a file as locally mounted.
+ // When marked as mounted, the file is prevented from being modified
+ // or evicted from cache.
+ virtual void SetMountedState(const FilePath& file_path, bool to_mount,
+ const SetMountedStateCallback& callback) = 0;
+
// Creates a new file from |entry| under |virtual_dir_path|. Stored its
// content from |file_content_path| into the cache.
virtual void AddUploadedFile(const FilePath& virtual_dir_path,
@@ -457,6 +473,7 @@ class GDataFileSystem : public GDataFileSystemInterface,
const GetCacheStateCallback& callback) OVERRIDE;
virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path,
GDataFileProperties* properties) OVERRIDE;
+ virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const OVERRIDE;
virtual FilePath GetGDataCacheTmpDirectory() const OVERRIDE;
virtual FilePath GetGDataTempDownloadFolderPath() const OVERRIDE;
virtual FilePath GetGDataTempDocumentFolderPath() const OVERRIDE;
@@ -472,6 +489,10 @@ class GDataFileSystem : public GDataFileSystemInterface,
// Calls private Pin or Unpin methods with |callback|.
virtual void SetPinState(const FilePath& file_path, bool pin,
const FileOperationCallback& callback) OVERRIDE;
+ virtual void SetMountedState(
+ const FilePath& file_path,
+ bool to_mount,
+ const SetMountedStateCallback& callback) OVERRIDE;
virtual void AddUploadedFile(const FilePath& virtual_dir_path,
DocumentEntry* entry,
const FilePath& file_content_path,
@@ -1179,6 +1200,14 @@ class GDataFileSystem : public GDataFileSystemInterface,
FileOperationType file_operation_type,
base::PlatformFileError* error);
+ // Task posted from SetMountedState to modify cache state on the IO thread
+ // pool, which involves the following:
+ // - moves |source_path| to |dest_path|
+ void SetMountedStateOnIOThreadPool(const FilePath& file_path,
+ bool to_mount,
+ base::PlatformFileError* error,
+ FilePath* cache_file_path);
+
// Task posted from MarkDirtyInCache to modify cache state on the IO thread
// pool, which involves the following:
// - moves |source_path| to |dest_path| in persistent dir, where

Powered by Google App Engine
This is Rietveld 408576698