OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_material_design_ui.h" | 5 #include "chrome/browser/ui/webui/policy_material_design_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 list->AppendString(kPolicyRiskTags[tags[i]].key); | 79 list->AppendString(kPolicyRiskTags[tags[i]].key); |
80 } | 80 } |
81 names->Set(name, std::move(list)); | 81 names->Set(name, std::move(list)); |
82 } | 82 } |
83 | 83 |
84 void PolicyMaterialDesignUIHandler::SendPolicyNames() const { | 84 void PolicyMaterialDesignUIHandler::SendPolicyNames() const { |
85 base::ListValue tags; | 85 base::ListValue tags; |
86 for (size_t tag = 0; tag < policy::RISK_TAG_COUNT; ++tag) | 86 for (size_t tag = 0; tag < policy::RISK_TAG_COUNT; ++tag) |
87 tags.AppendString(kPolicyRiskTags[tag].key); | 87 tags.AppendString(kPolicyRiskTags[tag].key); |
88 | 88 |
89 web_ui()->CallJavascriptFunction("policy.Page.setPolicyGroups", tags); | 89 web_ui()->CallJavascriptFunctionUnsafe("policy.Page.setPolicyGroups", tags); |
90 PolicyUIHandler::SendPolicyNames(); | 90 PolicyUIHandler::SendPolicyNames(); |
91 } | 91 } |
92 | 92 |
93 PolicyMaterialDesignUI::PolicyMaterialDesignUI(content::WebUI* web_ui) : | 93 PolicyMaterialDesignUI::PolicyMaterialDesignUI(content::WebUI* web_ui) : |
94 WebUIController(web_ui) { | 94 WebUIController(web_ui) { |
95 web_ui->AddMessageHandler(new PolicyMaterialDesignUIHandler); | 95 web_ui->AddMessageHandler(new PolicyMaterialDesignUIHandler); |
96 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), | 96 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), |
97 CreatePolicyMaterialDesignUIHtmlSource()); | 97 CreatePolicyMaterialDesignUIHtmlSource()); |
98 } | 98 } |
99 | 99 |
100 PolicyMaterialDesignUI::~PolicyMaterialDesignUI() { | 100 PolicyMaterialDesignUI::~PolicyMaterialDesignUI() { |
101 } | 101 } |
OLD | NEW |