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/policy/cloud/remote_commands_invalidator_impl.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "components/policy/core/common/remote_commands/remote_commands_service.
h" |
| 9 |
| 10 namespace policy { |
| 11 |
| 12 RemoteCommandsInvalidatorImpl::RemoteCommandsInvalidatorImpl( |
| 13 CloudPolicyCore* core) |
| 14 : core_(core) { |
| 15 DCHECK(core_); |
| 16 } |
| 17 |
| 18 void RemoteCommandsInvalidatorImpl::OnInitialize() { |
| 19 core_->AddObserver(this); |
| 20 if (core_->remote_commands_service()) |
| 21 OnRemoteCommandsServiceStarted(core_); |
| 22 } |
| 23 |
| 24 void RemoteCommandsInvalidatorImpl::OnShutdown() { |
| 25 core_->RemoveObserver(this); |
| 26 } |
| 27 |
| 28 void RemoteCommandsInvalidatorImpl::OnStart() { |
| 29 core_->store()->AddObserver(this); |
| 30 OnStoreLoaded(core_->store()); |
| 31 } |
| 32 |
| 33 void RemoteCommandsInvalidatorImpl::OnStop() { |
| 34 core_->store()->RemoveObserver(this); |
| 35 } |
| 36 |
| 37 void RemoteCommandsInvalidatorImpl::DoRemoteCommandsFetch() { |
| 38 DCHECK(core_->remote_commands_service()); |
| 39 core_->remote_commands_service()->FetchRemoteCommands(); |
| 40 } |
| 41 |
| 42 void RemoteCommandsInvalidatorImpl::OnCoreConnected(CloudPolicyCore* core) { |
| 43 } |
| 44 |
| 45 void RemoteCommandsInvalidatorImpl::OnRefreshSchedulerStarted( |
| 46 CloudPolicyCore* core) { |
| 47 } |
| 48 |
| 49 void RemoteCommandsInvalidatorImpl::OnCoreDisconnecting(CloudPolicyCore* core) { |
| 50 Stop(); |
| 51 } |
| 52 |
| 53 void RemoteCommandsInvalidatorImpl::OnRemoteCommandsServiceStarted( |
| 54 CloudPolicyCore* core) { |
| 55 Start(); |
| 56 } |
| 57 |
| 58 void RemoteCommandsInvalidatorImpl::OnStoreLoaded(CloudPolicyStore* core) { |
| 59 ReloadPolicyData(core_->store()->policy()); |
| 60 } |
| 61 |
| 62 void RemoteCommandsInvalidatorImpl::OnStoreError(CloudPolicyStore* core) { |
| 63 } |
| 64 |
| 65 } // namespace policy |
OLD | NEW |