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

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

Issue 58313002: Removed the PolicyDefinitionList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-10-use-registry
Patch Set: Created 7 years, 1 month 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
Index: chrome/browser/policy/policy_loader_win.cc
diff --git a/chrome/browser/policy/policy_loader_win.cc b/chrome/browser/policy/policy_loader_win.cc
index 451ac0865bea100bded89ff47cc2555f179d2001..db2db870a6d80b6fc7f641b693b81c3047dcf361 100644
--- a/chrome/browser/policy/policy_loader_win.cc
+++ b/chrome/browser/policy/policy_loader_win.cc
@@ -33,6 +33,7 @@
#include "chrome/browser/policy/preg_parser_win.h"
#include "chrome/browser/policy/registry_dict_win.h"
#include "components/json_schema/json_schema_constants.h"
+#include "components/policy/core/common/schema.h"
#include "policy/policy_constants.h"
bartfab (slow) 2013/11/05 18:18:33 Nit 1: Is this still needed? Nit 2: policy/policy
Joao da Silva 2013/11/07 20:27:27 It's not used, removed
namespace schema = json_schema_constants;
@@ -210,12 +211,10 @@ const base::FilePath::CharType PolicyLoaderWin::kPRegFileName[] =
PolicyLoaderWin::PolicyLoaderWin(
scoped_refptr<base::SequencedTaskRunner> task_runner,
- const PolicyDefinitionList* policy_list,
const string16& chrome_policy_key,
AppliedGPOListProvider* gpo_provider)
: AsyncPolicyLoader(task_runner),
is_initialized_(false),
- policy_list_(policy_list),
chrome_policy_key_(chrome_policy_key),
gpo_provider_(gpo_provider),
user_policy_changed_event_(false, false),
@@ -239,10 +238,10 @@ PolicyLoaderWin::~PolicyLoaderWin() {
// static
scoped_ptr<PolicyLoaderWin> PolicyLoaderWin::Create(
- scoped_refptr<base::SequencedTaskRunner> task_runner,
- const PolicyDefinitionList* policy_list) {
+ scoped_refptr<base::SequencedTaskRunner> task_runner) {
return make_scoped_ptr(
- new PolicyLoaderWin(task_runner, policy_list, kRegistryChromePolicyKey,
+ new PolicyLoaderWin(task_runner,
+ kRegistryChromePolicyKey,
g_win_gpo_list_provider.Pointer()));
}
@@ -321,15 +320,20 @@ scoped_ptr<PolicyBundle> PolicyLoaderWin::Load() {
}
void PolicyLoaderWin::BuildChromePolicySchema() {
+ // TODO(joaodasilva): use the Schema directly instead of building this
+ // DictionaryValue.
scoped_ptr<base::DictionaryValue> properties(new base::DictionaryValue());
- for (const PolicyDefinitionList::Entry* e = policy_list_->begin;
- e != policy_list_->end; ++e) {
- const std::string schema_type = GetSchemaTypeForValueType(e->value_type);
+ const Schema* chrome_schema =
+ schema_map()->GetSchema(PolicyNamespace(POLICY_DOMAIN_CHROME, ""));
bartfab (slow) 2013/11/05 18:18:33 #include "components/policy/core/common/policy_nam
Joao da Silva 2013/11/07 20:27:27 Done.
+ for (Schema::Iterator it = chrome_schema->GetPropertiesIterator();
+ !it.IsAtEnd(); it.Advance()) {
+ const std::string schema_type =
+ GetSchemaTypeForValueType(it.schema().type());
scoped_ptr<base::DictionaryValue> entry_schema(new base::DictionaryValue());
entry_schema->SetStringWithoutPathExpansion(json_schema_constants::kType,
schema_type);
- if (e->value_type == base::Value::TYPE_LIST) {
+ if (it.schema().type() == base::Value::TYPE_LIST) {
scoped_ptr<base::DictionaryValue> items_schema(
new base::DictionaryValue());
items_schema->SetStringWithoutPathExpansion(
@@ -337,7 +341,7 @@ void PolicyLoaderWin::BuildChromePolicySchema() {
entry_schema->SetWithoutPathExpansion(json_schema_constants::kItems,
items_schema.release());
}
- properties->SetWithoutPathExpansion(e->name, entry_schema.release());
+ properties->SetWithoutPathExpansion(it.key(), entry_schema.release());
}
chrome_policy_schema_.SetStringWithoutPathExpansion(
json_schema_constants::kType, json_schema_constants::kObject);

Powered by Google App Engine
This is Rietveld 408576698