Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / chrome / browser / policy / cloud / remote_commands_invalidator_impl.cc
blob51fbc5cf8e1a5207012e4ac19b48dc0c9987491e
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"
10 namespace policy {
12 RemoteCommandsInvalidatorImpl::RemoteCommandsInvalidatorImpl(
13 CloudPolicyCore* core)
14 : core_(core) {
15 DCHECK(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) {
50 Stop();
53 void RemoteCommandsInvalidatorImpl::OnRemoteCommandsServiceStarted(
54 CloudPolicyCore* core) {
55 Start();
58 void RemoteCommandsInvalidatorImpl::OnStoreLoaded(CloudPolicyStore* core) {
59 ReloadPolicyData(core_->store()->policy());
62 void RemoteCommandsInvalidatorImpl::OnStoreError(CloudPolicyStore* core) {
65 } // namespace policy