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