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