Home | History | Annotate | Download | only in drive_backend
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_CHANGE_PROCESSOR_WRAPPER_H_
      6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_CHANGE_PROCESSOR_WRAPPER_H_
      7 
      8 #include "base/memory/weak_ptr.h"
      9 #include "base/sequence_checker.h"
     10 #include "chrome/browser/sync_file_system/remote_change_processor.h"
     11 
     12 namespace sync_file_system {
     13 namespace drive_backend {
     14 
     15 // This class wraps a part of RemoteChangeProcessor class to support weak
     16 // pointer.  Each method wraps corresponding name method of
     17 // RemoteChangeProcessor.  See comments in remote_change_processor.h
     18 // for details.
     19 class RemoteChangeProcessorWrapper
     20     : public base::SupportsWeakPtr<RemoteChangeProcessorWrapper> {
     21  public:
     22   explicit RemoteChangeProcessorWrapper(
     23       RemoteChangeProcessor* remote_change_processor);
     24 
     25   void PrepareForProcessRemoteChange(
     26       const storage::FileSystemURL& url,
     27       const RemoteChangeProcessor::PrepareChangeCallback& callback);
     28 
     29   void ApplyRemoteChange(const FileChange& change,
     30                          const base::FilePath& local_path,
     31                          const storage::FileSystemURL& url,
     32                          const SyncStatusCallback& callback);
     33 
     34   void FinalizeRemoteSync(const storage::FileSystemURL& url,
     35                           bool clear_local_changes,
     36                           const base::Closure& completion_callback);
     37 
     38   void RecordFakeLocalChange(const storage::FileSystemURL& url,
     39                              const FileChange& change,
     40                              const SyncStatusCallback& callback);
     41 
     42  private:
     43   RemoteChangeProcessor* remote_change_processor_;
     44   base::SequenceChecker sequence_checker_;
     45 
     46   DISALLOW_COPY_AND_ASSIGN(RemoteChangeProcessorWrapper);
     47 };
     48 
     49 }  // namespace drive_backend
     50 }  // namespace sync_file_system
     51 
     52 #endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_CHANGE_PROCESSOR_WRAPPER_H_
     53