Chromium Code Reviews| Index: chrome/browser/sync_file_system/drive_backend/fake_sync_worker.h |
| diff --git a/chrome/browser/sync_file_system/drive_backend/fake_sync_worker.h b/chrome/browser/sync_file_system/drive_backend/fake_sync_worker.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d2439ec62cd76cf82945da2f670a37ecd799f0c2 |
| --- /dev/null |
| +++ b/chrome/browser/sync_file_system/drive_backend/fake_sync_worker.h |
| @@ -0,0 +1,132 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_SYNC_WORKER_H_ |
| +#define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_SYNC_WORKER_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/observer_list.h" |
| +#include "base/sequence_checker.h" |
| +#include "chrome/browser/sync_file_system/drive_backend/sync_worker_interface.h" |
| +#include "chrome/browser/sync_file_system/remote_file_sync_service.h" |
| +#include "chrome/browser/sync_file_system/sync_callbacks.h" |
| +#include "net/base/network_change_notifier.h" |
| + |
| +class GURL; |
| + |
| +namespace base { |
| +class FilePath; |
| +class ListValue; |
| +} |
| + |
| +namespace drive { |
| +class DriveServiceInterface; |
| +class DriveUploaderInterface; |
| +} |
| + |
| +namespace fileapi { |
| +class FileSystemURL; |
| +} |
| + |
| +namespace leveldb { |
| +class Env; |
|
tzik
2014/06/13 02:26:15
Can we remove this?
peria
2014/06/13 02:34:46
Done.
|
| +} |
| + |
| +namespace sync_file_system { |
| + |
| +class FileChange; |
| +class SyncFileMetadata; |
| + |
| +namespace drive_backend { |
| + |
| +class MetadataDatabase; |
| +class RemoteChangeProcessorOnWorker; |
| +class SyncTaskManager; |
| + |
| +class FakeSyncWorker : public SyncWorkerInterface { |
| + public: |
| + FakeSyncWorker(); |
| + virtual ~FakeSyncWorker(); |
| + |
| + // SyncWorkerInterface overrides. |
| + virtual void Initialize() OVERRIDE; |
| + virtual void RegisterOrigin(const GURL& origin, |
| + const SyncStatusCallback& callback) OVERRIDE; |
| + virtual void EnableOrigin(const GURL& origin, |
| + const SyncStatusCallback& callback) OVERRIDE; |
| + virtual void DisableOrigin(const GURL& origin, |
| + const SyncStatusCallback& callback) OVERRIDE; |
| + virtual void UninstallOrigin( |
| + const GURL& origin, |
| + RemoteFileSyncService::UninstallFlag flag, |
| + const SyncStatusCallback& callback) OVERRIDE; |
| + virtual void ProcessRemoteChange(const SyncFileCallback& callback) OVERRIDE; |
| + virtual void SetRemoteChangeProcessor( |
| + RemoteChangeProcessorOnWorker* remote_change_processor_on_worker) |
| + OVERRIDE; |
| + virtual RemoteServiceState GetCurrentState() const OVERRIDE; |
| + virtual void GetOriginStatusMap( |
| + const RemoteFileSyncService::StatusMapCallback& callback) OVERRIDE; |
| + virtual scoped_ptr<base::ListValue> DumpFiles(const GURL& origin) OVERRIDE; |
| + virtual scoped_ptr<base::ListValue> DumpDatabase() OVERRIDE; |
| + virtual void SetSyncEnabled(bool enabled) OVERRIDE; |
| + virtual void PromoteDemotedChanges() OVERRIDE; |
| + virtual void ApplyLocalChange( |
| + const FileChange& local_change, |
| + const base::FilePath& local_path, |
| + const SyncFileMetadata& local_metadata, |
| + const fileapi::FileSystemURL& url, |
| + const SyncStatusCallback& callback) OVERRIDE; |
| + virtual void OnNotificationReceived() OVERRIDE; |
| + virtual void OnReadyToSendRequests(const std::string& account_id) OVERRIDE; |
| + virtual void OnRefreshTokenInvalid() OVERRIDE; |
| + virtual void OnNetworkChanged( |
| + net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |
| + virtual drive::DriveServiceInterface* GetDriveService() OVERRIDE; |
| + virtual drive::DriveUploaderInterface* GetDriveUploader() OVERRIDE; |
| + virtual MetadataDatabase* GetMetadataDatabase() OVERRIDE; |
| + virtual SyncTaskManager* GetSyncTaskManager() OVERRIDE; |
| + virtual void DetachFromSequence() OVERRIDE; |
| + virtual void AddObserver(Observer* observer) OVERRIDE; |
| + |
| + void UpdateServiceStateForTesting(RemoteServiceState state, |
| + const std::string& description, |
| + const base::Closure& closure); |
| + |
| + private: |
| + enum AppStatus { |
| + REGISTERED, |
| + ENABLED, |
| + DISABLED, |
| + UNINSTALLED, |
| + }; |
| + typedef std::map<GURL, AppStatus> StatusMap; |
| + |
| + // TODO(peria): Remove this interface after making FakeSyncWorker class. |
| + virtual void SetHasRefreshToken(bool has_refresh_token) OVERRIDE; |
| + |
| + void UpdateServiceState(RemoteServiceState state, |
| + const std::string& description); |
| + |
| + bool sync_enabled_; |
| + StatusMap status_map_; |
| + bool has_refresh_token_; |
| + bool network_available_; |
| + |
| + ObserverList<Observer> observers_; |
| + base::SequenceChecker sequence_checker_; |
| + |
| + base::WeakPtrFactory<FakeSyncWorker> weak_ptr_factory_; |
|
tzik
2014/06/13 02:26:15
not used?/is not going to used?
peria
2014/06/13 02:34:46
Seems not to be needed.
Removed.
|
| + DISALLOW_COPY_AND_ASSIGN(FakeSyncWorker); |
| +}; |
| + |
| +} // namespace drive_backend |
| +} // namespace sync_file_system |
| + |
| +#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_SYNC_WORKER_H_ |