| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 const extensions::Extension* extension, | 144 const extensions::Extension* extension, |
| 147 extensions::UninstallReason reason) OVERRIDE; | 145 extensions::UninstallReason reason) OVERRIDE; |
| 148 virtual void OnExtensionLoaded( | 146 virtual void OnExtensionLoaded( |
| 149 content::BrowserContext* browser_context, | 147 content::BrowserContext* browser_context, |
| 150 const extensions::Extension* extension) OVERRIDE; | 148 const extensions::Extension* extension) OVERRIDE; |
| 151 | 149 |
| 152 // ProfileSyncServiceObserver implementation. | 150 // ProfileSyncServiceObserver implementation. |
| 153 virtual void OnStateChanged() OVERRIDE; | 151 virtual void OnStateChanged() OVERRIDE; |
| 154 | 152 |
| 155 // SyncFileStatusObserver implementation. | 153 // SyncFileStatusObserver implementation. |
| 156 virtual void OnFileStatusChanged( | 154 virtual void OnFileStatusChanged(const storage::FileSystemURL& url, |
| 157 const fileapi::FileSystemURL& url, | 155 SyncFileStatus sync_status, |
| 158 SyncFileStatus sync_status, | 156 SyncAction action_taken, |
| 159 SyncAction action_taken, | 157 SyncDirection direction) OVERRIDE; |
| 160 SyncDirection direction) OVERRIDE; | |
| 161 | 158 |
| 162 // Check the profile's sync preference settings and call | 159 // Check the profile's sync preference settings and call |
| 163 // remote_file_service_->SetSyncEnabled() to update the status. | 160 // remote_file_service_->SetSyncEnabled() to update the status. |
| 164 // |profile_sync_service| must be non-null. | 161 // |profile_sync_service| must be non-null. |
| 165 void UpdateSyncEnabledStatus(ProfileSyncServiceBase* profile_sync_service); | 162 void UpdateSyncEnabledStatus(ProfileSyncServiceBase* profile_sync_service); |
| 166 | 163 |
| 167 // Runs the SyncProcessRunner method of all sync runners (e.g. for Local sync | 164 // Runs the SyncProcessRunner method of all sync runners (e.g. for Local sync |
| 168 // and Remote sync). | 165 // and Remote sync). |
| 169 void RunForEachSyncRunners(void(SyncProcessRunner::*method)()); | 166 void RunForEachSyncRunners(void(SyncProcessRunner::*method)()); |
| 170 | 167 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 189 | 186 |
| 190 bool promoting_demoted_changes_; | 187 bool promoting_demoted_changes_; |
| 191 base::Closure idle_callback_; | 188 base::Closure idle_callback_; |
| 192 | 189 |
| 193 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemService); | 190 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemService); |
| 194 }; | 191 }; |
| 195 | 192 |
| 196 } // namespace sync_file_system | 193 } // namespace sync_file_system |
| 197 | 194 |
| 198 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ | 195 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ |
| OLD | NEW |