Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: chrome/browser/sync_file_system/drive_file_sync_service.h

Issue 13940004: Added new DriveNotificationObserver interface which all observers of Google Drive invalidations sho… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tfarina review #1 Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/timer.h" 19 #include "base/timer.h"
20 #include "chrome/browser/google_apis/drive_notification_observer.h"
20 #include "chrome/browser/sync_file_system/drive_file_sync_client_interface.h" 21 #include "chrome/browser/sync_file_system/drive_file_sync_client_interface.h"
21 #include "chrome/browser/sync_file_system/drive_metadata_store.h" 22 #include "chrome/browser/sync_file_system/drive_metadata_store.h"
22 #include "chrome/browser/sync_file_system/local_change_processor.h" 23 #include "chrome/browser/sync_file_system/local_change_processor.h"
23 #include "chrome/browser/sync_file_system/remote_file_sync_service.h" 24 #include "chrome/browser/sync_file_system/remote_file_sync_service.h"
24 #include "sync/notifier/invalidation_handler.h" 25 #include "sync/notifier/invalidation_handler.h"
25 #include "webkit/fileapi/syncable/file_change.h" 26 #include "webkit/fileapi/syncable/file_change.h"
26 #include "webkit/fileapi/syncable/sync_action.h" 27 #include "webkit/fileapi/syncable/sync_action.h"
27 #include "webkit/fileapi/syncable/sync_callbacks.h" 28 #include "webkit/fileapi/syncable/sync_callbacks.h"
28 #include "webkit/fileapi/syncable/sync_direction.h" 29 #include "webkit/fileapi/syncable/sync_direction.h"
29 #include "webkit/fileapi/syncable/sync_status_code.h" 30 #include "webkit/fileapi/syncable/sync_status_code.h"
(...skipping 10 matching lines...) Expand all
40 41
41 namespace sync_file_system { 42 namespace sync_file_system {
42 43
43 // Maintains remote file changes. 44 // Maintains remote file changes.
44 // Owned by SyncFileSystemService (which is a per-profile object). 45 // Owned by SyncFileSystemService (which is a per-profile object).
45 class DriveFileSyncService 46 class DriveFileSyncService
46 : public RemoteFileSyncService, 47 : public RemoteFileSyncService,
47 public LocalChangeProcessor, 48 public LocalChangeProcessor,
48 public DriveFileSyncClientObserver, 49 public DriveFileSyncClientObserver,
49 public base::NonThreadSafe, 50 public base::NonThreadSafe,
50 public syncer::InvalidationHandler { 51 public syncer::InvalidationHandler,
52 public google_apis::DriveNotificationObserver {
51 public: 53 public:
52 static const char kServiceName[]; 54 static const char kServiceName[];
53 static ConflictResolutionPolicy kDefaultPolicy; 55 static ConflictResolutionPolicy kDefaultPolicy;
54 56
55 explicit DriveFileSyncService(Profile* profile); 57 explicit DriveFileSyncService(Profile* profile);
56 virtual ~DriveFileSyncService(); 58 virtual ~DriveFileSyncService();
57 59
58 // Creates DriveFileSyncClient instance for testing. 60 // Creates DriveFileSyncClient instance for testing.
59 // |metadata_store| must be initialized beforehand. 61 // |metadata_store| must be initialized beforehand.
60 static scoped_ptr<DriveFileSyncService> CreateForTesting( 62 static scoped_ptr<DriveFileSyncService> CreateForTesting(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // DriveFileSyncClientObserver overrides. 115 // DriveFileSyncClientObserver overrides.
114 virtual void OnAuthenticated() OVERRIDE; 116 virtual void OnAuthenticated() OVERRIDE;
115 virtual void OnNetworkConnected() OVERRIDE; 117 virtual void OnNetworkConnected() OVERRIDE;
116 118
117 // syncer::InvalidationHandler implementation. 119 // syncer::InvalidationHandler implementation.
118 virtual void OnInvalidatorStateChange( 120 virtual void OnInvalidatorStateChange(
119 syncer::InvalidatorState state) OVERRIDE; 121 syncer::InvalidatorState state) OVERRIDE;
120 virtual void OnIncomingInvalidation( 122 virtual void OnIncomingInvalidation(
121 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE; 123 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE;
122 124
125 // google_apis::DriveNotificationObserver implementation.
126 virtual void CheckForUpdates() OVERRIDE;
127
123 private: 128 private:
124 friend class DriveFileSyncServiceMockTest; 129 friend class DriveFileSyncServiceMockTest;
125 friend class DriveFileSyncServiceSyncTest; 130 friend class DriveFileSyncServiceSyncTest;
126 class TaskToken; 131 class TaskToken;
127 struct ApplyLocalChangeParam; 132 struct ApplyLocalChangeParam;
128 struct ProcessRemoteChangeParam; 133 struct ProcessRemoteChangeParam;
129 134
130 enum RemoteSyncType { 135 enum RemoteSyncType {
131 // Smaller number indicates higher priority in ChangeQueue. 136 // Smaller number indicates higher priority in ChangeQueue.
132 REMOTE_SYNC_TYPE_FETCH = 0, 137 REMOTE_SYNC_TYPE_FETCH = 0,
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer 534 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer
530 // in |token_|. 535 // in |token_|.
531 base::WeakPtrFactory<DriveFileSyncService> weak_factory_; 536 base::WeakPtrFactory<DriveFileSyncService> weak_factory_;
532 537
533 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); 538 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService);
534 }; 539 };
535 540
536 } // namespace sync_file_system 541 } // namespace sync_file_system
537 542
538 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ 543 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/drive_notification_observer.h ('k') | chrome/browser/sync_file_system/drive_file_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698