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_registrar.h" | 41 #include "sync/notifier/sync_notifier_helper.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 // Invalidation clients should follow the pattern below: | 555 // Updates the set of ObjectIds associated with a given |handler|. |
| 556 // Passing an empty ObjectIdSet will unregister |handler|. |
| 557 // There should be at most one handler registered per object id. |
556 // | 558 // |
557 // When starting the client: | 559 // The handler -> registered ids map is persisted across restarts of |
558 // | 560 // sync. |
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); | |
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 already be registered. | |
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 already be registered. An ID must be registered for | |
592 // at most one handler. | |
593 // | |
594 // Registered IDs are persisted across restarts of sync. | |
595 void UpdateRegisteredInvalidationIds(syncer::SyncNotifierObserver* handler, | 561 void UpdateRegisteredInvalidationIds(syncer::SyncNotifierObserver* handler, |
596 const syncer::ObjectIdSet& ids); | 562 const syncer::ObjectIdSet& ids); |
597 | 563 |
598 // Stops sending notifications to |handler|. |handler| must not be NULL, and | |
599 // it must already be registered. Note that this doesn't unregister the IDs | |
600 // associated with |handler|. | |
601 // | |
602 // Handler registrations are persisted across restarts of sync. | |
603 void UnregisterInvalidationHandler(syncer::SyncNotifierObserver* handler); | |
604 | |
605 // ProfileKeyedService implementation. | 564 // ProfileKeyedService implementation. |
606 virtual void Shutdown() OVERRIDE; | 565 virtual void Shutdown() OVERRIDE; |
607 | 566 |
608 protected: | 567 protected: |
609 // Used by test classes that derive from ProfileSyncService. | 568 // Used by test classes that derive from ProfileSyncService. |
610 virtual browser_sync::SyncBackendHost* GetBackendForTest(); | 569 virtual browser_sync::SyncBackendHost* GetBackendForTest(); |
611 | 570 |
612 // Helper to install and configure a data type manager. | 571 // Helper to install and configure a data type manager. |
613 void ConfigureDataTypeManager(); | 572 void ConfigureDataTypeManager(); |
614 | 573 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 // If |true|, there is setup UI visible so we should not start downloading | 828 // If |true|, there is setup UI visible so we should not start downloading |
870 // data types. | 829 // data types. |
871 bool setup_in_progress_; | 830 bool setup_in_progress_; |
872 | 831 |
873 // The set of currently enabled sync experiments. | 832 // The set of currently enabled sync experiments. |
874 syncer::Experiments current_experiments; | 833 syncer::Experiments current_experiments; |
875 | 834 |
876 // Factory the backend will use to build the SyncManager. | 835 // Factory the backend will use to build the SyncManager. |
877 syncer::SyncManagerFactory sync_manager_factory_; | 836 syncer::SyncManagerFactory sync_manager_factory_; |
878 | 837 |
| 838 // The set of all registered IDs. |
| 839 syncer::ObjectIdSet all_registered_ids_; |
| 840 |
879 // Dispatches invalidations to handlers. | 841 // Dispatches invalidations to handlers. |
880 syncer::SyncNotifierRegistrar notifier_registrar_; | 842 syncer::SyncNotifierHelper notifier_helper_; |
881 | 843 |
882 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 844 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
883 }; | 845 }; |
884 | 846 |
885 bool ShouldShowActionOnUI( | 847 bool ShouldShowActionOnUI( |
886 const syncer::SyncProtocolError& error); | 848 const syncer::SyncProtocolError& error); |
887 | 849 |
888 | 850 |
889 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 851 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |