remote_change_processor_wrapper.h revision 5c02ac1a9c1b504631c0a3d2b6e737b5d738bae1
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 "chrome/browser/sync_file_system/remote_change_processor.h"
10
11namespace sync_file_system {
12namespace drive_backend {
13
14// This class wraps a part of RemoteChangeProcessor class to support weak
15// pointer.  Each method wraps corresponding name method of
16// RemoteChangeProcessor.  See comments in remote_change_processor.h
17// for details.
18class RemoteChangeProcessorWrapper
19    : public base::SupportsWeakPtr<RemoteChangeProcessorWrapper> {
20 public:
21  explicit RemoteChangeProcessorWrapper(
22      RemoteChangeProcessor* remote_change_processor);
23
24  void PrepareForProcessRemoteChange(
25      const fileapi::FileSystemURL& url,
26      const RemoteChangeProcessor::PrepareChangeCallback& callback);
27
28  void ApplyRemoteChange(
29      const FileChange& change,
30      const base::FilePath& local_path,
31      const fileapi::FileSystemURL& url,
32      const SyncStatusCallback& callback);
33
34  void FinalizeRemoteSync(
35      const fileapi::FileSystemURL& url,
36      bool clear_local_changes,
37      const base::Closure& completion_callback);
38
39  void RecordFakeLocalChange(
40      const fileapi::FileSystemURL& url,
41      const FileChange& change,
42      const SyncStatusCallback& callback);
43
44 private:
45  RemoteChangeProcessor* remote_change_processor_;
46
47  DISALLOW_COPY_AND_ASSIGN(RemoteChangeProcessorWrapper);
48};
49
50}  // namespace drive_backend
51}  // namespace sync_file_system
52
53#endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_CHANGE_PROCESSOR_WRAPPER_H_
54