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

Side by Side Diff: chrome/browser/sync/profile_sync_service.h

Issue 10916131: [Invalidations] Add GetInvalidatorState() to Invalidator{,Frontend} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android Created 8 years, 3 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_PROFILE_SYNC_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 browser_sync::DataTypeController::StateMap* state_map) const; 252 browser_sync::DataTypeController::StateMap* state_map) const;
253 253
254 // Disables sync for user. Use ShowLoginDialog to enable. 254 // Disables sync for user. Use ShowLoginDialog to enable.
255 virtual void DisableForUser(); 255 virtual void DisableForUser();
256 256
257 // Whether sync is enabled by user or not. 257 // Whether sync is enabled by user or not.
258 virtual bool HasSyncSetupCompleted() const; 258 virtual bool HasSyncSetupCompleted() const;
259 virtual void SetSyncSetupCompleted(); 259 virtual void SetSyncSetupCompleted();
260 260
261 // syncer::InvalidationHandler implementation (via SyncFrontend). 261 // syncer::InvalidationHandler implementation (via SyncFrontend).
262 virtual void OnNotificationsEnabled() OVERRIDE; 262 virtual void OnInvalidatorStateChange(
263 virtual void OnNotificationsDisabled( 263 syncer::InvalidatorState state) OVERRIDE;
264 syncer::NotificationsDisabledReason reason) OVERRIDE; 264 virtual void OnIncomingInvalidation(
265 virtual void OnIncomingNotification(
266 const syncer::ObjectIdStateMap& id_state_map, 265 const syncer::ObjectIdStateMap& id_state_map,
267 syncer::IncomingNotificationSource source) OVERRIDE; 266 syncer::IncomingInvalidationSource source) OVERRIDE;
268 267
269 // SyncFrontend implementation. 268 // SyncFrontend implementation.
270 virtual void OnBackendInitialized( 269 virtual void OnBackendInitialized(
271 const syncer::WeakHandle<syncer::JsBackend>& js_backend, 270 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
272 bool success) OVERRIDE; 271 bool success) OVERRIDE;
273 virtual void OnSyncCycleCompleted() OVERRIDE; 272 virtual void OnSyncCycleCompleted() OVERRIDE;
274 virtual void OnSyncConfigureRetry() OVERRIDE; 273 virtual void OnSyncConfigureRetry() OVERRIDE;
275 virtual void OnConnectionStatusChange( 274 virtual void OnConnectionStatusChange(
276 syncer::ConnectionStatus status) OVERRIDE; 275 syncer::ConnectionStatus status) OVERRIDE;
277 virtual void OnStopSyncingPermanently() OVERRIDE; 276 virtual void OnStopSyncingPermanently() OVERRIDE;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 return configure_status_; 555 return configure_status_;
557 } 556 }
558 557
559 // If true, the ProfileSyncService has detected that a new GAIA signin has 558 // If true, the ProfileSyncService has detected that a new GAIA signin has
560 // succeeded, and is waiting for initialization to complete. This is used by 559 // succeeded, and is waiting for initialization to complete. This is used by
561 // the UI to differentiate between a new auth error (encountered as part of 560 // the UI to differentiate between a new auth error (encountered as part of
562 // the initialization process) and a pre-existing auth error that just hasn't 561 // the initialization process) and a pre-existing auth error that just hasn't
563 // been cleared yet. Virtual for testing purposes. 562 // been cleared yet. Virtual for testing purposes.
564 virtual bool waiting_for_auth() const; 563 virtual bool waiting_for_auth() const;
565 564
566 // Invalidation clients should follow the pattern below: 565 // InvalidationFrontend implementation.
567 //
568 // When starting the client:
569 //
570 // pss->RegisterInvalidationHandler(client_handler);
571 //
572 // When the set of IDs to register changes for the client during its lifetime
573 // (i.e., between calls to RegisterInvalidationHandler(client_handler) and
574 // UnregisterInvalidationHandler(client_handler):
575 //
576 // pss->UpdateRegisteredInvalidationIds(client_handler, client_ids);
577 //
578 // When shutting down the client for browser shutdown:
579 //
580 // pss->UnregisterInvalidationHandler(client_handler);
581 //
582 // Note that there's no call to UpdateRegisteredIds() -- this is because the
583 // invalidation API persists registrations across browser restarts.
584 //
585 // When permanently shutting down the client, e.g. when disabling the related
586 // feature:
587 //
588 // pss->UpdateRegisteredInvalidationIds(client_handler, ObjectIdSet());
589 // pss->UnregisterInvalidationHandler(client_handler);
590
591 // NOTE(akalin): Invalidations that come in during browser shutdown may get
592 // dropped. This won't matter once we have an Acknowledge API, though: see
593 // http://crbug.com/78462 and http://crbug.com/124149.
594
595 // Starts sending notifications to |handler|. |handler| must not be NULL,
596 // and it must already be registered.
597 //
598 // Handler registrations are persisted across restarts of sync.
599 virtual void RegisterInvalidationHandler( 566 virtual void RegisterInvalidationHandler(
600 syncer::InvalidationHandler* handler) OVERRIDE; 567 syncer::InvalidationHandler* handler) OVERRIDE;
601
602 // Updates the set of ObjectIds associated with |handler|. |handler| must
603 // not be NULL, and must already be registered. An ID must be registered for
604 // at most one handler.
605 //
606 // Registered IDs are persisted across restarts of sync.
607 virtual void UpdateRegisteredInvalidationIds( 568 virtual void UpdateRegisteredInvalidationIds(
608 syncer::InvalidationHandler* handler, 569 syncer::InvalidationHandler* handler,
609 const syncer::ObjectIdSet& ids) OVERRIDE; 570 const syncer::ObjectIdSet& ids) OVERRIDE;
610
611 // Stops sending notifications to |handler|. |handler| must not be NULL, and
612 // it must already be registered. Note that this doesn't unregister the IDs
613 // associated with |handler|.
614 //
615 // Handler registrations are persisted across restarts of sync.
616 virtual void UnregisterInvalidationHandler( 571 virtual void UnregisterInvalidationHandler(
617 syncer::InvalidationHandler* handler) OVERRIDE; 572 syncer::InvalidationHandler* handler) OVERRIDE;
573 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
618 574
619 // ProfileKeyedService implementation. 575 // ProfileKeyedService implementation.
620 virtual void Shutdown() OVERRIDE; 576 virtual void Shutdown() OVERRIDE;
621 577
622 protected: 578 protected:
623 // Used by test classes that derive from ProfileSyncService. 579 // Used by test classes that derive from ProfileSyncService.
624 virtual browser_sync::SyncBackendHost* GetBackendForTest(); 580 virtual browser_sync::SyncBackendHost* GetBackendForTest();
625 581
626 // Helper to install and configure a data type manager. 582 // Helper to install and configure a data type manager.
627 void ConfigureDataTypeManager(); 583 void ConfigureDataTypeManager();
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 syncer::InvalidatorRegistrar invalidator_registrar_; 850 syncer::InvalidatorRegistrar invalidator_registrar_;
895 851
896 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 852 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
897 }; 853 };
898 854
899 bool ShouldShowActionOnUI( 855 bool ShouldShowActionOnUI(
900 const syncer::SyncProtocolError& error); 856 const syncer::SyncProtocolError& error);
901 857
902 858
903 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 859 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/invalidation_frontend.h ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698