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.
5 #include "chrome/browser/policy/cloud/remote_commands_invalidator_impl.h"
7 #include "base/logging.h"
8 #include "components/policy/core/common/remote_commands/remote_commands_service.h"
12 RemoteCommandsInvalidatorImpl::RemoteCommandsInvalidatorImpl(
13 CloudPolicyCore
* core
)
18 void RemoteCommandsInvalidatorImpl::OnInitialize() {
19 core_
->AddObserver(this);
20 if (core_
->remote_commands_service())
21 OnRemoteCommandsServiceStarted(core_
);
24 void RemoteCommandsInvalidatorImpl::OnShutdown() {
25 core_
->RemoveObserver(this);
28 void RemoteCommandsInvalidatorImpl::OnStart() {
29 core_
->store()->AddObserver(this);
30 OnStoreLoaded(core_
->store());
33 void RemoteCommandsInvalidatorImpl::OnStop() {
34 core_
->store()->RemoveObserver(this);
37 void RemoteCommandsInvalidatorImpl::DoRemoteCommandsFetch() {
38 DCHECK(core_
->remote_commands_service());
39 core_
->remote_commands_service()->FetchRemoteCommands();
42 void RemoteCommandsInvalidatorImpl::OnCoreConnected(CloudPolicyCore
* core
) {
45 void RemoteCommandsInvalidatorImpl::OnRefreshSchedulerStarted(
46 CloudPolicyCore
* core
) {
49 void RemoteCommandsInvalidatorImpl::OnCoreDisconnecting(CloudPolicyCore
* core
) {
53 void RemoteCommandsInvalidatorImpl::OnRemoteCommandsServiceStarted(
54 CloudPolicyCore
* core
) {
58 void RemoteCommandsInvalidatorImpl::OnStoreLoaded(CloudPolicyStore
* core
) {
59 ReloadPolicyData(core_
->store()->policy());
62 void RemoteCommandsInvalidatorImpl::OnStoreError(CloudPolicyStore
* core
) {