| 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 const ExtensionSet* extensions = | 558 const ExtensionSet* extensions = |
| 559 extension_system->extension_service()->extensions(); | 559 extension_system->extension_service()->extensions(); |
| 560 scoped_refptr<const policy::PolicyDomainDescriptor> policy_domain_descriptor; | 560 scoped_refptr<const policy::PolicyDomainDescriptor> policy_domain_descriptor; |
| 561 policy_domain_descriptor = GetPolicyService()-> | 561 policy_domain_descriptor = GetPolicyService()-> |
| 562 GetPolicyDomainDescriptor(policy::POLICY_DOMAIN_EXTENSIONS); | 562 GetPolicyDomainDescriptor(policy::POLICY_DOMAIN_EXTENSIONS); |
| 563 const policy::PolicyDomainDescriptor::SchemaMap& schema_map = | 563 const policy::PolicyDomainDescriptor::SchemaMap& schema_map = |
| 564 policy_domain_descriptor->components(); | 564 policy_domain_descriptor->components(); |
| 565 | 565 |
| 566 for (ExtensionSet::const_iterator it = extensions->begin(); | 566 for (ExtensionSet::const_iterator it = extensions->begin(); |
| 567 it != extensions->end(); ++it) { | 567 it != extensions->end(); ++it) { |
| 568 const extensions::Extension* extension = *it; | 568 const extensions::Extension* extension = it->get(); |
| 569 // Skip this extension if it's not an enterprise extension. | 569 // Skip this extension if it's not an enterprise extension. |
| 570 if (!extension->manifest()->HasPath( | 570 if (!extension->manifest()->HasPath( |
| 571 extension_manifest_keys::kStorageManagedSchema)) | 571 extension_manifest_keys::kStorageManagedSchema)) |
| 572 continue; | 572 continue; |
| 573 base::DictionaryValue* extension_value = new base::DictionaryValue; | 573 base::DictionaryValue* extension_value = new base::DictionaryValue; |
| 574 extension_value->SetString("name", extension->name()); | 574 extension_value->SetString("name", extension->name()); |
| 575 policy::PolicyDomainDescriptor::SchemaMap::const_iterator schema = | 575 policy::PolicyDomainDescriptor::SchemaMap::const_iterator schema = |
| 576 schema_map.find(extension->id()); | 576 schema_map.find(extension->id()); |
| 577 base::DictionaryValue* policy_names = new base::DictionaryValue; | 577 base::DictionaryValue* policy_names = new base::DictionaryValue; |
| 578 if (schema != schema_map.end()) { | 578 if (schema != schema_map.end()) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 605 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 605 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 606 // Add extension policy values. | 606 // Add extension policy values. |
| 607 extensions::ExtensionSystem* extension_system = | 607 extensions::ExtensionSystem* extension_system = |
| 608 extensions::ExtensionSystem::Get(Profile::FromWebUI(web_ui())); | 608 extensions::ExtensionSystem::Get(Profile::FromWebUI(web_ui())); |
| 609 const ExtensionSet* extensions = | 609 const ExtensionSet* extensions = |
| 610 extension_system->extension_service()->extensions(); | 610 extension_system->extension_service()->extensions(); |
| 611 base::DictionaryValue* extension_values = new base::DictionaryValue; | 611 base::DictionaryValue* extension_values = new base::DictionaryValue; |
| 612 | 612 |
| 613 for (ExtensionSet::const_iterator it = extensions->begin(); | 613 for (ExtensionSet::const_iterator it = extensions->begin(); |
| 614 it != extensions->end(); ++it) { | 614 it != extensions->end(); ++it) { |
| 615 const extensions::Extension* extension = *it; | 615 const extensions::Extension* extension = it->get(); |
| 616 // Skip this extension if it's not an enterprise extension. | 616 // Skip this extension if it's not an enterprise extension. |
| 617 if (!extension->manifest()->HasPath( | 617 if (!extension->manifest()->HasPath( |
| 618 extension_manifest_keys::kStorageManagedSchema)) | 618 extension_manifest_keys::kStorageManagedSchema)) |
| 619 continue; | 619 continue; |
| 620 base::DictionaryValue* extension_policies = new base::DictionaryValue; | 620 base::DictionaryValue* extension_policies = new base::DictionaryValue; |
| 621 policy::PolicyNamespace policy_namespace = policy::PolicyNamespace( | 621 policy::PolicyNamespace policy_namespace = policy::PolicyNamespace( |
| 622 policy::POLICY_DOMAIN_EXTENSIONS, extension->id()); | 622 policy::POLICY_DOMAIN_EXTENSIONS, extension->id()); |
| 623 policy::PolicyErrorMap empty_error_map; | 623 policy::PolicyErrorMap empty_error_map; |
| 624 GetPolicyValues(GetPolicyService()->GetPolicies(policy_namespace), | 624 GetPolicyValues(GetPolicyService()->GetPolicies(policy_namespace), |
| 625 &empty_error_map, extension_policies); | 625 &empty_error_map, extension_policies); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 } | 717 } |
| 718 | 718 |
| 719 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 719 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 720 web_ui->AddMessageHandler(new PolicyUIHandler); | 720 web_ui->AddMessageHandler(new PolicyUIHandler); |
| 721 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), | 721 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), |
| 722 CreatePolicyUIHTMLSource()); | 722 CreatePolicyUIHTMLSource()); |
| 723 } | 723 } |
| 724 | 724 |
| 725 PolicyUI::~PolicyUI() { | 725 PolicyUI::~PolicyUI() { |
| 726 } | 726 } |
| OLD | NEW |