| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ |
| 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <set> | 12 #include <set> |
| 12 #include <string> | 13 #include <string> |
| 13 #include <utility> | 14 #include <utility> |
| 14 #include <vector> | 15 #include <vector> |
| 15 | 16 |
| 16 #include "base/callback.h" | 17 #include "base/callback.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/scoped_ptr.h" | |
| 19 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_vector.h" |
| 20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 22 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 22 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 23 #include "components/policy/core/common/remote_commands/remote_command_job.h" | 23 #include "components/policy/core/common/remote_commands/remote_command_job.h" |
| 24 #include "components/policy/policy_export.h" | 24 #include "components/policy/policy_export.h" |
| 25 #include "policy/proto/device_management_backend.pb.h" | 25 #include "policy/proto/device_management_backend.pb.h" |
| 26 | 26 |
| 27 namespace net { | 27 namespace net { |
| 28 class URLRequestContextGetter; | 28 class URLRequestContextGetter; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 const StatusCallback& callback); | 146 const StatusCallback& callback); |
| 147 | 147 |
| 148 // Attempts to fetch remote commands, with |last_command_id| being the ID of | 148 // Attempts to fetch remote commands, with |last_command_id| being the ID of |
| 149 // the last command that finished execution and |command_results| being | 149 // the last command that finished execution and |command_results| being |
| 150 // results for previous commands which have not been reported yet. The | 150 // results for previous commands which have not been reported yet. The |
| 151 // |callback| will be called when the operation completes. | 151 // |callback| will be called when the operation completes. |
| 152 // Note that sending |last_command_id| will acknowledge this command and any | 152 // Note that sending |last_command_id| will acknowledge this command and any |
| 153 // previous commands. A nullptr indicates that no commands have finished | 153 // previous commands. A nullptr indicates that no commands have finished |
| 154 // execution. | 154 // execution. |
| 155 virtual void FetchRemoteCommands( | 155 virtual void FetchRemoteCommands( |
| 156 scoped_ptr<RemoteCommandJob::UniqueIDType> last_command_id, | 156 std::unique_ptr<RemoteCommandJob::UniqueIDType> last_command_id, |
| 157 const std::vector<enterprise_management::RemoteCommandResult>& | 157 const std::vector<enterprise_management::RemoteCommandResult>& |
| 158 command_results, | 158 command_results, |
| 159 const RemoteCommandCallback& callback); | 159 const RemoteCommandCallback& callback); |
| 160 | 160 |
| 161 // Sends a device attribute update permission request to the server, uses | 161 // Sends a device attribute update permission request to the server, uses |
| 162 // OAuth2 token |auth_token| to identify user who requests a permission to | 162 // OAuth2 token |auth_token| to identify user who requests a permission to |
| 163 // name a device, calls a |callback| from the enrollment screen to indicate | 163 // name a device, calls a |callback| from the enrollment screen to indicate |
| 164 // whether the device naming prompt should be shown. | 164 // whether the device naming prompt should be shown. |
| 165 void GetDeviceAttributeUpdatePermission(const std::string& auth_token, | 165 void GetDeviceAttributeUpdatePermission(const std::string& auth_token, |
| 166 const StatusCallback& callback); | 166 const StatusCallback& callback); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 std::string invalidation_payload_; | 371 std::string invalidation_payload_; |
| 372 | 372 |
| 373 // The invalidation version used for the most recent fetch operation. | 373 // The invalidation version used for the most recent fetch operation. |
| 374 int64_t fetched_invalidation_version_; | 374 int64_t fetched_invalidation_version_; |
| 375 | 375 |
| 376 // Used for issuing requests to the cloud. | 376 // Used for issuing requests to the cloud. |
| 377 DeviceManagementService* service_; | 377 DeviceManagementService* service_; |
| 378 | 378 |
| 379 // Only one outstanding policy fetch is allowed, so this is tracked in | 379 // Only one outstanding policy fetch is allowed, so this is tracked in |
| 380 // its own member variable. | 380 // its own member variable. |
| 381 scoped_ptr<DeviceManagementRequestJob> policy_fetch_request_job_; | 381 std::unique_ptr<DeviceManagementRequestJob> policy_fetch_request_job_; |
| 382 | 382 |
| 383 // All of the outstanding non-policy-fetch request jobs. These jobs are | 383 // All of the outstanding non-policy-fetch request jobs. These jobs are |
| 384 // silently cancelled if Unregister() is called. | 384 // silently cancelled if Unregister() is called. |
| 385 ScopedVector<DeviceManagementRequestJob> request_jobs_; | 385 ScopedVector<DeviceManagementRequestJob> request_jobs_; |
| 386 | 386 |
| 387 // The policy responses returned by the last policy fetch operation. | 387 // The policy responses returned by the last policy fetch operation. |
| 388 ResponseMap responses_; | 388 ResponseMap responses_; |
| 389 DeviceManagementStatus status_; | 389 DeviceManagementStatus status_; |
| 390 | 390 |
| 391 base::ObserverList<Observer, true> observers_; | 391 base::ObserverList<Observer, true> observers_; |
| 392 scoped_refptr<net::URLRequestContextGetter> request_context_; | 392 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 393 | 393 |
| 394 private: | 394 private: |
| 395 DISALLOW_COPY_AND_ASSIGN(CloudPolicyClient); | 395 DISALLOW_COPY_AND_ASSIGN(CloudPolicyClient); |
| 396 }; | 396 }; |
| 397 | 397 |
| 398 } // namespace policy | 398 } // namespace policy |
| 399 | 399 |
| 400 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ | 400 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ |
| OLD | NEW |