OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 "components/policy/core/common/policy_loader_win.h" | 5 #include "components/policy/core/common/policy_loader_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <lm.h> // For limits. | 8 #include <lm.h> // For limits. |
9 #include <ntdsapi.h> // For Ds[Un]Bind | 9 #include <ntdsapi.h> // For Ds[Un]Bind |
10 #include <rpc.h> // For struct GUID | 10 #include <rpc.h> // For struct GUID |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "base/strings/string16.h" | 37 #include "base/strings/string16.h" |
38 #include "base/strings/string_util.h" | 38 #include "base/strings/string_util.h" |
39 #include "base/values.h" | 39 #include "base/values.h" |
40 #include "base/win/win_util.h" | 40 #include "base/win/win_util.h" |
41 #include "base/win/windows_version.h" | 41 #include "base/win/windows_version.h" |
42 #include "components/json_schema/json_schema_constants.h" | 42 #include "components/json_schema/json_schema_constants.h" |
43 #include "components/policy/core/common/policy_bundle.h" | 43 #include "components/policy/core/common/policy_bundle.h" |
44 #include "components/policy/core/common/policy_load_status.h" | 44 #include "components/policy/core/common/policy_load_status.h" |
45 #include "components/policy/core/common/policy_map.h" | 45 #include "components/policy/core/common/policy_map.h" |
46 #include "components/policy/core/common/policy_namespace.h" | 46 #include "components/policy/core/common/policy_namespace.h" |
| 47 #include "components/policy/core/common/policy_types.h" |
47 #include "components/policy/core/common/preg_parser_win.h" | 48 #include "components/policy/core/common/preg_parser_win.h" |
48 #include "components/policy/core/common/registry_dict_win.h" | 49 #include "components/policy/core/common/registry_dict_win.h" |
49 #include "components/policy/core/common/schema.h" | 50 #include "components/policy/core/common/schema.h" |
50 #include "policy/policy_constants.h" | 51 #include "policy/policy_constants.h" |
51 | 52 |
52 namespace schema = json_schema_constants; | 53 namespace schema = json_schema_constants; |
53 | 54 |
54 namespace policy { | 55 namespace policy { |
55 | 56 |
56 namespace { | 57 namespace { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (!base::LowerCaseEqualsASCII(entry.substr(pos), | 165 if (!base::LowerCaseEqualsASCII(entry.substr(pos), |
165 kExpectedWebStoreUrl)) { | 166 kExpectedWebStoreUrl)) { |
166 entry = kBlockedExtensionPrefix + entry; | 167 entry = kBlockedExtensionPrefix + entry; |
167 invalid_policies++; | 168 invalid_policies++; |
168 } | 169 } |
169 | 170 |
170 filtered_values->AppendString(entry); | 171 filtered_values->AppendString(entry); |
171 } | 172 } |
172 if (invalid_policies) { | 173 if (invalid_policies) { |
173 policy->Set(key::kExtensionInstallForcelist, | 174 policy->Set(key::kExtensionInstallForcelist, |
174 map_entry->level, map_entry->scope, | 175 map_entry->level, map_entry->scope, map_entry->source, |
175 filtered_values.release(), | 176 filtered_values.release(), |
176 map_entry->external_data_fetcher); | 177 map_entry->external_data_fetcher); |
177 | 178 |
178 const PolicyDetails* details = GetChromePolicyDetails( | 179 const PolicyDetails* details = GetChromePolicyDetails( |
179 key::kExtensionInstallForcelist); | 180 key::kExtensionInstallForcelist); |
180 UMA_HISTOGRAM_SPARSE_SLOWLY("EnterpriseCheck.InvalidPolicies", | 181 UMA_HISTOGRAM_SPARSE_SLOWLY("EnterpriseCheck.InvalidPolicies", |
181 details->id); | 182 details->id); |
182 } | 183 } |
183 } | 184 } |
184 | 185 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 if (!gpo_dict) | 323 if (!gpo_dict) |
323 return; | 324 return; |
324 | 325 |
325 scoped_ptr<base::Value> policy_value(gpo_dict->ConvertToJSON(schema)); | 326 scoped_ptr<base::Value> policy_value(gpo_dict->ConvertToJSON(schema)); |
326 const base::DictionaryValue* policy_dict = NULL; | 327 const base::DictionaryValue* policy_dict = NULL; |
327 if (!policy_value->GetAsDictionary(&policy_dict) || !policy_dict) { | 328 if (!policy_value->GetAsDictionary(&policy_dict) || !policy_dict) { |
328 LOG(WARNING) << "Root policy object is not a dictionary!"; | 329 LOG(WARNING) << "Root policy object is not a dictionary!"; |
329 return; | 330 return; |
330 } | 331 } |
331 | 332 |
332 policy->LoadFrom(policy_dict, level, scope); | 333 policy->LoadFrom(policy_dict, level, scope, POLICY_SOURCE_PLATFORM); |
333 } | 334 } |
334 | 335 |
335 // Collects stats about the enterprise environment that can be used to decide | 336 // Collects stats about the enterprise environment that can be used to decide |
336 // how to parse the existing policy information. | 337 // how to parse the existing policy information. |
337 void CollectEnterpriseUMAs() { | 338 void CollectEnterpriseUMAs() { |
338 // Collect statistics about the windows suite. | 339 // Collect statistics about the windows suite. |
339 UMA_HISTOGRAM_ENUMERATION("EnterpriseCheck.OSType", | 340 UMA_HISTOGRAM_ENUMERATION("EnterpriseCheck.OSType", |
340 base::win::OSInfo::GetInstance()->version_type(), | 341 base::win::OSInfo::GetInstance()->version_type(), |
341 base::win::SUITE_LAST); | 342 base::win::SUITE_LAST); |
342 | 343 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 | 690 |
690 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { | 691 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { |
691 DCHECK(object == user_policy_changed_event_.handle() || | 692 DCHECK(object == user_policy_changed_event_.handle() || |
692 object == machine_policy_changed_event_.handle()) | 693 object == machine_policy_changed_event_.handle()) |
693 << "unexpected object signaled policy reload, obj = " | 694 << "unexpected object signaled policy reload, obj = " |
694 << std::showbase << std::hex << object; | 695 << std::showbase << std::hex << object; |
695 Reload(false); | 696 Reload(false); |
696 } | 697 } |
697 | 698 |
698 } // namespace policy | 699 } // namespace policy |
OLD | NEW |