| 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 <ntdsapi.h> // For Ds[Un]Bind | 8 #include <ntdsapi.h> // For Ds[Un]Bind |
| 9 #include <rpc.h> // For struct GUID | 9 #include <rpc.h> // For struct GUID |
| 10 #include <shlwapi.h> // For PathIsUNC() | 10 #include <shlwapi.h> // For PathIsUNC() |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // Collects stats about the enterprise environment that can be used to decide | 288 // Collects stats about the enterprise environment that can be used to decide |
| 289 // how to parse the existing policy information. | 289 // how to parse the existing policy information. |
| 290 void CollectEnterpriseUMAs() { | 290 void CollectEnterpriseUMAs() { |
| 291 // Collect statistics about the windows suite. | 291 // Collect statistics about the windows suite. |
| 292 UMA_HISTOGRAM_ENUMERATION("EnterpriseCheck.OSType", | 292 UMA_HISTOGRAM_ENUMERATION("EnterpriseCheck.OSType", |
| 293 base::win::OSInfo::GetInstance()->version_type(), | 293 base::win::OSInfo::GetInstance()->version_type(), |
| 294 base::win::SUITE_LAST); | 294 base::win::SUITE_LAST); |
| 295 | 295 |
| 296 bool in_domain = base::win::IsEnrolledToDomain(); | 296 bool in_domain = base::win::IsEnrolledToDomain(); |
| 297 UMA_HISTOGRAM_BOOLEAN("EnterpriseCheck.InDomain", in_domain); | 297 UMA_HISTOGRAM_BOOLEAN("EnterpriseCheck.InDomain", in_domain); |
| 298 if (in_domain) { | |
| 299 // This check will tell us how often are domain computers actually | |
| 300 // connected to the enterprise network while Chrome is running. | |
| 301 HANDLE server_bind; | |
| 302 if (ERROR_SUCCESS == ::DsBind(NULL, NULL, &server_bind)) { | |
| 303 UMA_HISTOGRAM_COUNTS("EnterpriseCheck.DomainBindSucceeded", 1); | |
| 304 ::DsUnBind(&server_bind); | |
| 305 } else { | |
| 306 UMA_HISTOGRAM_ENUMERATION("EnterpriseCheck.DomainCheckFailed", | |
| 307 DOMAIN_CHECK_ERROR_DS_BIND, | |
| 308 DOMAIN_CHECK_ERROR_SIZE); | |
| 309 } | |
| 310 } | |
| 311 } | 298 } |
| 312 | 299 |
| 313 } // namespace | 300 } // namespace |
| 314 | 301 |
| 315 const base::FilePath::CharType PolicyLoaderWin::kPRegFileName[] = | 302 const base::FilePath::CharType PolicyLoaderWin::kPRegFileName[] = |
| 316 FILE_PATH_LITERAL("Registry.pol"); | 303 FILE_PATH_LITERAL("Registry.pol"); |
| 317 | 304 |
| 318 PolicyLoaderWin::PolicyLoaderWin( | 305 PolicyLoaderWin::PolicyLoaderWin( |
| 319 scoped_refptr<base::SequencedTaskRunner> task_runner, | 306 scoped_refptr<base::SequencedTaskRunner> task_runner, |
| 320 const base::string16& chrome_policy_key, | 307 const base::string16& chrome_policy_key, |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 606 |
| 620 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { | 607 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { |
| 621 DCHECK(object == user_policy_changed_event_.handle() || | 608 DCHECK(object == user_policy_changed_event_.handle() || |
| 622 object == machine_policy_changed_event_.handle()) | 609 object == machine_policy_changed_event_.handle()) |
| 623 << "unexpected object signaled policy reload, obj = " | 610 << "unexpected object signaled policy reload, obj = " |
| 624 << std::showbase << std::hex << object; | 611 << std::showbase << std::hex << object; |
| 625 Reload(false); | 612 Reload(false); |
| 626 } | 613 } |
| 627 | 614 |
| 628 } // namespace policy | 615 } // namespace policy |
| OLD | NEW |