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

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

Issue 11414253: DriveFileSyncService listens to OnAuthenticated event to recover from unavailable state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years 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 | Annotate | Revision Log
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 "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 23 matching lines...) Expand all
78 virtual RemoteServiceState GetCurrentState() const OVERRIDE; 77 virtual RemoteServiceState GetCurrentState() const OVERRIDE;
79 78
80 // LocalChangeProcessor overrides. 79 // LocalChangeProcessor overrides.
81 virtual void ApplyLocalChange( 80 virtual void ApplyLocalChange(
82 const fileapi::FileChange& change, 81 const fileapi::FileChange& change,
83 const FilePath& local_file_path, 82 const FilePath& local_file_path,
84 const fileapi::SyncFileMetadata& local_file_metadata, 83 const fileapi::SyncFileMetadata& local_file_metadata,
85 const fileapi::FileSystemURL& url, 84 const fileapi::FileSystemURL& url,
86 const fileapi::SyncStatusCallback& callback) OVERRIDE; 85 const fileapi::SyncStatusCallback& callback) OVERRIDE;
87 86
87 // DriveFileSyncClientObserver overrides.
88 virtual void OnAuthenticated() OVERRIDE;
89
88 private: 90 private:
89 friend class DriveFileSyncServiceTest; 91 friend class DriveFileSyncServiceTest;
90 class TaskToken; 92 class TaskToken;
91 struct ProcessRemoteChangeParam; 93 struct ProcessRemoteChangeParam;
92 94
93 enum RemoteSyncType { 95 enum RemoteSyncType {
94 // Smaller number indicates higher priority in ChangeQueue. 96 // Smaller number indicates higher priority in ChangeQueue.
95 REMOTE_SYNC_TYPE_INCREMENTAL = 0, 97 REMOTE_SYNC_TYPE_INCREMENTAL = 0,
96 REMOTE_SYNC_TYPE_BATCH = 1, 98 REMOTE_SYNC_TYPE_BATCH = 1,
97 }; 99 };
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer 316 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer
315 // in |token_|. 317 // in |token_|.
316 base::WeakPtrFactory<DriveFileSyncService> weak_factory_; 318 base::WeakPtrFactory<DriveFileSyncService> weak_factory_;
317 319
318 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); 320 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService);
319 }; 321 };
320 322
321 } // namespace sync_file_system 323 } // namespace sync_file_system
322 324
323 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ 325 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698