| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_ | 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_ |
| 6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_ | 6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 static std::string GetPlatformString(); | 28 static std::string GetPlatformString(); |
| 29 | 29 |
| 30 // Name constants for URL query parameters. | 30 // Name constants for URL query parameters. |
| 31 static const char kParamAgent[]; | 31 static const char kParamAgent[]; |
| 32 static const char kParamAppType[]; | 32 static const char kParamAppType[]; |
| 33 static const char kParamDeviceID[]; | 33 static const char kParamDeviceID[]; |
| 34 static const char kParamDeviceType[]; | 34 static const char kParamDeviceType[]; |
| 35 static const char kParamOAuthToken[]; | 35 static const char kParamOAuthToken[]; |
| 36 static const char kParamPlatform[]; | 36 static const char kParamPlatform[]; |
| 37 static const char kParamRequest[]; | 37 static const char kParamRequest[]; |
| 38 static const char kParamUserAffiliation[]; |
| 38 | 39 |
| 39 // String constants for the device and app type we report to the server. | 40 // String constants for the device and app type we report to the server. |
| 40 static const char kValueAppType[]; | 41 static const char kValueAppType[]; |
| 41 static const char kValueDeviceType[]; | 42 static const char kValueDeviceType[]; |
| 42 static const char kValueRequestPolicy[]; | 43 static const char kValueRequestPolicy[]; |
| 43 static const char kValueRequestRegister[]; | 44 static const char kValueRequestRegister[]; |
| 44 static const char kValueRequestUnregister[]; | 45 static const char kValueRequestUnregister[]; |
| 46 static const char kValueUserAffiliationManaged[]; |
| 47 static const char kValueUserAffiliationNone[]; |
| 45 | 48 |
| 46 private: | 49 private: |
| 47 friend class DeviceManagementJobBase; | 50 friend class DeviceManagementJobBase; |
| 48 | 51 |
| 49 typedef std::set<DeviceManagementJobBase*> JobSet; | 52 typedef std::set<DeviceManagementJobBase*> JobSet; |
| 50 | 53 |
| 51 // Called by the DeviceManagementJobBase dtor so we can clean up. | 54 // Called by the DeviceManagementJobBase dtor so we can clean up. |
| 52 void JobDone(DeviceManagementJobBase* job); | 55 void JobDone(DeviceManagementJobBase* job); |
| 53 | 56 |
| 54 // Add a job to the pending job set and register it with the service (if | 57 // Add a job to the pending job set and register it with the service (if |
| 55 // available). | 58 // available). |
| 56 void AddJob(DeviceManagementJobBase* job); | 59 void AddJob(DeviceManagementJobBase* job); |
| 57 | 60 |
| 58 // DeviceManagementBackend overrides. | 61 // DeviceManagementBackend overrides. |
| 59 virtual void ProcessRegisterRequest( | 62 virtual void ProcessRegisterRequest( |
| 60 const std::string& gaia_auth_token, | 63 const std::string& gaia_auth_token, |
| 61 const std::string& oauth_token, | 64 const std::string& oauth_token, |
| 62 const std::string& device_id, | 65 const std::string& device_id, |
| 63 const em::DeviceRegisterRequest& request, | 66 const em::DeviceRegisterRequest& request, |
| 64 DeviceRegisterResponseDelegate* response_delegate); | 67 DeviceRegisterResponseDelegate* response_delegate); |
| 65 virtual void ProcessUnregisterRequest( | 68 virtual void ProcessUnregisterRequest( |
| 66 const std::string& device_management_token, | 69 const std::string& device_management_token, |
| 67 const std::string& device_id, | 70 const std::string& device_id, |
| 68 const em::DeviceUnregisterRequest& request, | 71 const em::DeviceUnregisterRequest& request, |
| 69 DeviceUnregisterResponseDelegate* response_delegate); | 72 DeviceUnregisterResponseDelegate* response_delegate); |
| 70 virtual void ProcessPolicyRequest( | 73 virtual void ProcessPolicyRequest( |
| 71 const std::string& device_management_token, | 74 const std::string& device_management_token, |
| 72 const std::string& device_id, | 75 const std::string& device_id, |
| 76 CloudPolicyDataStore::UserAffiliation affiliation, |
| 73 const em::DevicePolicyRequest& request, | 77 const em::DevicePolicyRequest& request, |
| 74 DevicePolicyResponseDelegate* response_delegate); | 78 DevicePolicyResponseDelegate* response_delegate); |
| 75 | 79 |
| 80 // Converts a user affiliation to the appropriate query parameter value. |
| 81 static const char* UserAffiliationToString( |
| 82 CloudPolicyDataStore::UserAffiliation affiliation); |
| 83 |
| 76 // Keeps track of the jobs currently in flight. | 84 // Keeps track of the jobs currently in flight. |
| 77 JobSet pending_jobs_; | 85 JobSet pending_jobs_; |
| 78 | 86 |
| 79 DeviceManagementService* service_; | 87 DeviceManagementService* service_; |
| 80 | 88 |
| 81 DISALLOW_COPY_AND_ASSIGN(DeviceManagementBackendImpl); | 89 DISALLOW_COPY_AND_ASSIGN(DeviceManagementBackendImpl); |
| 82 }; | 90 }; |
| 83 | 91 |
| 84 } // namespace policy | 92 } // namespace policy |
| 85 | 93 |
| 86 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_ | 94 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_ |
| OLD | NEW |