Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / sync_file_system / local / local_file_sync_service.h
index a98e3a3..dbf24c5 100644 (file)
@@ -22,7 +22,7 @@
 class GURL;
 class Profile;
 
-namespace fileapi {
+namespace storage {
 class FileSystemContext;
 }
 
@@ -30,7 +30,7 @@ namespace leveldb {
 class Env;
 }
 
-namespace webkit_blob {
+namespace storage {
 class ScopedFile;
 }
 
@@ -74,13 +74,13 @@ class LocalFileSyncService
   static scoped_ptr<LocalFileSyncService> CreateForTesting(
       Profile* profile,
       leveldb::Env* env_override);
-  virtual ~LocalFileSyncService();
+  ~LocalFileSyncService() override;
 
   void Shutdown();
 
   void MaybeInitializeFileSystemContext(
       const GURL& app_origin,
-      fileapi::FileSystemContext* file_system_context,
+      storage::FileSystemContext* file_system_context,
       const SyncStatusCallback& callback);
 
   void AddChangeObserver(Observer* observer);
@@ -91,7 +91,7 @@ class LocalFileSyncService
   // for sync).
   // Calling this method again while this already has another URL waiting
   // for sync will overwrite the previously registered URL.
-  void RegisterURLForWaitingSync(const fileapi::FileSystemURL& url,
+  void RegisterURLForWaitingSync(const storage::FileSystemURL& url,
                                  const base::Closure& on_syncable_callback);
 
   // Synchronize one (or a set of) local change(s) to the remote server
@@ -119,38 +119,32 @@ class LocalFileSyncService
 
   // Returns true via |callback| if the given file |url| has local pending
   // changes.
-  void HasPendingLocalChanges(
-      const fileapi::FileSystemURL& url,
-      const HasPendingLocalChangeCallback& callback);
+  void HasPendingLocalChanges(const storage::FileSystemURL& url,
+                              const HasPendingLocalChangeCallback& callback);
 
-  void PromoteDemotedChanges();
+  void PromoteDemotedChanges(const base::Closure& callback);
 
   // Returns the metadata of a remote file pointed by |url|.
-  virtual void GetLocalFileMetadata(
-      const fileapi::FileSystemURL& url,
-      const SyncFileMetadataCallback& callback);
+  virtual void GetLocalFileMetadata(const storage::FileSystemURL& url,
+                                    const SyncFileMetadataCallback& callback);
 
   // RemoteChangeProcessor overrides.
-  virtual void PrepareForProcessRemoteChange(
-      const fileapi::FileSystemURL& url,
-      const PrepareChangeCallback& callback) OVERRIDE;
-  virtual void ApplyRemoteChange(
-      const FileChange& change,
-      const base::FilePath& local_path,
-      const fileapi::FileSystemURL& url,
-      const SyncStatusCallback& callback) OVERRIDE;
-  virtual void FinalizeRemoteSync(
-      const fileapi::FileSystemURL& url,
-      bool clear_local_changes,
-      const base::Closure& completion_callback) OVERRIDE;
-  virtual void RecordFakeLocalChange(
-      const fileapi::FileSystemURL& url,
-      const FileChange& change,
-      const SyncStatusCallback& callback) OVERRIDE;
+  void PrepareForProcessRemoteChange(
+      const storage::FileSystemURL& url,
+      const PrepareChangeCallback& callback) override;
+  void ApplyRemoteChange(const FileChange& change,
+                         const base::FilePath& local_path,
+                         const storage::FileSystemURL& url,
+                         const SyncStatusCallback& callback) override;
+  void FinalizeRemoteSync(const storage::FileSystemURL& url,
+                          bool clear_local_changes,
+                          const base::Closure& completion_callback) override;
+  void RecordFakeLocalChange(const storage::FileSystemURL& url,
+                             const FileChange& change,
+                             const SyncStatusCallback& callback) override;
 
   // LocalOriginChangeObserver override.
-  virtual void OnChangesAvailableInOrigins(
-      const std::set<GURL>& origins) OVERRIDE;
+  void OnChangesAvailableInOrigins(const std::set<GURL>& origins) override;
 
   // Called when a particular origin (app) is disabled/enabled while
   // the service is running. This may be called for origins/apps that
@@ -158,7 +152,7 @@ class LocalFileSyncService
   void SetOriginEnabled(const GURL& origin, bool enabled);
 
  private:
-  typedef std::map<GURL, fileapi::FileSystemContext*> OriginToContext;
+  typedef std::map<GURL, storage::FileSystemContext*> OriginToContext;
   friend class OriginChangeMapTest;
 
   class OriginChangeMap {
@@ -193,40 +187,35 @@ class LocalFileSyncService
 
   void DidInitializeFileSystemContext(
       const GURL& app_origin,
-      fileapi::FileSystemContext* file_system_context,
+      storage::FileSystemContext* file_system_context,
       const SyncStatusCallback& callback,
       SyncStatusCode status);
   void DidInitializeForRemoteSync(
-      const fileapi::FileSystemURL& url,
-      fileapi::FileSystemContext* file_system_context,
+      const storage::FileSystemURL& url,
+      storage::FileSystemContext* file_system_context,
       const PrepareChangeCallback& callback,
       SyncStatusCode status);
 
-  // Runs local_sync_callback_ and resets it.
-  void RunLocalSyncCallback(
-      SyncStatusCode status,
-      const fileapi::FileSystemURL& url);
-
   // Callback for ApplyRemoteChange.
   void DidApplyRemoteChange(
       const SyncStatusCallback& callback,
       SyncStatusCode status);
 
   // Callbacks for ProcessLocalChange.
-  void DidGetFileForLocalSync(
-      SyncStatusCode status,
-      const LocalFileSyncInfo& sync_file_info,
-      webkit_blob::ScopedFile snapshot);
-  void ProcessNextChangeForURL(
-      webkit_blob::ScopedFile snapshot,
-      const LocalFileSyncInfo& sync_file_info,
-      const FileChange& last_change,
-      const FileChangeList& changes,
-      SyncStatusCode status);
+  void DidGetFileForLocalSync(const SyncFileCallback& callback,
+                              SyncStatusCode status,
+                              const LocalFileSyncInfo& sync_file_info,
+                              storage::ScopedFile snapshot);
+  void ProcessNextChangeForURL(const SyncFileCallback& callback,
+                               storage::ScopedFile snapshot,
+                               const LocalFileSyncInfo& sync_file_info,
+                               const FileChange& last_change,
+                               const FileChangeList& changes,
+                               SyncStatusCode status);
 
   // A thin wrapper of get_local_change_processor_.
   LocalChangeProcessor* GetLocalChangeProcessor(
-      const fileapi::FileSystemURL& url);
+      const storage::FileSystemURL& url);
 
   Profile* profile_;
 
@@ -243,10 +232,6 @@ class LocalFileSyncService
 
   OriginChangeMap origin_change_map_;
 
-  // This callback is non-null while a local sync is running (i.e.
-  // ProcessLocalChange has been called and has not been returned yet).
-  SyncFileCallback local_sync_callback_;
-
   LocalChangeProcessor* local_change_processor_;
   GetLocalChangeProcessorCallback get_local_change_processor_;