| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_ | |
| 6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <set> | |
| 10 #include <string> | |
| 11 | |
| 12 #include "base/basictypes.h" | |
| 13 #include "chrome/browser/policy/cloud_policy_constants.h" | |
| 14 #include "chrome/browser/policy/device_management_backend.h" | |
| 15 | |
| 16 namespace policy { | |
| 17 | |
| 18 class DeviceManagementRequestJob; | |
| 19 class DeviceManagementService; | |
| 20 | |
| 21 // Implements the actual backend interface. It creates device management jobs | |
| 22 // and passes them on to the service for processing. | |
| 23 class DeviceManagementBackendImpl : public DeviceManagementBackend { | |
| 24 public: | |
| 25 explicit DeviceManagementBackendImpl(DeviceManagementService* service); | |
| 26 virtual ~DeviceManagementBackendImpl(); | |
| 27 | |
| 28 private: | |
| 29 typedef std::set<DeviceManagementRequestJob*> JobSet; | |
| 30 | |
| 31 // DeviceManagementBackend overrides. | |
| 32 virtual void ProcessRegisterRequest( | |
| 33 const std::string& gaia_auth_token, | |
| 34 const std::string& oauth_token, | |
| 35 const std::string& device_id, | |
| 36 const enterprise_management::DeviceRegisterRequest& request, | |
| 37 DeviceRegisterResponseDelegate* response_delegate) OVERRIDE; | |
| 38 virtual void ProcessUnregisterRequest( | |
| 39 const std::string& device_management_token, | |
| 40 const std::string& device_id, | |
| 41 const enterprise_management::DeviceUnregisterRequest& request, | |
| 42 DeviceUnregisterResponseDelegate* response_delegate) OVERRIDE; | |
| 43 virtual void ProcessPolicyRequest( | |
| 44 const std::string& device_management_token, | |
| 45 const std::string& device_id, | |
| 46 CloudPolicyDataStore::UserAffiliation affiliation, | |
| 47 const enterprise_management::DevicePolicyRequest& request, | |
| 48 const enterprise_management::DeviceStatusReportRequest* device_status, | |
| 49 DevicePolicyResponseDelegate* response_delegate) OVERRIDE; | |
| 50 virtual void ProcessAutoEnrollmentRequest( | |
| 51 const std::string& device_id, | |
| 52 const enterprise_management::DeviceAutoEnrollmentRequest& request, | |
| 53 DeviceAutoEnrollmentResponseDelegate* delegate) OVERRIDE; | |
| 54 | |
| 55 // Helpers for mapping new-style callbacks to the old delegate style. | |
| 56 void OnRegistrationDone( | |
| 57 DeviceManagementRequestJob* job, | |
| 58 DeviceRegisterResponseDelegate* delegate, | |
| 59 DeviceManagementStatus status, | |
| 60 const enterprise_management::DeviceManagementResponse& response); | |
| 61 void OnUnregistrationDone( | |
| 62 DeviceManagementRequestJob* job, | |
| 63 DeviceUnregisterResponseDelegate* delegate, | |
| 64 DeviceManagementStatus status, | |
| 65 const enterprise_management::DeviceManagementResponse& response); | |
| 66 void OnPolicyFetchDone( | |
| 67 DeviceManagementRequestJob* job, | |
| 68 DevicePolicyResponseDelegate* delegate, | |
| 69 DeviceManagementStatus status, | |
| 70 const enterprise_management::DeviceManagementResponse& response); | |
| 71 void OnAutoEnrollmentDone( | |
| 72 DeviceManagementRequestJob* job, | |
| 73 DeviceAutoEnrollmentResponseDelegate* delegate, | |
| 74 DeviceManagementStatus status, | |
| 75 const enterprise_management::DeviceManagementResponse& response); | |
| 76 | |
| 77 // Keeps track of the jobs currently in flight. | |
| 78 JobSet pending_jobs_; | |
| 79 | |
| 80 DeviceManagementService* service_; | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(DeviceManagementBackendImpl); | |
| 83 }; | |
| 84 | |
| 85 } // namespace policy | |
| 86 | |
| 87 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_ | |
| OLD | NEW |