fake_remote_change_processor.h revision 2385ea399aae016c0806a4f9ef3c9cfe3d2a39df
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 "chrome/browser/sync_file_system/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 PrepareChangeCallback& callback) OVERRIDE; 40 virtual void ApplyRemoteChange( 41 const FileChange& change, 42 const base::FilePath& local_path, 43 const fileapi::FileSystemURL& url, 44 const SyncStatusCallback& callback) OVERRIDE; 45 virtual void ClearLocalChanges( 46 const fileapi::FileSystemURL& url, 47 const base::Closure& completion_callback) OVERRIDE; 48 virtual void RecordFakeLocalChange( 49 const fileapi::FileSystemURL& url, 50 const FileChange& change, 51 const SyncStatusCallback& callback) OVERRIDE; 52 53 const URLToFileChangesMap& GetAppliedRemoteChanges() const; 54 55 private: 56 // History of file changes given by ApplyRemoteChange(). Changes are arranged 57 // in chronological order, that is, the end of the vector represents the last 58 // change. 59 URLToFileChangesMap applied_changes_; 60 61 DISALLOW_COPY_AND_ASSIGN(FakeRemoteChangeProcessor); 62}; 63 64} // namespace sync_file_system 65 66#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_ 67