| 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_DRIVE_FILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
| 19 #include "chrome/browser/google_apis/drive_service_interface.h" | 19 #include "chrome/browser/sync_file_system/drive_file_sync_client.h" |
| 20 #include "chrome/browser/google_apis/gdata_wapi_parser.h" | |
| 21 #include "chrome/browser/sync_file_system/local_change_processor.h" | 20 #include "chrome/browser/sync_file_system/local_change_processor.h" |
| 22 #include "chrome/browser/sync_file_system/remote_file_sync_service.h" | 21 #include "chrome/browser/sync_file_system/remote_file_sync_service.h" |
| 23 #include "webkit/fileapi/syncable/file_change.h" | 22 #include "webkit/fileapi/syncable/file_change.h" |
| 24 #include "webkit/fileapi/syncable/sync_callbacks.h" | 23 #include "webkit/fileapi/syncable/sync_callbacks.h" |
| 25 #include "webkit/fileapi/syncable/sync_operation_type.h" | 24 #include "webkit/fileapi/syncable/sync_operation_type.h" |
| 26 | 25 |
| 27 namespace google_apis { | 26 namespace google_apis { |
| 28 class DocumentFeed; | 27 class DocumentFeed; |
| 29 } | 28 } |
| 30 | 29 |
| 31 namespace tracked_objects { | 30 namespace tracked_objects { |
| 32 class Location; | 31 class Location; |
| 33 } | 32 } |
| 34 | 33 |
| 35 namespace sync_file_system { | 34 namespace sync_file_system { |
| 36 | 35 |
| 37 class DriveFileSyncClient; | |
| 38 class DriveMetadataStore; | 36 class DriveMetadataStore; |
| 39 | 37 |
| 40 // Maintains remote file changes. | 38 // Maintains remote file changes. |
| 41 // Owned by SyncFileSystemService (which is a per-profile object). | 39 // Owned by SyncFileSystemService (which is a per-profile object). |
| 42 class DriveFileSyncService | 40 class DriveFileSyncService |
| 43 : public RemoteFileSyncService, | 41 : public RemoteFileSyncService, |
| 44 public LocalChangeProcessor, | 42 public LocalChangeProcessor, |
| 43 public DriveFileSyncClientObserver, |
| 45 public base::NonThreadSafe { | 44 public base::NonThreadSafe { |
| 46 public: | 45 public: |
| 47 static const char kServiceName[]; | 46 static const char kServiceName[]; |
| 48 | 47 |
| 49 explicit DriveFileSyncService(Profile* profile); | 48 explicit DriveFileSyncService(Profile* profile); |
| 50 virtual ~DriveFileSyncService(); | 49 virtual ~DriveFileSyncService(); |
| 51 | 50 |
| 52 // Creates DriveFileSyncClient instance for testing. | 51 // Creates DriveFileSyncClient instance for testing. |
| 53 // |metadata_store| must be initialized beforehand. | 52 // |metadata_store| must be initialized beforehand. |
| 54 static scoped_ptr<DriveFileSyncService> CreateForTesting( | 53 static scoped_ptr<DriveFileSyncService> CreateForTesting( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 79 virtual RemoteServiceState GetCurrentState() const OVERRIDE; | 78 virtual RemoteServiceState GetCurrentState() const OVERRIDE; |
| 80 | 79 |
| 81 // LocalChangeProcessor overrides. | 80 // LocalChangeProcessor overrides. |
| 82 virtual void ApplyLocalChange( | 81 virtual void ApplyLocalChange( |
| 83 const fileapi::FileChange& change, | 82 const fileapi::FileChange& change, |
| 84 const FilePath& local_file_path, | 83 const FilePath& local_file_path, |
| 85 const fileapi::SyncFileMetadata& local_file_metadata, | 84 const fileapi::SyncFileMetadata& local_file_metadata, |
| 86 const fileapi::FileSystemURL& url, | 85 const fileapi::FileSystemURL& url, |
| 87 const fileapi::SyncStatusCallback& callback) OVERRIDE; | 86 const fileapi::SyncStatusCallback& callback) OVERRIDE; |
| 88 | 87 |
| 88 // DriveFileSyncClientObserver overrides. |
| 89 virtual void OnAuthenticated() OVERRIDE; |
| 90 |
| 89 private: | 91 private: |
| 90 friend class DriveFileSyncServiceTest; | 92 friend class DriveFileSyncServiceTest; |
| 91 class TaskToken; | 93 class TaskToken; |
| 92 struct ProcessRemoteChangeParam; | 94 struct ProcessRemoteChangeParam; |
| 93 | 95 |
| 94 enum RemoteSyncType { | 96 enum RemoteSyncType { |
| 95 // Smaller number indicates higher priority in ChangeQueue. | 97 // Smaller number indicates higher priority in ChangeQueue. |
| 96 REMOTE_SYNC_TYPE_INCREMENTAL = 0, | 98 REMOTE_SYNC_TYPE_INCREMENTAL = 0, |
| 97 REMOTE_SYNC_TYPE_BATCH = 1, | 99 REMOTE_SYNC_TYPE_BATCH = 1, |
| 98 }; | 100 }; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer | 322 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer |
| 321 // in |token_|. | 323 // in |token_|. |
| 322 base::WeakPtrFactory<DriveFileSyncService> weak_factory_; | 324 base::WeakPtrFactory<DriveFileSyncService> weak_factory_; |
| 323 | 325 |
| 324 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); | 326 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); |
| 325 }; | 327 }; |
| 326 | 328 |
| 327 } // namespace sync_file_system | 329 } // namespace sync_file_system |
| 328 | 330 |
| 329 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ | 331 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ |
| OLD | NEW |