Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / sync_file_system / drive_backend / sync_worker_interface.h
blobb0539743c5837635a3819c10879d437c3304f11c
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.
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_WORKER_INTERFACE_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_WORKER_INTERFACE_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/sync_file_system/remote_file_sync_service.h"
12 #include "chrome/browser/sync_file_system/sync_action.h"
13 #include "chrome/browser/sync_file_system/sync_callbacks.h"
14 #include "chrome/browser/sync_file_system/sync_direction.h"
15 #include "net/base/network_change_notifier.h"
17 class GURL;
19 namespace base {
20 class FilePath;
21 class ListValue;
24 namespace drive {
25 class DriveServiceInterface;
26 class DriveUploaderInterface;
29 namespace storage {
30 class FileSystemURL;
33 namespace sync_file_system {
35 class FileChange;
36 class SyncFileMetadata;
38 namespace drive_backend {
40 class MetadataDatabase;
41 class RemoteChangeProcessorOnWorker;
42 class SyncEngineContext;
43 class SyncTaskManager;
45 class SyncWorkerInterface {
46 public:
47 class Observer {
48 public:
49 virtual void OnPendingFileListUpdated(int item_count) = 0;
50 virtual void OnFileStatusChanged(const storage::FileSystemURL& url,
51 SyncFileType file_type,
52 SyncFileStatus file_status,
53 SyncAction sync_action,
54 SyncDirection direction) = 0;
55 virtual void UpdateServiceState(RemoteServiceState state,
56 const std::string& description) = 0;
58 protected:
59 virtual ~Observer() {}
62 SyncWorkerInterface() {}
63 virtual ~SyncWorkerInterface() {}
65 // Initializes SyncWorkerInterface after constructions of some member classes.
66 virtual void Initialize(
67 scoped_ptr<SyncEngineContext> sync_engine_context) = 0;
69 // See RemoteFileSyncService for the details.
70 virtual void RegisterOrigin(const GURL& origin,
71 const SyncStatusCallback& callback) = 0;
72 virtual void EnableOrigin(const GURL& origin,
73 const SyncStatusCallback& callback) = 0;
74 virtual void DisableOrigin(const GURL& origin,
75 const SyncStatusCallback& callback) = 0;
76 virtual void UninstallOrigin(
77 const GURL& origin,
78 RemoteFileSyncService::UninstallFlag flag,
79 const SyncStatusCallback& callback) = 0;
80 virtual void ProcessRemoteChange(const SyncFileCallback& callback) = 0;
81 virtual void SetRemoteChangeProcessor(
82 RemoteChangeProcessorOnWorker* remote_change_processor_on_worker) = 0;
83 virtual RemoteServiceState GetCurrentState() const = 0;
84 virtual void GetOriginStatusMap(
85 const RemoteFileSyncService::StatusMapCallback& callback) = 0;
86 virtual scoped_ptr<base::ListValue> DumpFiles(const GURL& origin) = 0;
87 virtual scoped_ptr<base::ListValue> DumpDatabase() = 0;
88 virtual void SetSyncEnabled(bool enabled) = 0;
89 virtual void PromoteDemotedChanges(const base::Closure& callback) = 0;
91 // See LocalChangeProcessor for the details.
92 virtual void ApplyLocalChange(const FileChange& local_change,
93 const base::FilePath& local_path,
94 const SyncFileMetadata& local_metadata,
95 const storage::FileSystemURL& url,
96 const SyncStatusCallback& callback) = 0;
98 virtual void ActivateService(RemoteServiceState service_state,
99 const std::string& description) = 0;
100 virtual void DeactivateService(const std::string& description) = 0;
102 virtual void DetachFromSequence() = 0;
104 virtual void AddObserver(Observer* observer) = 0;
106 private:
107 friend class SyncEngineTest;
109 DISALLOW_COPY_AND_ASSIGN(SyncWorkerInterface);
112 } // namespace drive_backend
113 } // namespace sync_file_system
115 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_WORKER_INTERFACE_H_