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

Side by Side Diff: chrome/browser/ui/webui/policy_material_design_ui.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months 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 unified diff | Download patch
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 }; 65 };
66 66
67 PolicyMaterialDesignUIHandler::PolicyMaterialDesignUIHandler() { 67 PolicyMaterialDesignUIHandler::PolicyMaterialDesignUIHandler() {
68 } 68 }
69 69
70 PolicyMaterialDesignUIHandler::~PolicyMaterialDesignUIHandler() { 70 PolicyMaterialDesignUIHandler::~PolicyMaterialDesignUIHandler() {
71 } 71 }
72 72
73 void PolicyMaterialDesignUIHandler::AddPolicyName( 73 void PolicyMaterialDesignUIHandler::AddPolicyName(
74 const std::string& name, base::DictionaryValue* names) const { 74 const std::string& name, base::DictionaryValue* names) const {
75 scoped_ptr<base::ListValue> list(new base::ListValue()); 75 std::unique_ptr<base::ListValue> list(new base::ListValue());
76 const policy::RiskTag* tags = policy::GetChromePolicyDetails(name)->risk_tags; 76 const policy::RiskTag* tags = policy::GetChromePolicyDetails(name)->risk_tags;
77 for (size_t i = 0; i < policy::kMaxRiskTagCount; ++i) { 77 for (size_t i = 0; i < policy::kMaxRiskTagCount; ++i) {
78 if (tags[i] != policy::RISK_TAG_NONE) 78 if (tags[i] != policy::RISK_TAG_NONE)
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()->CallJavascriptFunction("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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/plugins/plugins_ui.h ('k') | chrome/browser/ui/webui/policy_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698