| 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 <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/sync_file_system/sync_process_runner.h" | 23 #include "chrome/browser/sync_file_system/sync_process_runner.h" |
| 24 #include "chrome/browser/sync_file_system/sync_service_state.h" | 24 #include "chrome/browser/sync_file_system/sync_service_state.h" |
| 25 #include "chrome/browser/sync_file_system/task_logger.h" | 25 #include "chrome/browser/sync_file_system/task_logger.h" |
| 26 #include "components/keyed_service/core/keyed_service.h" | 26 #include "components/keyed_service/core/keyed_service.h" |
| 27 #include "extensions/browser/extension_registry_observer.h" | 27 #include "extensions/browser/extension_registry_observer.h" |
| 28 #include "url/gurl.h" | 28 #include "url/gurl.h" |
| 29 | 29 |
| 30 class Profile; | 30 class Profile; |
| 31 class ProfileSyncServiceBase; | 31 class ProfileSyncServiceBase; |
| 32 | 32 |
| 33 namespace fileapi { | 33 namespace storage { |
| 34 class FileSystemContext; | 34 class FileSystemContext; |
| 35 } | 35 } |
| 36 | 36 |
| 37 namespace sync_file_system { | 37 namespace sync_file_system { |
| 38 | 38 |
| 39 class LocalFileSyncService; | 39 class LocalFileSyncService; |
| 40 class LocalSyncRunner; | 40 class LocalSyncRunner; |
| 41 class RemoteSyncRunner; | 41 class RemoteSyncRunner; |
| 42 class SyncEventObserver; | 42 class SyncEventObserver; |
| 43 | 43 |
| 44 class SyncFileSystemService | 44 class SyncFileSystemService |
| 45 : public KeyedService, | 45 : public KeyedService, |
| 46 public SyncProcessRunner::Client, | 46 public SyncProcessRunner::Client, |
| 47 public ProfileSyncServiceObserver, | 47 public ProfileSyncServiceObserver, |
| 48 public FileStatusObserver, | 48 public FileStatusObserver, |
| 49 public extensions::ExtensionRegistryObserver, | 49 public extensions::ExtensionRegistryObserver, |
| 50 public base::SupportsWeakPtr<SyncFileSystemService> { | 50 public base::SupportsWeakPtr<SyncFileSystemService> { |
| 51 public: | 51 public: |
| 52 typedef base::Callback<void(const base::ListValue&)> DumpFilesCallback; | 52 typedef base::Callback<void(const base::ListValue&)> DumpFilesCallback; |
| 53 typedef base::Callback<void(const RemoteFileSyncService::OriginStatusMap&)> | 53 typedef base::Callback<void(const RemoteFileSyncService::OriginStatusMap&)> |
| 54 ExtensionStatusMapCallback; | 54 ExtensionStatusMapCallback; |
| 55 | 55 |
| 56 // KeyedService implementation. | 56 // KeyedService implementation. |
| 57 virtual void Shutdown() OVERRIDE; | 57 virtual void Shutdown() OVERRIDE; |
| 58 | 58 |
| 59 void InitializeForApp( | 59 void InitializeForApp(storage::FileSystemContext* file_system_context, |
| 60 fileapi::FileSystemContext* file_system_context, | 60 const GURL& app_origin, |
| 61 const GURL& app_origin, | 61 const SyncStatusCallback& callback); |
| 62 const SyncStatusCallback& callback); | |
| 63 | 62 |
| 64 void GetExtensionStatusMap(const ExtensionStatusMapCallback& callback); | 63 void GetExtensionStatusMap(const ExtensionStatusMapCallback& callback); |
| 65 void DumpFiles(const GURL& origin, const DumpFilesCallback& callback); | 64 void DumpFiles(const GURL& origin, const DumpFilesCallback& callback); |
| 66 void DumpDatabase(const DumpFilesCallback& callback); | 65 void DumpDatabase(const DumpFilesCallback& callback); |
| 67 | 66 |
| 68 // Returns the file |url|'s sync status. | 67 // Returns the file |url|'s sync status. |
| 69 void GetFileSyncStatus( | 68 void GetFileSyncStatus(const storage::FileSystemURL& url, |
| 70 const fileapi::FileSystemURL& url, | 69 const SyncFileStatusCallback& callback); |
| 71 const SyncFileStatusCallback& callback); | |
| 72 | 70 |
| 73 void AddSyncEventObserver(SyncEventObserver* observer); | 71 void AddSyncEventObserver(SyncEventObserver* observer); |
| 74 void RemoveSyncEventObserver(SyncEventObserver* observer); | 72 void RemoveSyncEventObserver(SyncEventObserver* observer); |
| 75 | 73 |
| 76 LocalChangeProcessor* GetLocalChangeProcessor(const GURL& origin); | 74 LocalChangeProcessor* GetLocalChangeProcessor(const GURL& origin); |
| 77 | 75 |
| 78 // SyncProcessRunner::Client implementations. | 76 // SyncProcessRunner::Client implementations. |
| 79 virtual void OnSyncIdle() OVERRIDE; | 77 virtual void OnSyncIdle() OVERRIDE; |
| 80 virtual SyncServiceState GetSyncServiceState() OVERRIDE; | 78 virtual SyncServiceState GetSyncServiceState() OVERRIDE; |
| 81 virtual SyncFileSystemService* GetSyncService() OVERRIDE; | 79 virtual SyncFileSystemService* GetSyncService() OVERRIDE; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 const extensions::Extension* extension, | 146 const extensions::Extension* extension, |
| 149 extensions::UninstallReason reason) OVERRIDE; | 147 extensions::UninstallReason reason) OVERRIDE; |
| 150 virtual void OnExtensionLoaded( | 148 virtual void OnExtensionLoaded( |
| 151 content::BrowserContext* browser_context, | 149 content::BrowserContext* browser_context, |
| 152 const extensions::Extension* extension) OVERRIDE; | 150 const extensions::Extension* extension) OVERRIDE; |
| 153 | 151 |
| 154 // ProfileSyncServiceObserver implementation. | 152 // ProfileSyncServiceObserver implementation. |
| 155 virtual void OnStateChanged() OVERRIDE; | 153 virtual void OnStateChanged() OVERRIDE; |
| 156 | 154 |
| 157 // SyncFileStatusObserver implementation. | 155 // SyncFileStatusObserver implementation. |
| 158 virtual void OnFileStatusChanged( | 156 virtual void OnFileStatusChanged(const storage::FileSystemURL& url, |
| 159 const fileapi::FileSystemURL& url, | 157 SyncFileStatus sync_status, |
| 160 SyncFileStatus sync_status, | 158 SyncAction action_taken, |
| 161 SyncAction action_taken, | 159 SyncDirection direction) OVERRIDE; |
| 162 SyncDirection direction) OVERRIDE; | |
| 163 | 160 |
| 164 // Check the profile's sync preference settings and call | 161 // Check the profile's sync preference settings and call |
| 165 // remote_file_service_->SetSyncEnabled() to update the status. | 162 // remote_file_service_->SetSyncEnabled() to update the status. |
| 166 // |profile_sync_service| must be non-null. | 163 // |profile_sync_service| must be non-null. |
| 167 void UpdateSyncEnabledStatus(ProfileSyncServiceBase* profile_sync_service); | 164 void UpdateSyncEnabledStatus(ProfileSyncServiceBase* profile_sync_service); |
| 168 | 165 |
| 169 // Runs the SyncProcessRunner method of all sync runners (e.g. for Local sync | 166 // Runs the SyncProcessRunner method of all sync runners (e.g. for Local sync |
| 170 // and Remote sync). | 167 // and Remote sync). |
| 171 void RunForEachSyncRunners(void(SyncProcessRunner::*method)()); | 168 void RunForEachSyncRunners(void(SyncProcessRunner::*method)()); |
| 172 | 169 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 193 | 190 |
| 194 TaskLogger task_logger_; | 191 TaskLogger task_logger_; |
| 195 ObserverList<SyncEventObserver> observers_; | 192 ObserverList<SyncEventObserver> observers_; |
| 196 | 193 |
| 197 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemService); | 194 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemService); |
| 198 }; | 195 }; |
| 199 | 196 |
| 200 } // namespace sync_file_system | 197 } // namespace sync_file_system |
| 201 | 198 |
| 202 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ | 199 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ |
| OLD | NEW |