| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 // Sends a device naming information (Asset Id and Location) to the | 166 // Sends a device naming information (Asset Id and Location) to the |
| 167 // device management server, uses OAuth2 token |auth_token| to identify user | 167 // device management server, uses OAuth2 token |auth_token| to identify user |
| 168 // who names a device, the |callback| will be called when the operation | 168 // who names a device, the |callback| will be called when the operation |
| 169 // completes. | 169 // completes. |
| 170 void UpdateDeviceAttributes(const std::string& auth_token, | 170 void UpdateDeviceAttributes(const std::string& auth_token, |
| 171 const std::string& asset_id, | 171 const std::string& asset_id, |
| 172 const std::string& location, | 172 const std::string& location, |
| 173 const StatusCallback& callback); | 173 const StatusCallback& callback); |
| 174 | 174 |
| 175 // Sends a GCM id update request to the DM server. The server will |
| 176 // associate the DM token in authorization header with |gcm_id|, and |
| 177 // |callback| will be called when the operation completes. |
| 178 virtual void UpdateGcmId(const std::string& gcm_id, |
| 179 const StatusCallback& callback); |
| 180 |
| 175 // Adds an observer to be called back upon policy and state changes. | 181 // Adds an observer to be called back upon policy and state changes. |
| 176 void AddObserver(Observer* observer); | 182 void AddObserver(Observer* observer); |
| 177 | 183 |
| 178 // Removes the specified observer. | 184 // Removes the specified observer. |
| 179 void RemoveObserver(Observer* observer); | 185 void RemoveObserver(Observer* observer); |
| 180 | 186 |
| 181 void set_submit_machine_id(bool submit_machine_id) { | 187 void set_submit_machine_id(bool submit_machine_id) { |
| 182 submit_machine_id_ = submit_machine_id; | 188 submit_machine_id_ = submit_machine_id; |
| 183 } | 189 } |
| 184 | 190 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 const enterprise_management::DeviceManagementResponse& response); | 324 const enterprise_management::DeviceManagementResponse& response); |
| 319 | 325 |
| 320 // Callback for device attribute update requests. | 326 // Callback for device attribute update requests. |
| 321 void OnDeviceAttributeUpdated( | 327 void OnDeviceAttributeUpdated( |
| 322 const DeviceManagementRequestJob* job, | 328 const DeviceManagementRequestJob* job, |
| 323 const StatusCallback& callback, | 329 const StatusCallback& callback, |
| 324 DeviceManagementStatus status, | 330 DeviceManagementStatus status, |
| 325 int net_error, | 331 int net_error, |
| 326 const enterprise_management::DeviceManagementResponse& response); | 332 const enterprise_management::DeviceManagementResponse& response); |
| 327 | 333 |
| 334 // Callback for gcm id update requests. |
| 335 void OnGcmIdUpdated( |
| 336 const DeviceManagementRequestJob* job, |
| 337 const StatusCallback& callback, |
| 338 DeviceManagementStatus status, |
| 339 int net_error, |
| 340 const enterprise_management::DeviceManagementResponse& response); |
| 341 |
| 328 // Helper to remove a job from request_jobs_. | 342 // Helper to remove a job from request_jobs_. |
| 329 void RemoveJob(const DeviceManagementRequestJob* job); | 343 void RemoveJob(const DeviceManagementRequestJob* job); |
| 330 | 344 |
| 331 // Observer notification helpers. | 345 // Observer notification helpers. |
| 332 void NotifyPolicyFetched(); | 346 void NotifyPolicyFetched(); |
| 333 void NotifyRegistrationStateChanged(); | 347 void NotifyRegistrationStateChanged(); |
| 334 void NotifyRobotAuthCodesFetched(); | 348 void NotifyRobotAuthCodesFetched(); |
| 335 void NotifyClientError(); | 349 void NotifyClientError(); |
| 336 | 350 |
| 337 // Data necessary for constructing policy requests. | 351 // Data necessary for constructing policy requests. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 base::ObserverList<Observer, true> observers_; | 389 base::ObserverList<Observer, true> observers_; |
| 376 scoped_refptr<net::URLRequestContextGetter> request_context_; | 390 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 377 | 391 |
| 378 private: | 392 private: |
| 379 DISALLOW_COPY_AND_ASSIGN(CloudPolicyClient); | 393 DISALLOW_COPY_AND_ASSIGN(CloudPolicyClient); |
| 380 }; | 394 }; |
| 381 | 395 |
| 382 } // namespace policy | 396 } // namespace policy |
| 383 | 397 |
| 384 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ | 398 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CLIENT_H_ |
| OLD | NEW |