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