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

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

Issue 2251263003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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) 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_handler.h" 5 #include "chrome/browser/ui/webui/policy_ui_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 dict->SetString("domain", gaia::ExtractDomainName(username)); 167 dict->SetString("domain", gaia::ExtractDomainName(username));
168 } 168 }
169 169
170 // Utility function that returns a JSON serialization of the given |dict|. 170 // Utility function that returns a JSON serialization of the given |dict|.
171 std::unique_ptr<base::StringValue> DictionaryToJSONString( 171 std::unique_ptr<base::StringValue> DictionaryToJSONString(
172 const base::DictionaryValue& dict) { 172 const base::DictionaryValue& dict) {
173 std::string json_string; 173 std::string json_string;
174 base::JSONWriter::WriteWithOptions(dict, 174 base::JSONWriter::WriteWithOptions(dict,
175 base::JSONWriter::OPTIONS_PRETTY_PRINT, 175 base::JSONWriter::OPTIONS_PRETTY_PRINT,
176 &json_string); 176 &json_string);
177 return base::WrapUnique(new base::StringValue(json_string)); 177 return base::MakeUnique<base::StringValue>(json_string);
178 } 178 }
179 179
180 // Returns a copy of |value| with some values converted to a representation that 180 // Returns a copy of |value| with some values converted to a representation that
181 // i18n_template.js will display in a nicer way. 181 // i18n_template.js will display in a nicer way.
182 std::unique_ptr<base::Value> CopyAndConvert(const base::Value* value) { 182 std::unique_ptr<base::Value> CopyAndConvert(const base::Value* value) {
183 const base::DictionaryValue* dict = NULL; 183 const base::DictionaryValue* dict = NULL;
184 if (value->GetAsDictionary(&dict)) 184 if (value->GetAsDictionary(&dict))
185 return DictionaryToJSONString(*dict); 185 return DictionaryToJSONString(*dict);
186 186
187 std::unique_ptr<base::Value> copy = value->CreateDeepCopy(); 187 std::unique_ptr<base::Value> copy = value->CreateDeepCopy();
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 } 743 }
744 744
745 void PolicyUIHandler::OnRefreshPoliciesDone() const { 745 void PolicyUIHandler::OnRefreshPoliciesDone() const {
746 web_ui()->CallJavascriptFunctionUnsafe("policy.Page.reloadPoliciesDone"); 746 web_ui()->CallJavascriptFunctionUnsafe("policy.Page.reloadPoliciesDone");
747 } 747 }
748 748
749 policy::PolicyService* PolicyUIHandler::GetPolicyService() const { 749 policy::PolicyService* PolicyUIHandler::GetPolicyService() const {
750 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext( 750 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext(
751 web_ui()->GetWebContents()->GetBrowserContext())->policy_service(); 751 web_ui()->GetWebContents()->GetBrowserContext())->policy_service();
752 } 752 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698