| 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_DEVICE_MANAGEMENT_SERVICE_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ |
| 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 typedef base::Callback<void(DeviceManagementRequestJob*)> RetryCallback; | 65 typedef base::Callback<void(DeviceManagementRequestJob*)> RetryCallback; |
| 66 | 66 |
| 67 virtual ~DeviceManagementRequestJob(); | 67 virtual ~DeviceManagementRequestJob(); |
| 68 | 68 |
| 69 // Functions for configuring the job. These should only be called before | 69 // Functions for configuring the job. These should only be called before |
| 70 // Start()ing the job, but never afterwards. | 70 // Start()ing the job, but never afterwards. |
| 71 void SetGaiaToken(const std::string& gaia_token); | 71 void SetGaiaToken(const std::string& gaia_token); |
| 72 void SetOAuthToken(const std::string& oauth_token); | 72 void SetOAuthToken(const std::string& oauth_token); |
| 73 void SetDMToken(const std::string& dm_token); | 73 void SetDMToken(const std::string& dm_token); |
| 74 void SetClientID(const std::string& client_id); | 74 void SetClientID(const std::string& client_id); |
| 75 // Sets the critical request parameter, which is used to differentiate regular |
| 76 // DMServer requests (like scheduled policy fetches) from time-sensitive ones |
| 77 // (like policy fetch during device enrollment). Should only be called before |
| 78 // Start()ing the job, at most once. |
| 79 void SetCritical(bool critical); |
| 80 |
| 75 enterprise_management::DeviceManagementRequest* GetRequest(); | 81 enterprise_management::DeviceManagementRequest* GetRequest(); |
| 76 | 82 |
| 77 // A job may automatically retry if it fails due to a temporary condition, or | 83 // A job may automatically retry if it fails due to a temporary condition, or |
| 78 // due to proxy misconfigurations. If a |retry_callback| is set then it will | 84 // due to proxy misconfigurations. If a |retry_callback| is set then it will |
| 79 // be invoked with the DeviceManagementRequestJob as an argument when that | 85 // be invoked with the DeviceManagementRequestJob as an argument when that |
| 80 // happens, so that the job's owner can customize the retry request before | 86 // happens, so that the job's owner can customize the retry request before |
| 81 // it's sent. | 87 // it's sent. |
| 82 void SetRetryCallback(const RetryCallback& retry_callback); | 88 void SetRetryCallback(const RetryCallback& retry_callback); |
| 83 | 89 |
| 84 // Starts the job. |callback| will be invoked on completion. | 90 // Starts the job. |callback| will be invoked on completion. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 214 |
| 209 // Used to create tasks which run delayed on the UI thread. | 215 // Used to create tasks which run delayed on the UI thread. |
| 210 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; | 216 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; |
| 211 | 217 |
| 212 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); | 218 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); |
| 213 }; | 219 }; |
| 214 | 220 |
| 215 } // namespace policy | 221 } // namespace policy |
| 216 | 222 |
| 217 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ | 223 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ |
| OLD | NEW |