| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/browser/policy/test/local_policy_test_server.h" | 5 #include "chrome/browser/policy/test/local_policy_test_server.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 client_dict->SetString(kClientStateKeyDeviceToken, dm_token); | 124 client_dict->SetString(kClientStateKeyDeviceToken, dm_token); |
| 125 client_dict->SetString(kClientStateKeyMachineName, std::string()); | 125 client_dict->SetString(kClientStateKeyMachineName, std::string()); |
| 126 client_dict->SetString(kClientStateKeyMachineId, std::string()); | 126 client_dict->SetString(kClientStateKeyMachineId, std::string()); |
| 127 | 127 |
| 128 // Allow all policy types for now. | 128 // Allow all policy types for now. |
| 129 std::unique_ptr<base::ListValue> types(new base::ListValue()); | 129 std::unique_ptr<base::ListValue> types(new base::ListValue()); |
| 130 types->AppendString(dm_protocol::kChromeDevicePolicyType); | 130 types->AppendString(dm_protocol::kChromeDevicePolicyType); |
| 131 types->AppendString(dm_protocol::kChromeUserPolicyType); | 131 types->AppendString(dm_protocol::kChromeUserPolicyType); |
| 132 types->AppendString(dm_protocol::kChromePublicAccountPolicyType); | 132 types->AppendString(dm_protocol::kChromePublicAccountPolicyType); |
| 133 types->AppendString(dm_protocol::kChromeExtensionPolicyType); | 133 types->AppendString(dm_protocol::kChromeExtensionPolicyType); |
| 134 types->AppendString(dm_protocol::kChromeSigninExtensionPolicyType); |
| 134 | 135 |
| 135 client_dict->Set(kClientStateKeyAllowedPolicyTypes, types.release()); | 136 client_dict->Set(kClientStateKeyAllowedPolicyTypes, types.release()); |
| 136 clients_.Set(dm_token, client_dict.release()); | 137 clients_.Set(dm_token, client_dict.release()); |
| 137 } | 138 } |
| 138 | 139 |
| 139 bool LocalPolicyTestServer::UpdatePolicy(const std::string& type, | 140 bool LocalPolicyTestServer::UpdatePolicy(const std::string& type, |
| 140 const std::string& entity_id, | 141 const std::string& entity_id, |
| 141 const std::string& policy) { | 142 const std::string& policy) { |
| 142 CHECK(server_data_dir_.IsValid()); | 143 CHECK(server_data_dir_.IsValid()); |
| 143 | 144 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 std::string LocalPolicyTestServer::GetSelector(const std::string& type, | 259 std::string LocalPolicyTestServer::GetSelector(const std::string& type, |
| 259 const std::string& entity_id) { | 260 const std::string& entity_id) { |
| 260 std::string selector = type; | 261 std::string selector = type; |
| 261 if (!entity_id.empty()) | 262 if (!entity_id.empty()) |
| 262 selector = base::StringPrintf("%s/%s", type.c_str(), entity_id.c_str()); | 263 selector = base::StringPrintf("%s/%s", type.c_str(), entity_id.c_str()); |
| 263 std::replace_if(selector.begin(), selector.end(), IsUnsafeCharacter, '_'); | 264 std::replace_if(selector.begin(), selector.end(), IsUnsafeCharacter, '_'); |
| 264 return selector; | 265 return selector; |
| 265 } | 266 } |
| 266 | 267 |
| 267 } // namespace policy | 268 } // namespace policy |
| OLD | NEW |