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

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

Issue 13891016: Merge ChromeOS and SyncFS XMPP Notification into one class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unused includes 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 | 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 "base/timer.h"
20 #include "chrome/browser/google_apis/drive_notification_observer.h" 19 #include "chrome/browser/google_apis/drive_notification_observer.h"
21 #include "chrome/browser/sync_file_system/drive_file_sync_client_interface.h" 20 #include "chrome/browser/sync_file_system/drive_file_sync_client_interface.h"
22 #include "chrome/browser/sync_file_system/drive_metadata_store.h" 21 #include "chrome/browser/sync_file_system/drive_metadata_store.h"
23 #include "chrome/browser/sync_file_system/local_change_processor.h" 22 #include "chrome/browser/sync_file_system/local_change_processor.h"
24 #include "chrome/browser/sync_file_system/remote_file_sync_service.h" 23 #include "chrome/browser/sync_file_system/remote_file_sync_service.h"
25 #include "webkit/fileapi/syncable/file_change.h" 24 #include "webkit/fileapi/syncable/file_change.h"
26 #include "webkit/fileapi/syncable/sync_action.h" 25 #include "webkit/fileapi/syncable/sync_action.h"
27 #include "webkit/fileapi/syncable/sync_callbacks.h" 26 #include "webkit/fileapi/syncable/sync_callbacks.h"
28 #include "webkit/fileapi/syncable/sync_direction.h" 27 #include "webkit/fileapi/syncable/sync_direction.h"
29 #include "webkit/fileapi/syncable/sync_status_code.h" 28 #include "webkit/fileapi/syncable/sync_status_code.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 // These two methods are called only from this method. 420 // These two methods are called only from this method.
422 void MaybeStartFetchChanges(); 421 void MaybeStartFetchChanges();
423 422
424 void FetchChangesForIncrementalSync(); 423 void FetchChangesForIncrementalSync();
425 void DidFetchChangesForIncrementalSync( 424 void DidFetchChangesForIncrementalSync(
426 scoped_ptr<TaskToken> token, 425 scoped_ptr<TaskToken> token,
427 bool has_new_changes, 426 bool has_new_changes,
428 google_apis::GDataErrorCode error, 427 google_apis::GDataErrorCode error,
429 scoped_ptr<google_apis::ResourceList> changes); 428 scoped_ptr<google_apis::ResourceList> changes);
430 bool GetOriginForEntry(const google_apis::ResourceEntry& entry, GURL* origin); 429 bool GetOriginForEntry(const google_apis::ResourceEntry& entry, GURL* origin);
431 void SchedulePolling();
432 void OnPollingTimerFired();
433 void UpdatePollingDelay(int64 new_delay_sec);
434 void NotifyObserversFileStatusChanged(const fileapi::FileSystemURL& url, 430 void NotifyObserversFileStatusChanged(const fileapi::FileSystemURL& url,
435 SyncFileStatus sync_status, 431 SyncFileStatus sync_status,
436 SyncAction action_taken, 432 SyncAction action_taken,
437 SyncDirection direction); 433 SyncDirection direction);
438 434
439 void HandleSyncRootDirectoryChange(const google_apis::ResourceEntry& entry); 435 void HandleSyncRootDirectoryChange(const google_apis::ResourceEntry& entry);
440 void HandleOriginRootDirectoryChange(const google_apis::ResourceEntry& entry); 436 void HandleOriginRootDirectoryChange(const google_apis::ResourceEntry& entry);
441 437
442 void EnsureSyncRootDirectory(const ResourceIdCallback& callback); 438 void EnsureSyncRootDirectory(const ResourceIdCallback& callback);
443 void DidEnsureSyncRoot(const ResourceIdCallback& callback, 439 void DidEnsureSyncRoot(const ResourceIdCallback& callback,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 481
486 std::set<GURL> pending_batch_sync_origins_; 482 std::set<GURL> pending_batch_sync_origins_;
487 483
488 // Absence of |token_| implies a task is running. Incoming tasks should 484 // Absence of |token_| implies a task is running. Incoming tasks should
489 // wait for the task to finish in |pending_tasks_| if |token_| is null. 485 // wait for the task to finish in |pending_tasks_| if |token_| is null.
490 // Each task must take TaskToken instance from |token_| and must hold it 486 // Each task must take TaskToken instance from |token_| and must hold it
491 // until it finished. And the task must return the instance through 487 // until it finished. And the task must return the instance through
492 // NotifyTaskDone when the task finished. 488 // NotifyTaskDone when the task finished.
493 scoped_ptr<TaskToken> token_; 489 scoped_ptr<TaskToken> token_;
494 490
495 // Timer to trigger fetching changes for incremental sync.
496 base::OneShotTimer<DriveFileSyncService> polling_timer_;
497 // If polling_delay_seconds_ is negative (<0) the timer won't start.
498 int64 polling_delay_seconds_;
499
500 // Is set to true when there's a fair possibility that we have some 491 // Is set to true when there's a fair possibility that we have some
501 // remote changes that haven't been fetched yet. 492 // remote changes that haven't been fetched yet.
502 // 493 //
503 // This flag is set when: 494 // This flag is set when:
504 // - This gets invalidation notification, 495 // - This gets invalidation notification,
505 // - The service is authenticated or becomes online, and 496 // - The service is authenticated or becomes online, and
506 // - The polling timer is fired. 497 // - The polling timer is fired.
507 // 498 //
508 // This flag is cleared when: 499 // This flag is cleared when:
509 // - A batch or incremental sync has been started, and 500 // - A batch or incremental sync has been started, and
(...skipping 10 matching lines...) Expand all
520 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer 511 // Use WeakPtrFactory instead of SupportsWeakPtr to revoke the weak pointer
521 // in |token_|. 512 // in |token_|.
522 base::WeakPtrFactory<DriveFileSyncService> weak_factory_; 513 base::WeakPtrFactory<DriveFileSyncService> weak_factory_;
523 514
524 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService); 515 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncService);
525 }; 516 };
526 517
527 } // namespace sync_file_system 518 } // namespace sync_file_system
528 519
529 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_ 520 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698