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_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 20 matching lines...) Expand all Loading... | |
31 #include "content/public/browser/notification_observer.h" | 31 #include "content/public/browser/notification_observer.h" |
32 #include "content/public/browser/notification_registrar.h" | 32 #include "content/public/browser/notification_registrar.h" |
33 #include "content/public/browser/notification_types.h" | 33 #include "content/public/browser/notification_types.h" |
34 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
35 #include "sync/internal_api/public/base/model_type.h" | 35 #include "sync/internal_api/public/base/model_type.h" |
36 #include "sync/internal_api/public/engine/model_safe_worker.h" | 36 #include "sync/internal_api/public/engine/model_safe_worker.h" |
37 #include "sync/internal_api/public/sync_manager_factory.h" | 37 #include "sync/internal_api/public/sync_manager_factory.h" |
38 #include "sync/internal_api/public/util/experiments.h" | 38 #include "sync/internal_api/public/util/experiments.h" |
39 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | 39 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
40 #include "sync/js/sync_js_controller.h" | 40 #include "sync/js/sync_js_controller.h" |
41 #include "sync/notifier/sync_notifier_helper.h" | 41 #include "sync/notifier/sync_notifier_registrar.h" |
42 | 42 |
43 class Profile; | 43 class Profile; |
44 class ProfileSyncComponentsFactory; | 44 class ProfileSyncComponentsFactory; |
45 class SigninManager; | 45 class SigninManager; |
46 class SyncGlobalError; | 46 class SyncGlobalError; |
47 | 47 |
48 namespace browser_sync { | 48 namespace browser_sync { |
49 class BackendMigrator; | 49 class BackendMigrator; |
50 class ChangeProcessor; | 50 class ChangeProcessor; |
51 class DataTypeManager; | 51 class DataTypeManager; |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 return configure_status_; | 545 return configure_status_; |
546 } | 546 } |
547 | 547 |
548 // If true, the ProfileSyncService has detected that a new GAIA signin has | 548 // If true, the ProfileSyncService has detected that a new GAIA signin has |
549 // succeeded, and is waiting for initialization to complete. This is used by | 549 // succeeded, and is waiting for initialization to complete. This is used by |
550 // the UI to differentiate between a new auth error (encountered as part of | 550 // the UI to differentiate between a new auth error (encountered as part of |
551 // the initialization process) and a pre-existing auth error that just hasn't | 551 // the initialization process) and a pre-existing auth error that just hasn't |
552 // been cleared yet. Virtual for testing purposes. | 552 // been cleared yet. Virtual for testing purposes. |
553 virtual bool waiting_for_auth() const; | 553 virtual bool waiting_for_auth() const; |
554 | 554 |
555 // Updates the set of ObjectIds associated with a given |handler|. | 555 // Invalidation clients should follow the pattern below: |
msw
2012/08/09 05:20:26
This is AWESOME, thank you!
| |
556 // Passing an empty ObjectIdSet will unregister |handler|. | |
557 // There should be at most one handler registered per object id. | |
558 // | 556 // |
559 // The handler -> registered ids map is persisted across restarts of | 557 // When starting the client: |
560 // sync. | 558 // |
559 // pss->RegisterInvalidationHandler(client_handler); | |
560 // | |
561 // When the set of IDs to register changes for the client during its lifetime | |
562 // (i.e., between calls to RegisterInvalidationHandler(client_handler) and | |
563 // UnregisterInvalidationHandler(client_handler): | |
564 // | |
565 // pss->UpdateRegisteredInvalidationIds(client_handler, client_ids); | |
566 // | |
567 // When shutting down the client for browser shutdown: | |
568 // | |
569 // pss->UnregisterInvalidationHandler(client_handler); | |
570 // | |
571 // Note that there's no call to UpdateRegisteredIds() -- this is because the | |
572 // invalidation API persists registrations across browser restarts. | |
573 // | |
574 // When permanently shutting down the client, e.g. when disabling the related | |
575 // feature: | |
576 // | |
577 // pss->UpdateRegisteredInvalidationIds(client_handler, ObjectIdSet()); | |
578 // pss->UnregisterInvalidationHandler(client_handler) | |
msw
2012/08/09 05:20:26
nit: omg won't compile! needs trailing semicolon!
akalin
2012/08/10 01:28:08
Done.
| |
579 | |
580 // NOTE(akalin): Invalidations that come in during browser shutdown may get | |
581 // dropped. This won't matter once we have an Acknowledge API, though: see | |
582 // http://crbug.com/78462 and http://crbug.com/124149. | |
583 | |
584 // Starts sending notifications to |handler|. |handler| must not be NULL, | |
585 // and it must not already have been added. | |
586 // | |
587 // Handler registrations are persisted across restarts of sync. | |
588 void RegisterInvalidationHandler(syncer::SyncNotifierObserver* handler); | |
589 | |
590 // Updates the set of ObjectIds associated with |handler|. |handler| must | |
591 // not be NULL, and must have already been added. An ID must be registered | |
msw
2012/08/09 05:20:26
nit: s/added/registered/
akalin
2012/08/10 01:28:08
done, also fixed other places
| |
592 // for at most one handler. | |
593 // | |
594 // Registered IDs are persisted across restarts of sync. | |
561 void UpdateRegisteredInvalidationIds(syncer::SyncNotifierObserver* handler, | 595 void UpdateRegisteredInvalidationIds(syncer::SyncNotifierObserver* handler, |
562 const syncer::ObjectIdSet& ids); | 596 const syncer::ObjectIdSet& ids); |
563 | 597 |
598 // Stops sending notifications to |handler|. |handler| must not be NULL, and | |
599 // it must have been previously added. Note that this doesn't unregister the | |
600 // IDs associated with |handler|. | |
601 // | |
602 // Handler registrations are persisted across restarts of sync. | |
603 void UnregisterInvalidationHandler(syncer::SyncNotifierObserver* handler); | |
604 | |
564 // ProfileKeyedService implementation. | 605 // ProfileKeyedService implementation. |
565 virtual void Shutdown() OVERRIDE; | 606 virtual void Shutdown() OVERRIDE; |
566 | 607 |
567 protected: | 608 protected: |
568 // Used by test classes that derive from ProfileSyncService. | 609 // Used by test classes that derive from ProfileSyncService. |
569 virtual browser_sync::SyncBackendHost* GetBackendForTest(); | 610 virtual browser_sync::SyncBackendHost* GetBackendForTest(); |
570 | 611 |
571 // Helper to install and configure a data type manager. | 612 // Helper to install and configure a data type manager. |
572 void ConfigureDataTypeManager(); | 613 void ConfigureDataTypeManager(); |
573 | 614 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 // If |true|, there is setup UI visible so we should not start downloading | 869 // If |true|, there is setup UI visible so we should not start downloading |
829 // data types. | 870 // data types. |
830 bool setup_in_progress_; | 871 bool setup_in_progress_; |
831 | 872 |
832 // The set of currently enabled sync experiments. | 873 // The set of currently enabled sync experiments. |
833 syncer::Experiments current_experiments; | 874 syncer::Experiments current_experiments; |
834 | 875 |
835 // Factory the backend will use to build the SyncManager. | 876 // Factory the backend will use to build the SyncManager. |
836 syncer::SyncManagerFactory sync_manager_factory_; | 877 syncer::SyncManagerFactory sync_manager_factory_; |
837 | 878 |
838 // The set of all registered IDs. | |
839 syncer::ObjectIdSet all_registered_ids_; | |
840 | |
841 // Dispatches invalidations to handlers. | 879 // Dispatches invalidations to handlers. |
842 syncer::SyncNotifierHelper notifier_helper_; | 880 syncer::SyncNotifierRegistrar notifier_registrar_; |
843 | 881 |
844 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 882 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
845 }; | 883 }; |
846 | 884 |
847 bool ShouldShowActionOnUI( | 885 bool ShouldShowActionOnUI( |
848 const syncer::SyncProtocolError& error); | 886 const syncer::SyncProtocolError& error); |
849 | 887 |
850 | 888 |
851 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 889 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |