OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/policy_ui.h" | 5 #include "chrome/browser/ui/webui/policy_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 const policy::PolicyMap& current) { | 606 const policy::PolicyMap& current) { |
607 SendPolicyValues(); | 607 SendPolicyValues(); |
608 } | 608 } |
609 | 609 |
610 void PolicyUIHandler::SendPolicyNames() const { | 610 void PolicyUIHandler::SendPolicyNames() const { |
611 base::DictionaryValue names; | 611 base::DictionaryValue names; |
612 | 612 |
613 Profile* profile = Profile::FromWebUI(web_ui()); | 613 Profile* profile = Profile::FromWebUI(web_ui()); |
614 policy::SchemaRegistry* registry = | 614 policy::SchemaRegistry* registry = |
615 policy::SchemaRegistryServiceFactory::GetForContext( | 615 policy::SchemaRegistryServiceFactory::GetForContext( |
616 profile->GetOriginalProfile()); | 616 profile->GetOriginalProfile())->registry(); |
617 scoped_refptr<policy::SchemaMap> schema_map = registry->schema_map(); | 617 scoped_refptr<policy::SchemaMap> schema_map = registry->schema_map(); |
618 | 618 |
619 // Add Chrome policy names. | 619 // Add Chrome policy names. |
620 base::DictionaryValue* chrome_policy_names = new base::DictionaryValue; | 620 base::DictionaryValue* chrome_policy_names = new base::DictionaryValue; |
621 policy::PolicyNamespace chrome_ns(policy::POLICY_DOMAIN_CHROME, ""); | 621 policy::PolicyNamespace chrome_ns(policy::POLICY_DOMAIN_CHROME, ""); |
622 const policy::Schema* chrome_schema = schema_map->GetSchema(chrome_ns); | 622 const policy::Schema* chrome_schema = schema_map->GetSchema(chrome_ns); |
623 for (policy::Schema::Iterator it = chrome_schema->GetPropertiesIterator(); | 623 for (policy::Schema::Iterator it = chrome_schema->GetPropertiesIterator(); |
624 !it.IsAtEnd(); it.Advance()) { | 624 !it.IsAtEnd(); it.Advance()) { |
625 chrome_policy_names->SetBoolean(it.key(), true); | 625 chrome_policy_names->SetBoolean(it.key(), true); |
626 } | 626 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 } | 788 } |
789 | 789 |
790 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 790 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
791 web_ui->AddMessageHandler(new PolicyUIHandler); | 791 web_ui->AddMessageHandler(new PolicyUIHandler); |
792 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), | 792 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), |
793 CreatePolicyUIHTMLSource()); | 793 CreatePolicyUIHTMLSource()); |
794 } | 794 } |
795 | 795 |
796 PolicyUI::~PolicyUI() { | 796 PolicyUI::~PolicyUI() { |
797 } | 797 } |
OLD | NEW |