Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1907)

Unified Diff: chrome/browser/policy/device_management_backend_impl.cc

Issue 7810025: Pass user_affiliation request parameter on user cloud policy requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac build breakage. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/device_management_backend_impl.cc
diff --git a/chrome/browser/policy/device_management_backend_impl.cc b/chrome/browser/policy/device_management_backend_impl.cc
index 03092dcff7ffc7f99ee56db81171484031b58af6..9198380be56bafea52c6d32fef7d1aa88aa323ab 100644
--- a/chrome/browser/policy/device_management_backend_impl.cc
+++ b/chrome/browser/policy/device_management_backend_impl.cc
@@ -34,6 +34,8 @@ const char DeviceManagementBackendImpl::kParamDeviceType[] = "devicetype";
const char DeviceManagementBackendImpl::kParamOAuthToken[] = "oauth_token";
const char DeviceManagementBackendImpl::kParamPlatform[] = "platform";
const char DeviceManagementBackendImpl::kParamRequest[] = "request";
+const char DeviceManagementBackendImpl::kParamUserAffiliation[] =
+ "user_affiliation";
// String constants for the device and app type we report to the server.
const char DeviceManagementBackendImpl::kValueAppType[] = "Chrome";
@@ -42,6 +44,9 @@ const char DeviceManagementBackendImpl::kValueRequestPolicy[] = "policy";
const char DeviceManagementBackendImpl::kValueRequestRegister[] = "register";
const char DeviceManagementBackendImpl::kValueRequestUnregister[] =
"unregister";
+const char DeviceManagementBackendImpl::kValueUserAffiliationManaged[] =
+ "managed";
+const char DeviceManagementBackendImpl::kValueUserAffiliationNone[] = "none";
namespace {
@@ -71,7 +76,6 @@ const int kPolicyNotFound = 902; // This error is not sent as HTTP status code.
const int kPendingApprovalLegacy = 491;
const int kDeviceNotFoundLegacy = 901;
-
#if defined(OS_CHROMEOS)
// Machine info keys.
const char kMachineInfoHWClass[] = "hardware_class";
@@ -384,6 +388,7 @@ class DeviceManagementPolicyJob : public DeviceManagementJobBase {
DeviceManagementBackendImpl* backend_impl,
const std::string& device_management_token,
const std::string& device_id,
+ const std::string& user_affiliation,
const em::DevicePolicyRequest& request,
DeviceManagementBackend::DevicePolicyResponseDelegate* delegate)
: DeviceManagementJobBase(
@@ -392,6 +397,8 @@ class DeviceManagementPolicyJob : public DeviceManagementJobBase {
device_id),
delegate_(delegate) {
SetDeviceManagementToken(device_management_token);
+ SetQueryParam(DeviceManagementBackendImpl::kParamUserAffiliation,
+ user_affiliation);
em::DeviceManagementRequest request_wrapper;
request_wrapper.mutable_policy_request()->CopyFrom(request);
SetPayload(request_wrapper);
@@ -538,12 +545,27 @@ void DeviceManagementBackendImpl::ProcessUnregisterRequest(
void DeviceManagementBackendImpl::ProcessPolicyRequest(
const std::string& device_management_token,
const std::string& device_id,
+ CloudPolicyDataStore::UserAffiliation affiliation,
const em::DevicePolicyRequest& request,
DevicePolicyResponseDelegate* delegate) {
UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, kMetricPolicyFetchRequested,
kMetricPolicySize);
AddJob(new DeviceManagementPolicyJob(this, device_management_token, device_id,
+ UserAffiliationToString(affiliation),
request, delegate));
}
+// static
+const char* DeviceManagementBackendImpl::UserAffiliationToString(
+ CloudPolicyDataStore::UserAffiliation affiliation) {
+ switch (affiliation) {
+ case CloudPolicyDataStore::USER_AFFILIATION_MANAGED:
+ return kValueUserAffiliationManaged;
+ case CloudPolicyDataStore::USER_AFFILIATION_NONE:
+ return kValueUserAffiliationNone;
+ }
+ NOTREACHED();
+ return kValueUserAffiliationNone;
+}
+
} // namespace policy
« no previous file with comments | « chrome/browser/policy/device_management_backend_impl.h ('k') | chrome/browser/policy/device_management_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698