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

Unified Diff: chrome/browser/ui/webui/policy_ui.cc

Issue 58313002: Removed the PolicyDefinitionList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-10-use-registry
Patch Set: rebase 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/ui/webui/policy_ui.cc
diff --git a/chrome/browser/ui/webui/policy_ui.cc b/chrome/browser/ui/webui/policy_ui.cc
index 7494c916efd01298aa59e12b24d92956f22a34e3..9998bfd1bc422f5c6ee782601cc08a88afea1155 100644
--- a/chrome/browser/ui/webui/policy_ui.cc
+++ b/chrome/browser/ui/webui/policy_ui.cc
@@ -35,6 +35,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
#include "components/policy/core/common/policy_namespace.h"
+#include "components/policy/core/common/schema.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
@@ -69,7 +70,6 @@
#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_set.h"
-#include "components/policy/core/common/schema.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
#endif
@@ -547,13 +547,19 @@ void PolicyUIHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns,
void PolicyUIHandler::SendPolicyNames() const {
base::DictionaryValue names;
+ Profile* profile = Profile::FromWebUI(web_ui());
+ policy::SchemaRegistry* registry =
+ policy::SchemaRegistryServiceFactory::GetForContext(
+ profile->GetOriginalProfile());
+ scoped_refptr<policy::SchemaMap> schema_map = registry->schema_map();
+
// Add Chrome policy names.
base::DictionaryValue* chrome_policy_names = new base::DictionaryValue;
- const policy::PolicyDefinitionList* list =
- policy::GetChromePolicyDefinitionList();
- for (const policy::PolicyDefinitionList::Entry* entry = list->begin;
- entry != list->end; ++entry) {
- chrome_policy_names->SetBoolean(entry->name, true);
+ policy::PolicyNamespace chrome_ns(policy::POLICY_DOMAIN_CHROME, "");
+ const policy::Schema* chrome_schema = schema_map->GetSchema(chrome_ns);
+ for (policy::Schema::Iterator it = chrome_schema->GetPropertiesIterator();
+ !it.IsAtEnd(); it.Advance()) {
+ chrome_policy_names->SetBoolean(it.key(), true);
}
names.Set("chromePolicyNames", chrome_policy_names);
@@ -561,17 +567,11 @@ void PolicyUIHandler::SendPolicyNames() const {
// Add extension policy names.
base::DictionaryValue* extension_policy_names = new base::DictionaryValue;
- Profile* profile = Profile::FromWebUI(web_ui());
extensions::ExtensionSystem* extension_system =
extensions::ExtensionSystem::Get(profile);
const ExtensionSet* extensions =
extension_system->extension_service()->extensions();
- policy::SchemaRegistry* registry =
- policy::SchemaRegistryServiceFactory::GetForContext(
- profile->GetOriginalProfile());
- scoped_refptr<policy::SchemaMap> schema_map = registry->schema_map();
-
for (ExtensionSet::const_iterator it = extensions->begin();
it != extensions->end(); ++it) {
const extensions::Extension* extension = it->get();

Powered by Google App Engine
This is Rietveld 408576698