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

Unified Diff: components/policy/core/common/policy_loader_win.cc

Issue 2860973002: Allow PolicyLoadStatusSample to override reporting method (Closed)
Patch Set: Cleanups and class rename. Created 3 years, 7 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
« no previous file with comments | « components/policy/core/common/policy_loader_win.h ('k') | components/policy/core/common/preg_parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/policy_loader_win.cc
diff --git a/components/policy/core/common/policy_loader_win.cc b/components/policy/core/common/policy_loader_win.cc
index b5ff23fa626c82ca4386f317f792f075a5424832..0881e23906819df56fe57eae99c9c12e569cbf8d 100644
--- a/components/policy/core/common/policy_loader_win.cc
+++ b/components/policy/core/common/policy_loader_win.cc
@@ -4,7 +4,6 @@
#include "components/policy/core/common/policy_loader_win.h"
-#include <windows.h>
#include <ntdsapi.h> // For Ds[Un]Bind
#include <rpc.h> // For struct GUID
#include <shlwapi.h> // For PathIsUNC()
@@ -70,7 +69,7 @@ const char* kInsecurePolicies[] = {
key::kRestoreOnStartupURLs};
#pragma warning(push)
-#pragma warning(disable: 4068) // unknown pragmas
+#pragma warning(disable : 4068) // unknown pragmas
// TODO(dcheng): Remove pragma once http://llvm.org/PR24007 is fixed.
#pragma clang diagnostic ignored "-Wmissing-braces"
// The GUID of the registry settings group policy extension.
@@ -132,8 +131,8 @@ void FilterUntrustedPolicy(PolicyMap* policy) {
filtered_entry.value = std::move(filtered_values);
policy->Set(key::kExtensionInstallForcelist, std::move(filtered_entry));
- const PolicyDetails* details = GetChromePolicyDetails(
- key::kExtensionInstallForcelist);
+ const PolicyDetails* details =
+ GetChromePolicyDetails(key::kExtensionInstallForcelist);
UMA_HISTOGRAM_SPARSE_SLOWLY("EnterpriseCheck.InvalidPolicies",
details->id);
}
@@ -159,10 +158,10 @@ void FilterUntrustedPolicy(PolicyMap* policy) {
class Wow64Functions {
public:
Wow64Functions()
- : kernel32_lib_(base::FilePath(L"kernel32")),
- is_wow_64_process_(NULL),
- wow_64_disable_wow_64_fs_redirection_(NULL),
- wow_64_revert_wow_64_fs_redirection_(NULL) {
+ : kernel32_lib_(base::FilePath(L"kernel32")),
+ is_wow_64_process_(NULL),
+ wow_64_disable_wow_64_fs_redirection_(NULL),
+ wow_64_revert_wow_64_fs_redirection_(NULL) {
if (kernel32_lib_.is_valid()) {
is_wow_64_process_ = reinterpret_cast<IsWow64Process>(
kernel32_lib_.GetFunctionPointer("IsWow64Process"));
@@ -178,9 +177,8 @@ class Wow64Functions {
}
bool is_valid() {
- return is_wow_64_process_ &&
- wow_64_disable_wow_64_fs_redirection_ &&
- wow_64_revert_wow_64_fs_redirection_;
+ return is_wow_64_process_ && wow_64_disable_wow_64_fs_redirection_ &&
+ wow_64_revert_wow_64_fs_redirection_;
}
bool IsWow64() {
@@ -199,9 +197,9 @@ class Wow64Functions {
}
private:
- typedef BOOL (WINAPI* IsWow64Process)(HANDLE, PBOOL);
- typedef BOOL (WINAPI* Wow64DisableWow64FSRedirection)(PVOID*);
- typedef BOOL (WINAPI* Wow64RevertWow64FSRedirection)(PVOID);
+ typedef BOOL(WINAPI* IsWow64Process)(HANDLE, PBOOL);
+ typedef BOOL(WINAPI* Wow64DisableWow64FSRedirection)(PVOID*);
+ typedef BOOL(WINAPI* Wow64RevertWow64FSRedirection)(PVOID);
base::ScopedNativeLibrary kernel32_lib_;
@@ -219,9 +217,7 @@ static base::LazyInstance<Wow64Functions>::DestructorAtExit g_wow_64_functions =
// Scoper that switches off Wow64 File System Redirection during its lifetime.
class ScopedDisableWow64Redirection {
public:
- ScopedDisableWow64Redirection()
- : active_(false),
- previous_state_(NULL) {
+ ScopedDisableWow64Redirection() : active_(false), previous_state_(NULL) {
Wow64Functions* wow64 = g_wow_64_functions.Pointer();
if (wow64->is_valid() && wow64->IsWow64()) {
if (wow64->DisableFsRedirection(&previous_state_))
@@ -372,8 +368,8 @@ std::unique_ptr<PolicyBundle> PolicyLoaderWin::Load() {
PolicyScope scope;
HKEY hive;
} kScopes[] = {
- { POLICY_SCOPE_MACHINE, HKEY_LOCAL_MACHINE },
- { POLICY_SCOPE_USER, HKEY_CURRENT_USER },
+ {POLICY_SCOPE_MACHINE, HKEY_LOCAL_MACHINE},
+ {POLICY_SCOPE_USER, HKEY_CURRENT_USER},
};
bool honor_policies = ShouldHonorPolicies();
@@ -386,7 +382,7 @@ std::unique_ptr<PolicyBundle> PolicyLoaderWin::Load() {
&bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()));
for (size_t i = 0; i < arraysize(kScopes); ++i) {
PolicyScope scope = kScopes[i].scope;
- PolicyLoadStatusSample status;
+ PolicyLoadStatusUmaReporter status;
RegistryDict gpo_dict;
// Note: GPO rules mandate a call to EnterCriticalPolicySection() here, and
@@ -434,7 +430,7 @@ std::unique_ptr<PolicyBundle> PolicyLoaderWin::Load() {
bool PolicyLoaderWin::ReadPRegFile(const base::FilePath& preg_file,
RegistryDict* policy,
- PolicyLoadStatusSample* status) {
+ PolicyLoadStatusSampler* status) {
// The following deals with the minor annoyance that Wow64 FS redirection
// might need to be turned off: This is the case if running as a 32-bit
// process on a 64-bit system, in which case Wow64 FS redirection redirects
@@ -462,11 +458,11 @@ bool PolicyLoaderWin::ReadPRegFile(const base::FilePath& preg_file,
bool PolicyLoaderWin::LoadGPOPolicy(PolicyScope scope,
PGROUP_POLICY_OBJECT policy_object_list,
RegistryDict* policy,
- PolicyLoadStatusSample* status) {
+ PolicyLoadStatusSampler* status) {
RegistryDict parsed_policy;
RegistryDict forced_policy;
- for (GROUP_POLICY_OBJECT* policy_object = policy_object_list;
- policy_object; policy_object = policy_object->pNext) {
+ for (GROUP_POLICY_OBJECT* policy_object = policy_object_list; policy_object;
+ policy_object = policy_object->pNext) {
if (policy_object->dwOptions & GPO_FLAG_DISABLE)
continue;
@@ -510,12 +506,12 @@ bool PolicyLoaderWin::LoadGPOPolicy(PolicyScope scope,
bool PolicyLoaderWin::ReadPolicyFromGPO(PolicyScope scope,
RegistryDict* policy,
- PolicyLoadStatusSample* status) {
+ PolicyLoadStatusSampler* status) {
PGROUP_POLICY_OBJECT policy_object_list = NULL;
DWORD flags = scope == POLICY_SCOPE_MACHINE ? GPO_LIST_FLAG_MACHINE : 0;
- if (gpo_provider_->GetAppliedGPOList(
- flags, NULL, NULL, &kRegistrySettingsCSEGUID,
- &policy_object_list) != ERROR_SUCCESS) {
+ if (gpo_provider_->GetAppliedGPOList(flags, NULL, NULL,
+ &kRegistrySettingsCSEGUID,
+ &policy_object_list) != ERROR_SUCCESS) {
PLOG(ERROR) << "GetAppliedGPOList scope " << scope;
status->Add(POLICY_LOAD_STATUS_QUERY_FAILED);
return false;
@@ -553,7 +549,7 @@ void PolicyLoaderWin::Load3rdPartyPolicy(const RegistryDict* gpo_dict,
const char* name;
PolicyDomain domain;
} k3rdPartyDomains[] = {
- { "extensions", POLICY_DOMAIN_EXTENSIONS },
+ {"extensions", POLICY_DOMAIN_EXTENSIONS},
};
// Policy level and corresponding path.
@@ -561,8 +557,8 @@ void PolicyLoaderWin::Load3rdPartyPolicy(const RegistryDict* gpo_dict,
PolicyLevel level;
const char* path;
} kLevels[] = {
- { POLICY_LEVEL_MANDATORY, kKeyMandatory },
- { POLICY_LEVEL_RECOMMENDED, kKeyRecommended },
+ {POLICY_LEVEL_MANDATORY, kKeyMandatory},
+ {POLICY_LEVEL_RECOMMENDED, kKeyRecommended},
};
for (size_t i = 0; i < arraysize(k3rdPartyDomains); i++) {
@@ -574,8 +570,7 @@ void PolicyLoaderWin::Load3rdPartyPolicy(const RegistryDict* gpo_dict,
for (RegistryDict::KeyMap::const_iterator component(
domain_dict->keys().begin());
- component != domain_dict->keys().end();
- ++component) {
+ component != domain_dict->keys().end(); ++component) {
const PolicyNamespace policy_namespace(domain, component->first);
const Schema* schema_from_map = schema_map()->GetSchema(policy_namespace);
@@ -621,8 +616,8 @@ void PolicyLoaderWin::SetupWatches() {
void PolicyLoaderWin::OnObjectSignaled(HANDLE object) {
DCHECK(object == user_policy_changed_event_.handle() ||
object == machine_policy_changed_event_.handle())
- << "unexpected object signaled policy reload, obj = "
- << std::showbase << std::hex << object;
+ << "unexpected object signaled policy reload, obj = " << std::showbase
+ << std::hex << object;
Reload(false);
}
« no previous file with comments | « components/policy/core/common/policy_loader_win.h ('k') | components/policy/core/common/preg_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698