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_SYNC_FILE_SYSTEM_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "components/sync/driver/sync_service_observer.h" | 25 #include "components/sync/driver/sync_service_observer.h" |
26 #include "extensions/browser/extension_registry_observer.h" | 26 #include "extensions/browser/extension_registry_observer.h" |
27 #include "url/gurl.h" | 27 #include "url/gurl.h" |
28 | 28 |
29 class Profile; | 29 class Profile; |
30 | 30 |
31 namespace storage { | 31 namespace storage { |
32 class FileSystemContext; | 32 class FileSystemContext; |
33 } | 33 } |
34 | 34 |
35 namespace syncer { | 35 namespace sync_driver { |
36 class SyncService; | 36 class SyncService; |
37 } | 37 } |
38 | 38 |
39 namespace sync_file_system { | 39 namespace sync_file_system { |
40 | 40 |
41 class LocalFileSyncService; | 41 class LocalFileSyncService; |
42 class LocalSyncRunner; | 42 class LocalSyncRunner; |
43 class RemoteSyncRunner; | 43 class RemoteSyncRunner; |
44 class SyncEventObserver; | 44 class SyncEventObserver; |
45 | 45 |
46 class SyncFileSystemService | 46 class SyncFileSystemService |
47 : public KeyedService, | 47 : public KeyedService, |
48 public SyncProcessRunner::Client, | 48 public SyncProcessRunner::Client, |
49 public syncer::SyncServiceObserver, | 49 public sync_driver::SyncServiceObserver, |
50 public FileStatusObserver, | 50 public FileStatusObserver, |
51 public extensions::ExtensionRegistryObserver, | 51 public extensions::ExtensionRegistryObserver, |
52 public base::SupportsWeakPtr<SyncFileSystemService> { | 52 public base::SupportsWeakPtr<SyncFileSystemService> { |
53 public: | 53 public: |
54 typedef base::Callback<void(const base::ListValue&)> DumpFilesCallback; | 54 typedef base::Callback<void(const base::ListValue&)> DumpFilesCallback; |
55 typedef base::Callback<void(const RemoteFileSyncService::OriginStatusMap&)> | 55 typedef base::Callback<void(const RemoteFileSyncService::OriginStatusMap&)> |
56 ExtensionStatusMapCallback; | 56 ExtensionStatusMapCallback; |
57 | 57 |
58 // KeyedService implementation. | 58 // KeyedService implementation. |
59 void Shutdown() override; | 59 void Shutdown() override; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void OnExtensionUnloaded( | 140 void OnExtensionUnloaded( |
141 content::BrowserContext* browser_context, | 141 content::BrowserContext* browser_context, |
142 const extensions::Extension* extension, | 142 const extensions::Extension* extension, |
143 extensions::UnloadedExtensionInfo::Reason reason) override; | 143 extensions::UnloadedExtensionInfo::Reason reason) override; |
144 void OnExtensionUninstalled(content::BrowserContext* browser_context, | 144 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
145 const extensions::Extension* extension, | 145 const extensions::Extension* extension, |
146 extensions::UninstallReason reason) override; | 146 extensions::UninstallReason reason) override; |
147 void OnExtensionLoaded(content::BrowserContext* browser_context, | 147 void OnExtensionLoaded(content::BrowserContext* browser_context, |
148 const extensions::Extension* extension) override; | 148 const extensions::Extension* extension) override; |
149 | 149 |
150 // syncer::SyncServiceObserver implementation. | 150 // sync_driver::SyncServiceObserver implementation. |
151 void OnStateChanged() override; | 151 void OnStateChanged() override; |
152 | 152 |
153 // SyncFileStatusObserver implementation. | 153 // SyncFileStatusObserver implementation. |
154 void OnFileStatusChanged(const storage::FileSystemURL& url, | 154 void OnFileStatusChanged(const storage::FileSystemURL& url, |
155 SyncFileType file_type, | 155 SyncFileType file_type, |
156 SyncFileStatus sync_status, | 156 SyncFileStatus sync_status, |
157 SyncAction action_taken, | 157 SyncAction action_taken, |
158 SyncDirection direction) override; | 158 SyncDirection direction) override; |
159 | 159 |
160 // Check the profile's sync preference settings and call | 160 // Check the profile's sync preference settings and call |
161 // remote_file_service_->SetSyncEnabled() to update the status. | 161 // remote_file_service_->SetSyncEnabled() to update the status. |
162 // |profile_sync_service| must be non-null. | 162 // |profile_sync_service| must be non-null. |
163 void UpdateSyncEnabledStatus(syncer::SyncService* profile_sync_service); | 163 void UpdateSyncEnabledStatus(sync_driver::SyncService* profile_sync_service); |
164 | 164 |
165 // Runs the SyncProcessRunner method of all sync runners (e.g. for Local sync | 165 // Runs the SyncProcessRunner method of all sync runners (e.g. for Local sync |
166 // and Remote sync). | 166 // and Remote sync). |
167 void RunForEachSyncRunners(void(SyncProcessRunner::*method)()); | 167 void RunForEachSyncRunners(void(SyncProcessRunner::*method)()); |
168 | 168 |
169 Profile* profile_; | 169 Profile* profile_; |
170 | 170 |
171 std::unique_ptr<LocalFileSyncService> local_service_; | 171 std::unique_ptr<LocalFileSyncService> local_service_; |
172 std::unique_ptr<RemoteFileSyncService> remote_service_; | 172 std::unique_ptr<RemoteFileSyncService> remote_service_; |
173 | 173 |
174 // Holds all SyncProcessRunners. | 174 // Holds all SyncProcessRunners. |
175 ScopedVector<SyncProcessRunner> local_sync_runners_; | 175 ScopedVector<SyncProcessRunner> local_sync_runners_; |
176 ScopedVector<SyncProcessRunner> remote_sync_runners_; | 176 ScopedVector<SyncProcessRunner> remote_sync_runners_; |
177 | 177 |
178 // Indicates if sync is currently enabled or not. | 178 // Indicates if sync is currently enabled or not. |
179 bool sync_enabled_; | 179 bool sync_enabled_; |
180 | 180 |
181 TaskLogger task_logger_; | 181 TaskLogger task_logger_; |
182 base::ObserverList<SyncEventObserver> observers_; | 182 base::ObserverList<SyncEventObserver> observers_; |
183 | 183 |
184 bool promoting_demoted_changes_; | 184 bool promoting_demoted_changes_; |
185 base::Closure idle_callback_; | 185 base::Closure idle_callback_; |
186 | 186 |
187 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemService); | 187 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemService); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace sync_file_system | 190 } // namespace sync_file_system |
191 | 191 |
192 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ | 192 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ |
OLD | NEW |