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

Unified Diff: chrome/browser/policy/policy_loader_mac.cc

Issue 24367003: Refactored users of PolicySchema to use the new policy::Schema class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 3 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 | « chrome/browser/policy/policy_loader_mac.h ('k') | chrome/browser/policy/policy_service_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/policy_loader_mac.cc
diff --git a/chrome/browser/policy/policy_loader_mac.cc b/chrome/browser/policy/policy_loader_mac.cc
index 29774f0e4526f838f5e1f33740d0dbfae963fddd..2d8e220831095362b3ee73635b829dda9e8fe039 100644
--- a/chrome/browser/policy/policy_loader_mac.cc
+++ b/chrome/browser/policy/policy_loader_mac.cc
@@ -21,7 +21,7 @@
#include "chrome/browser/policy/policy_load_status.h"
#include "chrome/browser/policy/policy_map.h"
#include "chrome/browser/policy/preferences_mac.h"
-#include "components/policy/core/common/policy_schema.h"
+#include "components/policy/core/common/schema.h"
#include "policy/policy_constants.h"
using base::mac::CFCast;
@@ -210,29 +210,22 @@ void PolicyLoaderMac::LoadPolicyForDomain(
void PolicyLoaderMac::LoadPolicyForComponent(
const std::string& bundle_id_string,
- const PolicySchema* schema,
+ Schema schema,
PolicyMap* policy) {
// TODO(joaodasilva): extensions may be registered in a PolicyDomainDescriptor
- // without a PolicySchema, to allow a graceful update of the Legacy Browser
- // Support extension on Windows. Remove this temporary check once that support
- // is removed.
- if (!schema)
+ // without a schema, to allow a graceful update of the Legacy Browser Support
+ // extension on Windows. Remove this check once that support is removed.
+ if (!schema.valid())
return;
base::ScopedCFTypeRef<CFStringRef> bundle_id(
base::SysUTF8ToCFStringRef(bundle_id_string));
preferences_->AppSynchronize(bundle_id);
- const PolicySchemaMap* map = schema->GetProperties();
- if (!map) {
- NOTREACHED();
- return;
- }
-
- for (PolicySchemaMap::const_iterator it = map->begin();
- it != map->end(); ++it) {
+ for (Schema::Iterator it = schema.GetPropertiesIterator();
+ !it.IsAtEnd(); it.Advance()) {
base::ScopedCFTypeRef<CFStringRef> pref_name(
- base::SysUTF8ToCFStringRef(it->first));
+ base::SysUTF8ToCFStringRef(it.key()));
base::ScopedCFTypeRef<CFPropertyListRef> value(
preferences_->CopyAppValue(pref_name, bundle_id));
if (!value.get())
@@ -242,9 +235,10 @@ void PolicyLoaderMac::LoadPolicyForComponent(
PolicyLevel level = forced ? POLICY_LEVEL_MANDATORY :
POLICY_LEVEL_RECOMMENDED;
scoped_ptr<base::Value> policy_value(CreateValueFromProperty(value));
- if (policy_value)
- policy->Set(it->first, level, POLICY_SCOPE_USER,
+ if (policy_value) {
+ policy->Set(it.key(), level, POLICY_SCOPE_USER,
policy_value.release(), NULL);
+ }
}
}
« no previous file with comments | « chrome/browser/policy/policy_loader_mac.h ('k') | chrome/browser/policy/policy_service_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698