fake_remote_change_processor.h revision 90dce4d38c5ff5333bea97d859d4e484e27edf0c
1// Copyright (c) 2013 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_FAKE_REMOTE_CHANGE_PROCESSOR_H_ 6#define CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_ 7 8#include <map> 9#include <string> 10#include <vector> 11 12#include "base/callback.h" 13#include "chrome/browser/sync_file_system/remote_change_processor.h" 14#include "webkit/browser/fileapi/syncable/sync_callbacks.h" 15 16namespace base { 17class FilePath; 18} 19 20namespace fileapi { 21class FileSystemURL; 22} 23 24namespace sync_file_system { 25 26class FileChange; 27 28class FakeRemoteChangeProcessor : public RemoteChangeProcessor { 29 public: 30 typedef std::map<fileapi::FileSystemURL, std::vector<FileChange>, 31 fileapi::FileSystemURL::Comparator> URLToFileChangesMap; 32 33 FakeRemoteChangeProcessor(); 34 virtual ~FakeRemoteChangeProcessor(); 35 36 // RemoteChangeProcessor overrides. 37 virtual void PrepareForProcessRemoteChange( 38 const fileapi::FileSystemURL& url, 39 const std::string& service_name, 40 const PrepareChangeCallback& callback) OVERRIDE; 41 virtual void ApplyRemoteChange( 42 const FileChange& change, 43 const base::FilePath& local_path, 44 const fileapi::FileSystemURL& url, 45 const SyncStatusCallback& callback) OVERRIDE; 46 virtual void ClearLocalChanges( 47 const fileapi::FileSystemURL& url, 48 const base::Closure& completion_callback) OVERRIDE; 49 virtual void RecordFakeLocalChange( 50 const fileapi::FileSystemURL& url, 51 const FileChange& change, 52 const SyncStatusCallback& callback) OVERRIDE; 53 54 const URLToFileChangesMap& GetAppliedRemoteChanges() const; 55 56 private: 57 // History of file changes given by ApplyRemoteChange(). Changes are arranged 58 // in chronological order, that is, the end of the vector represents the last 59 // change. 60 URLToFileChangesMap applied_changes_; 61 62 DISALLOW_COPY_AND_ASSIGN(FakeRemoteChangeProcessor); 63}; 64 65} // namespace sync_file_system 66 67#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_ 68