OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/memory/scoped_ptr.h" |
14 #include "chrome/browser/sync_file_system/conflict_resolution_policy.h" | 15 #include "chrome/browser/sync_file_system/conflict_resolution_policy.h" |
15 #include "chrome/browser/sync_file_system/sync_callbacks.h" | 16 #include "chrome/browser/sync_file_system/sync_callbacks.h" |
16 #include "chrome/browser/sync_file_system/sync_file_metadata.h" | 17 #include "chrome/browser/sync_file_system/sync_file_metadata.h" |
17 #include "webkit/browser/fileapi/file_system_url.h" | 18 #include "webkit/browser/fileapi/file_system_url.h" |
18 | 19 |
19 class BrowserContextKeyedServiceFactory; | 20 class BrowserContextKeyedServiceFactory; |
20 class GURL; | 21 class GURL; |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class ListValue; | 24 class ListValue; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 SyncFileMetadata metadata; | 105 SyncFileMetadata metadata; |
105 }; | 106 }; |
106 | 107 |
107 enum UninstallFlag { | 108 enum UninstallFlag { |
108 UNINSTALL_AND_PURGE_REMOTE, | 109 UNINSTALL_AND_PURGE_REMOTE, |
109 UNINSTALL_AND_KEEP_REMOTE, | 110 UNINSTALL_AND_KEEP_REMOTE, |
110 }; | 111 }; |
111 | 112 |
112 // For GetOriginStatusMap. | 113 // For GetOriginStatusMap. |
113 typedef std::map<GURL, std::string> OriginStatusMap; | 114 typedef std::map<GURL, std::string> OriginStatusMap; |
| 115 typedef base::Callback<void(scoped_ptr<OriginStatusMap> status_map)> |
| 116 StatusMapCallback; |
114 | 117 |
115 // For GetRemoteVersions. | 118 // For GetRemoteVersions. |
116 typedef base::Callback<void(SyncStatusCode status, | 119 typedef base::Callback<void(SyncStatusCode status, |
117 const std::vector<Version>& versions)> | 120 const std::vector<Version>& versions)> |
118 RemoteVersionsCallback; | 121 RemoteVersionsCallback; |
119 typedef base::Callback<void(SyncStatusCode status, | 122 typedef base::Callback<void(SyncStatusCode status, |
120 webkit_blob::ScopedFile downloaded)> | 123 webkit_blob::ScopedFile downloaded)> |
121 DownloadVersionCallback; | 124 DownloadVersionCallback; |
122 | 125 |
123 // For DumpFile. | 126 // For DumpFile. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // Returns a LocalChangeProcessor that applies a local change to the remote | 185 // Returns a LocalChangeProcessor that applies a local change to the remote |
183 // storage backed by this service. | 186 // storage backed by this service. |
184 virtual LocalChangeProcessor* GetLocalChangeProcessor() = 0; | 187 virtual LocalChangeProcessor* GetLocalChangeProcessor() = 0; |
185 | 188 |
186 // Returns the current remote service state (should equal to the value | 189 // Returns the current remote service state (should equal to the value |
187 // returned by the last OnRemoteServiceStateUpdated notification. | 190 // returned by the last OnRemoteServiceStateUpdated notification. |
188 virtual RemoteServiceState GetCurrentState() const = 0; | 191 virtual RemoteServiceState GetCurrentState() const = 0; |
189 | 192 |
190 // Returns all origins along with an arbitrary string description of their | 193 // Returns all origins along with an arbitrary string description of their |
191 // corresponding sync statuses. | 194 // corresponding sync statuses. |
192 virtual void GetOriginStatusMap(OriginStatusMap* status_map) = 0; | 195 virtual void GetOriginStatusMap(const StatusMapCallback& callback) = 0; |
193 | 196 |
194 // Returns file metadata for |origin| to call |callback|. | 197 // Returns file metadata for |origin| to call |callback|. |
195 virtual void DumpFiles(const GURL& origin, | 198 virtual void DumpFiles(const GURL& origin, |
196 const ListCallback& callback) = 0; | 199 const ListCallback& callback) = 0; |
197 | 200 |
198 // Returns the dump of internal database. | 201 // Returns the dump of internal database. |
199 virtual void DumpDatabase(const ListCallback& callback) = 0; | 202 virtual void DumpDatabase(const ListCallback& callback) = 0; |
200 | 203 |
201 // Enables or disables the background sync. | 204 // Enables or disables the background sync. |
202 // Setting this to false should disable the synchronization (and make | 205 // Setting this to false should disable the synchronization (and make |
203 // the service state to REMOTE_SERVICE_DISABLED), while setting this to | 206 // the service state to REMOTE_SERVICE_DISABLED), while setting this to |
204 // true does not necessarily mean the service is actually turned on | 207 // true does not necessarily mean the service is actually turned on |
205 // (for example if Chrome is offline the service state will become | 208 // (for example if Chrome is offline the service state will become |
206 // REMOTE_SERVICE_TEMPORARY_UNAVAILABLE). | 209 // REMOTE_SERVICE_TEMPORARY_UNAVAILABLE). |
207 virtual void SetSyncEnabled(bool enabled) = 0; | 210 virtual void SetSyncEnabled(bool enabled) = 0; |
208 | 211 |
209 virtual void PromoteDemotedChanges() = 0; | 212 virtual void PromoteDemotedChanges() = 0; |
210 | 213 |
211 private: | 214 private: |
212 DISALLOW_COPY_AND_ASSIGN(RemoteFileSyncService); | 215 DISALLOW_COPY_AND_ASSIGN(RemoteFileSyncService); |
213 }; | 216 }; |
214 | 217 |
215 } // namespace sync_file_system | 218 } // namespace sync_file_system |
216 | 219 |
217 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ | 220 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ |
OLD | NEW |