| Index: components/policy/core/common/remote_commands/remote_commands_service.h | 
| diff --git a/components/policy/core/common/remote_commands/remote_commands_service.h b/components/policy/core/common/remote_commands/remote_commands_service.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..2c37435517bff180e649651f81f8f2ad2d252439 | 
| --- /dev/null | 
| +++ b/components/policy/core/common/remote_commands/remote_commands_service.h | 
| @@ -0,0 +1,73 @@ | 
| +// Copyright 2015 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#ifndef COMPONENTS_POLICY_CORE_COMMON_REMOTE_COMMANDS_REMOTE_COMMANDS_SERVICE_H_ | 
| +#define COMPONENTS_POLICY_CORE_COMMON_REMOTE_COMMANDS_REMOTE_COMMANDS_SERVICE_H_ | 
| + | 
| +#include <vector> | 
| + | 
| +#include "base/macros.h" | 
| +#include "base/memory/scoped_ptr.h" | 
| +#include "base/timer/timer.h" | 
| +#include "components/policy/core/common/cloud/cloud_policy_constants.h" | 
| +#include "components/policy/core/common/remote_commands/remote_command_job.h" | 
| +#include "components/policy/core/common/remote_commands/remote_commands_queue.h" | 
| +#include "policy/proto/device_management_backend.pb.h" | 
| + | 
| +namespace policy { | 
| + | 
| +class CloudPolicyClient; | 
| +class DeviceManagementRequestJob; | 
| + | 
| +// XXX | 
| +class RemoteCommandsService : public RemoteCommandsQueue::Observer { | 
| + public: | 
| +  RemoteCommandsService(scoped_ptr<RemoteCommandJob::Factory> factory, | 
| +                        CloudPolicyClient* client); | 
| +  ~RemoteCommandsService() override; | 
| + | 
| +  // XXX | 
| +  void FetchRemoteCommands(); | 
| + | 
| +  // XXX | 
| +  void StartAutoFetching(); | 
| + | 
| +  // XXX | 
| +  void StopAutoFetching(); | 
| + | 
| + private: | 
| +  // XXX | 
| +  void AddCommand(const enterprise_management::RemoteCommand& command); | 
| + | 
| +  // RemoteCommandsQueue::Observer: | 
| +  void OnJobStarted(RemoteCommandJob* command) override; | 
| +  void OnJobFinished(RemoteCommandJob* command) override; | 
| + | 
| +  // XXX | 
| +  void OnRemoteCommandsFetched( | 
| +      DeviceManagementStatus status, | 
| +      int net_error, | 
| +      const enterprise_management::DeviceManagementResponse& response); | 
| + | 
| +  scoped_ptr<DeviceManagementRequestJob> request_job_; | 
| + | 
| +  bool request_job_in_progress_; | 
| +  int unhandled_fetch_requests; | 
| +  std::vector<enterprise_management::RemoteCommandResult> unsent_results_; | 
| + | 
| +  RemoteCommandJob::UniqueIDType last_fetched_command_id_; | 
| +  RemoteCommandJob::UniqueIDType last_executed_command_id_; | 
| + | 
| +  base::RepeatingTimer<RemoteCommandsService> timer_; | 
| + | 
| +  RemoteCommandsQueue queue_; | 
| +  scoped_ptr<RemoteCommandJob::Factory> factory_; | 
| +  CloudPolicyClient* client_; | 
| + | 
| +  DISALLOW_COPY_AND_ASSIGN(RemoteCommandsService); | 
| +}; | 
| + | 
| +}  // namespace policy | 
| + | 
| +#endif  // COMPONENTS_POLICY_CORE_COMMON_REMOTE_COMMANDS_REMOTE_COMMANDS_SERVICE_H_ | 
|  |