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[]; | |
39 | 38 |
40 // String constants for the device and app type we report to the server. | 39 // String constants for the device and app type we report to the server. |
41 static const char kValueAppType[]; | 40 static const char kValueAppType[]; |
42 static const char kValueDeviceType[]; | 41 static const char kValueDeviceType[]; |
43 static const char kValueRequestPolicy[]; | 42 static const char kValueRequestPolicy[]; |
44 static const char kValueRequestRegister[]; | 43 static const char kValueRequestRegister[]; |
45 static const char kValueRequestUnregister[]; | 44 static const char kValueRequestUnregister[]; |
46 static const char kValueUserAffiliationManaged[]; | |
47 static const char kValueUserAffiliationNone[]; | |
48 | 45 |
49 private: | 46 private: |
50 friend class DeviceManagementJobBase; | 47 friend class DeviceManagementJobBase; |
51 | 48 |
52 typedef std::set<DeviceManagementJobBase*> JobSet; | 49 typedef std::set<DeviceManagementJobBase*> JobSet; |
53 | 50 |
54 // Called by the DeviceManagementJobBase dtor so we can clean up. | 51 // Called by the DeviceManagementJobBase dtor so we can clean up. |
55 void JobDone(DeviceManagementJobBase* job); | 52 void JobDone(DeviceManagementJobBase* job); |
56 | 53 |
57 // Add a job to the pending job set and register it with the service (if | 54 // Add a job to the pending job set and register it with the service (if |
58 // available). | 55 // available). |
59 void AddJob(DeviceManagementJobBase* job); | 56 void AddJob(DeviceManagementJobBase* job); |
60 | 57 |
61 // DeviceManagementBackend overrides. | 58 // DeviceManagementBackend overrides. |
62 virtual void ProcessRegisterRequest( | 59 virtual void ProcessRegisterRequest( |
63 const std::string& gaia_auth_token, | 60 const std::string& gaia_auth_token, |
64 const std::string& oauth_token, | 61 const std::string& oauth_token, |
65 const std::string& device_id, | 62 const std::string& device_id, |
66 const em::DeviceRegisterRequest& request, | 63 const em::DeviceRegisterRequest& request, |
67 DeviceRegisterResponseDelegate* response_delegate); | 64 DeviceRegisterResponseDelegate* response_delegate); |
68 virtual void ProcessUnregisterRequest( | 65 virtual void ProcessUnregisterRequest( |
69 const std::string& device_management_token, | 66 const std::string& device_management_token, |
70 const std::string& device_id, | 67 const std::string& device_id, |
71 const em::DeviceUnregisterRequest& request, | 68 const em::DeviceUnregisterRequest& request, |
72 DeviceUnregisterResponseDelegate* response_delegate); | 69 DeviceUnregisterResponseDelegate* response_delegate); |
73 virtual void ProcessPolicyRequest( | 70 virtual void ProcessPolicyRequest( |
74 const std::string& device_management_token, | 71 const std::string& device_management_token, |
75 const std::string& device_id, | 72 const std::string& device_id, |
76 CloudPolicyDataStore::UserAffiliation affiliation, | |
77 const em::DevicePolicyRequest& request, | 73 const em::DevicePolicyRequest& request, |
78 DevicePolicyResponseDelegate* response_delegate); | 74 DevicePolicyResponseDelegate* response_delegate); |
79 | 75 |
80 // Converts a user affiliation to the appropriate query parameter value. | |
81 static const char* UserAffiliationToString( | |
82 CloudPolicyDataStore::UserAffiliation affiliation); | |
83 | |
84 // Keeps track of the jobs currently in flight. | 76 // Keeps track of the jobs currently in flight. |
85 JobSet pending_jobs_; | 77 JobSet pending_jobs_; |
86 | 78 |
87 DeviceManagementService* service_; | 79 DeviceManagementService* service_; |
88 | 80 |
89 DISALLOW_COPY_AND_ASSIGN(DeviceManagementBackendImpl); | 81 DISALLOW_COPY_AND_ASSIGN(DeviceManagementBackendImpl); |
90 }; | 82 }; |
91 | 83 |
92 } // namespace policy | 84 } // namespace policy |
93 | 85 |
94 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_ | 86 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_IMPL_H_ |
OLD | NEW |