OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/policy/remote_commands/affiliated_remote_comma
nds_invalidator.h" |
| 6 |
| 7 #include "chrome/browser/policy/cloud/remote_commands_invalidator_impl.h" |
| 8 |
| 9 namespace policy { |
| 10 |
| 11 AffiliatedRemoteCommandsInvalidator::AffiliatedRemoteCommandsInvalidator( |
| 12 CloudPolicyCore* core, |
| 13 AffiliatedInvalidationServiceProvider* invalidation_service_provider) |
| 14 : core_(core), |
| 15 invalidation_service_provider_(invalidation_service_provider) { |
| 16 invalidation_service_provider_->RegisterConsumer(this); |
| 17 } |
| 18 |
| 19 AffiliatedRemoteCommandsInvalidator::~AffiliatedRemoteCommandsInvalidator() { |
| 20 invalidation_service_provider_->UnregisterConsumer(this); |
| 21 } |
| 22 |
| 23 void AffiliatedRemoteCommandsInvalidator::OnInvalidationServiceSet( |
| 24 invalidation::InvalidationService* invalidation_service) { |
| 25 // Destroy this invalidator if it exists. |
| 26 if (invalidator_) { |
| 27 invalidator_->Shutdown(); |
| 28 invalidator_.reset(); |
| 29 } |
| 30 // Create a new one if required. |
| 31 if (invalidation_service) { |
| 32 invalidator_.reset(new RemoteCommandsInvalidatorImpl(core_)); |
| 33 invalidator_->Initialize(invalidation_service); |
| 34 } |
| 35 } |
| 36 |
| 37 } // namespace policy |
OLD | NEW |