Index: chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h |
diff --git a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider.h b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h |
similarity index 54% |
copy from chrome/browser/chromeos/policy/affiliated_invalidation_service_provider.h |
copy to chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h |
index 5484355075d90fec28d864fb6c8059c61ec4f4da..1ab8216b85d8d179736175de16be4fc863167dc1 100644 |
--- a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider.h |
+++ b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h |
@@ -2,13 +2,14 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATED_INVALIDATION_SERVICE_PROVIDER_H_ |
-#define CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATED_INVALIDATION_SERVICE_PROVIDER_H_ |
+#ifndef CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATED_INVALIDATION_SERVICE_PROVIDER_IMPL_H_ |
+#define CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATED_INVALIDATION_SERVICE_PROVIDER_IMPL_H_ |
#include "base/macros.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/scoped_vector.h" |
#include "base/observer_list.h" |
+#include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provider.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
@@ -19,65 +20,22 @@ class TiclInvalidationService; |
namespace policy { |
-// This class provides access to an |InvalidationService| that can be used to |
-// subscribe to invalidations generated by the device's enrollment domain, e.g. |
-// policy pushing and remote commands for: |
-// * the device itself |
-// * device-local accounts |
-// * other users affiliated with the enrollment domain |
-// |
-// If an affiliated user with a connected invalidation service is logged in, |
-// that invalidation service will be used to conserve server resources. If there |
-// are no logged-in users matching these criteria, a device-global |
-// |TiclInvalidationService| is spun up. |
-// The class monitors the status of the invalidation services and switches |
-// between them whenever the service currently in use disconnects or the |
-// device-global invalidation service can be replaced with another service that |
-// just connected. |
-class AffiliatedInvalidationServiceProvider |
- : public content::NotificationObserver { |
+class AffiliatedInvalidationServiceProviderImpl |
+ : public AffiliatedInvalidationServiceProvider, |
+ public content::NotificationObserver { |
public: |
- class Consumer { |
- public: |
- // This method is called when the invalidation service that the consumer |
- // should use changes: |
- // * If |invalidation_service| is a nullptr, no invalidation service is |
- // currently available for use. |
- // * Otherwise, |invalidation_service| is the invalidation service that the |
- // consumer should use. It is guaranteed to be connected. Any previously |
- // provided invalidation services must no longer be used. |
- virtual void OnInvalidationServiceSet( |
- invalidation::InvalidationService* invalidation_service) = 0; |
- |
- protected: |
- virtual ~Consumer(); |
- }; |
- |
- AffiliatedInvalidationServiceProvider(); |
- ~AffiliatedInvalidationServiceProvider() override; |
+ AffiliatedInvalidationServiceProviderImpl(); |
+ ~AffiliatedInvalidationServiceProviderImpl() override; |
// content::NotificationObserver: |
void Observe(int type, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) override; |
- // Indicates that |consumer| is interested in using the shared |
- // |InvalidationService|. The consumer's OnInvalidationServiceSet() method |
- // will be called back when a connected invalidation service becomes |
- // available. If an invalidation service is available already, the callback |
- // will occur synchronously. The |consumer| must be unregistered before |this| |
- // is destroyed. |
- void RegisterConsumer(Consumer* consumer); |
- |
- // Indicates that |consumer| is no longer interested in using the |
- // shared |InvalidationService|. |
- void UnregisterConsumer(Consumer* consumer); |
- |
- // Shuts down the provider. Once the provider is shut down, it no longer makes |
- // any invalidation service available to consumers, no longer observes any |
- // per-profile invalidation services and no longer maintains a device-global |
- // invalidation service. |
- void Shutdown(); |
+ // AffiliatedInvalidationServiceProvider: |
+ void RegisterConsumer(Consumer* consumer) override; |
+ void UnregisterConsumer(Consumer* consumer) override; |
+ void Shutdown() override; |
invalidation::TiclInvalidationService* |
GetDeviceInvalidationServiceForTest() const; |
@@ -132,9 +90,9 @@ class AffiliatedInvalidationServiceProvider |
bool is_shut_down_; |
- DISALLOW_COPY_AND_ASSIGN(AffiliatedInvalidationServiceProvider); |
+ DISALLOW_COPY_AND_ASSIGN(AffiliatedInvalidationServiceProviderImpl); |
}; |
} // namespace policy |
-#endif // CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATED_INVALIDATION_SERVICE_PROVIDER_H_ |
+#endif // CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATED_INVALIDATION_SERVICE_PROVIDER_IMPL_H_ |