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: 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: 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 72071e25c70718d37fe5f7a89a7f85ef31f6af5c..a6e31464f9d55f07d4efe5f99184181e21ad0ff6 100644
--- a/chrome/browser/ui/webui/policy_ui.cc
+++ b/chrome/browser/ui/webui/policy_ui.cc
@@ -37,6 +37,8 @@
#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
+#include "components/policy/core/common/policy_details.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"
@@ -66,7 +68,6 @@
#include "chrome/browser/extensions/extension_system.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
@@ -544,13 +545,19 @@ void PolicyUIHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns,
void PolicyUIHandler::SendPolicyNames() const {
base::DictionaryValue names;
+ Profile* profile = Profile::FromWebUI(web_ui());
+ policy::SchemaRegistry* registry =
bartfab (slow) 2013/11/05 18:18:33 Nit: #include "chrome/browser/policy/schema_regist
Joao da Silva 2013/11/07 20:27:27 Done.
+ 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);
@@ -558,17 +565,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