| 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/google_apis/drive_service_interface.h" |
| 20 #include "chrome/browser/sync_file_system/drive_file_sync_client.h" |
| 20 #include "chrome/browser/sync_file_system/local_change_processor.h" | 21 #include "chrome/browser/sync_file_system/local_change_processor.h" |
| 21 #include "chrome/browser/sync_file_system/remote_file_sync_service.h" | 22 #include "chrome/browser/sync_file_system/remote_file_sync_service.h" |
| 22 #include "webkit/fileapi/syncable/file_change.h" | 23 #include "webkit/fileapi/syncable/file_change.h" |
| 23 #include "webkit/fileapi/syncable/sync_callbacks.h" | 24 #include "webkit/fileapi/syncable/sync_callbacks.h" |
| 24 | 25 |
| 25 namespace google_apis { | 26 namespace google_apis { |
| 26 class DocumentFeed; | 27 class DocumentFeed; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace tracked_objects { | 30 namespace tracked_objects { |
| 30 class Location; | 31 class Location; |
| 31 } | 32 } |
| 32 | 33 |
| 33 namespace sync_file_system { | 34 namespace sync_file_system { |
| 34 | 35 |
| 35 class DriveFileSyncClient; | |
| 36 class DriveMetadataStore; | 36 class DriveMetadataStore; |
| 37 | 37 |
| 38 // Maintains remote file changes. | 38 // Maintains remote file changes. |
| 39 // Owned by SyncFileSystemService (which is a per-profile object). | 39 // Owned by SyncFileSystemService (which is a per-profile object). |
| 40 class DriveFileSyncService | 40 class DriveFileSyncService |
| 41 : public RemoteFileSyncService, | 41 : public RemoteFileSyncService, |
| 42 public LocalChangeProcessor, | 42 public LocalChangeProcessor, |
| 43 public DriveFileSyncClientObserver, |
| 43 public base::NonThreadSafe { | 44 public base::NonThreadSafe { |
| 44 public: | 45 public: |
| 45 static const char kServiceName[]; | 46 static const char kServiceName[]; |
| 46 | 47 |
| 47 explicit DriveFileSyncService(Profile* profile); | 48 explicit DriveFileSyncService(Profile* profile); |
| 48 virtual ~DriveFileSyncService(); | 49 virtual ~DriveFileSyncService(); |
| 49 | 50 |
| 50 // Creates DriveFileSyncClient instance for testing. | 51 // Creates DriveFileSyncClient instance for testing. |
| 51 // |metadata_store| must be initialized beforehand. | 52 // |metadata_store| must be initialized beforehand. |
| 52 static scoped_ptr<DriveFileSyncService> CreateForTesting( | 53 static scoped_ptr<DriveFileSyncService> CreateForTesting( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 75 virtual RemoteServiceState GetCurrentState() const OVERRIDE; | 76 virtual RemoteServiceState GetCurrentState() const OVERRIDE; |
| 76 | 77 |
| 77 // LocalChangeProcessor overrides. | 78 // LocalChangeProcessor overrides. |
| 78 virtual void ApplyLocalChange( | 79 virtual void ApplyLocalChange( |
| 79 const fileapi::FileChange& change, | 80 const fileapi::FileChange& change, |
| 80 const FilePath& local_file_path, | 81 const FilePath& local_file_path, |
| 81 const fileapi::SyncFileMetadata& local_file_metadata, | 82 const fileapi::SyncFileMetadata& local_file_metadata, |
| 82 const fileapi::FileSystemURL& url, | 83 const fileapi::FileSystemURL& url, |
| 83 const fileapi::SyncStatusCallback& callback) OVERRIDE; | 84 const fileapi::SyncStatusCallback& callback) OVERRIDE; |
| 84 | 85 |
| 86 // DriveFileSyncClientObserver overrides. |
| 87 virtual void OnAuthenticated() OVERRIDE; |
| 88 |
| 85 private: | 89 private: |
| 86 friend class DriveFileSyncServiceTest; | 90 friend class DriveFileSyncServiceTest; |
| 87 class TaskToken; | 91 class TaskToken; |
| 88 | 92 |
| 89 struct ChangeQueueItem { | 93 struct ChangeQueueItem { |
| 90 int64 changestamp; | 94 int64 changestamp; |
| 91 fileapi::FileSystemURL url; | 95 fileapi::FileSystemURL url; |
| 92 | 96 |
| 93 ChangeQueueItem(); | 97 ChangeQueueItem(); |
| 94 ChangeQueueItem(int64 changestamp, const fileapi::FileSystemURL& url); | 98 ChangeQueueItem(int64 changestamp, const fileapi::FileSystemURL& url); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer | 256 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer |
| 253 // in |token_|. | 257 // in |token_|. |
| 254 base::WeakPtrFactory<DriveFileSyncService> weak_factory_; | 258 base::WeakPtrFactory<DriveFileSyncService> weak_factory_; |
| 255 | 259 |
| 256 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); | 260 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); |
| 257 }; | 261 }; |
| 258 | 262 |
| 259 } // namespace sync_file_system | 263 } // namespace sync_file_system |
| 260 | 264 |
| 261 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ | 265 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ |
| OLD | NEW |