Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/fake_sync_worker.h

Issue 327323006: [SyncFS] Create FakeSyncWorker class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/fake_sync_worker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_FAKE_SYNC_WORKER_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_SYNC_WORKER_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h"
14 #include "base/sequence_checker.h"
15 #include "chrome/browser/sync_file_system/drive_backend/sync_worker_interface.h"
16 #include "chrome/browser/sync_file_system/remote_file_sync_service.h"
17 #include "chrome/browser/sync_file_system/sync_callbacks.h"
18 #include "net/base/network_change_notifier.h"
19
20 class GURL;
21
22 namespace base {
23 class FilePath;
24 class ListValue;
25 }
26
27 namespace drive {
28 class DriveServiceInterface;
29 class DriveUploaderInterface;
30 }
31
32 namespace fileapi {
33 class FileSystemURL;
34 }
35
36 namespace sync_file_system {
37
38 class FileChange;
39 class SyncFileMetadata;
40
41 namespace drive_backend {
42
43 class MetadataDatabase;
44 class RemoteChangeProcessorOnWorker;
45 class SyncTaskManager;
46
47 class FakeSyncWorker : public SyncWorkerInterface {
48 public:
49 FakeSyncWorker();
50 virtual ~FakeSyncWorker();
51
52 // SyncWorkerInterface overrides.
53 virtual void Initialize() OVERRIDE;
54 virtual void RegisterOrigin(const GURL& origin,
55 const SyncStatusCallback& callback) OVERRIDE;
56 virtual void EnableOrigin(const GURL& origin,
57 const SyncStatusCallback& callback) OVERRIDE;
58 virtual void DisableOrigin(const GURL& origin,
59 const SyncStatusCallback& callback) OVERRIDE;
60 virtual void UninstallOrigin(
61 const GURL& origin,
62 RemoteFileSyncService::UninstallFlag flag,
63 const SyncStatusCallback& callback) OVERRIDE;
64 virtual void ProcessRemoteChange(const SyncFileCallback& callback) OVERRIDE;
65 virtual void SetRemoteChangeProcessor(
66 RemoteChangeProcessorOnWorker* remote_change_processor_on_worker)
67 OVERRIDE;
68 virtual RemoteServiceState GetCurrentState() const OVERRIDE;
69 virtual void GetOriginStatusMap(
70 const RemoteFileSyncService::StatusMapCallback& callback) OVERRIDE;
71 virtual scoped_ptr<base::ListValue> DumpFiles(const GURL& origin) OVERRIDE;
72 virtual scoped_ptr<base::ListValue> DumpDatabase() OVERRIDE;
73 virtual void SetSyncEnabled(bool enabled) OVERRIDE;
74 virtual void PromoteDemotedChanges() OVERRIDE;
75 virtual void ApplyLocalChange(
76 const FileChange& local_change,
77 const base::FilePath& local_path,
78 const SyncFileMetadata& local_metadata,
79 const fileapi::FileSystemURL& url,
80 const SyncStatusCallback& callback) OVERRIDE;
81 virtual void OnNotificationReceived() OVERRIDE;
82 virtual void OnReadyToSendRequests() OVERRIDE;
83 virtual void OnRefreshTokenInvalid() OVERRIDE;
84 virtual void OnNetworkChanged(
85 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
86 virtual drive::DriveServiceInterface* GetDriveService() OVERRIDE;
87 virtual drive::DriveUploaderInterface* GetDriveUploader() OVERRIDE;
88 virtual MetadataDatabase* GetMetadataDatabase() OVERRIDE;
89 virtual SyncTaskManager* GetSyncTaskManager() OVERRIDE;
90 virtual void DetachFromSequence() OVERRIDE;
91 virtual void AddObserver(Observer* observer) OVERRIDE;
92
93 private:
94 friend class SyncEngineTest;
95
96 enum AppStatus {
97 REGISTERED,
98 ENABLED,
99 DISABLED,
100 UNINSTALLED,
101 };
102 typedef std::map<GURL, AppStatus> StatusMap;
103
104 // TODO(peria): Change this method to be non-virtual.
105 virtual void SetHasRefreshToken(bool has_refresh_token) OVERRIDE;
106
107 void UpdateServiceState(RemoteServiceState state,
108 const std::string& description);
109
110 bool sync_enabled_;
111 StatusMap status_map_;
112 bool has_refresh_token_;
113 bool network_available_;
114
115 ObserverList<Observer> observers_;
116 base::SequenceChecker sequence_checker_;
117
118 DISALLOW_COPY_AND_ASSIGN(FakeSyncWorker);
119 };
120
121 } // namespace drive_backend
122 } // namespace sync_file_system
123
124 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_SYNC_WORKER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/fake_sync_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698