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

Side by Side Diff: chrome/browser/ui/webui/nacl_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) 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/nacl_ui.h" 5 #include "chrome/browser/ui/webui/nacl_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 299
300 void NaClDomHandler::OnGotPlugins( 300 void NaClDomHandler::OnGotPlugins(
301 const std::vector<content::WebPluginInfo>& plugins) { 301 const std::vector<content::WebPluginInfo>& plugins) {
302 has_plugin_info_ = true; 302 has_plugin_info_ = true;
303 MaybeRespondToPage(); 303 MaybeRespondToPage();
304 } 304 }
305 305
306 void NaClDomHandler::PopulatePageInformation(base::DictionaryValue* naclInfo) { 306 void NaClDomHandler::PopulatePageInformation(base::DictionaryValue* naclInfo) {
307 DCHECK(pnacl_path_validated_); 307 DCHECK(pnacl_path_validated_);
308 // Store Key-Value pairs of about-information. 308 // Store Key-Value pairs of about-information.
309 scoped_ptr<base::ListValue> list(new base::ListValue()); 309 std::unique_ptr<base::ListValue> list(new base::ListValue());
310 // Display the operating system and chrome version information. 310 // Display the operating system and chrome version information.
311 AddOperatingSystemInfo(list.get()); 311 AddOperatingSystemInfo(list.get());
312 // Display the list of plugins serving NaCl. 312 // Display the list of plugins serving NaCl.
313 AddPluginList(list.get()); 313 AddPluginList(list.get());
314 // Display information relevant to PNaCl. 314 // Display information relevant to PNaCl.
315 AddPnaclInfo(list.get()); 315 AddPnaclInfo(list.get());
316 // Display information relevant to NaCl (non-portable. 316 // Display information relevant to NaCl (non-portable.
317 AddNaClInfo(list.get()); 317 AddNaClInfo(list.get());
318 // naclInfo will take ownership of list, and clean it up on destruction. 318 // naclInfo will take ownership of list, and clean it up on destruction.
319 naclInfo->Set("naclInfo", list.release()); 319 naclInfo->Set("naclInfo", list.release());
320 } 320 }
321 321
322 void NaClDomHandler::DidCheckPathAndVersion(const std::string* version, 322 void NaClDomHandler::DidCheckPathAndVersion(const std::string* version,
323 bool is_valid) { 323 bool is_valid) {
324 pnacl_path_validated_ = true; 324 pnacl_path_validated_ = true;
325 pnacl_path_exists_ = is_valid; 325 pnacl_path_exists_ = is_valid;
326 pnacl_version_string_ = *version; 326 pnacl_version_string_ = *version;
327 MaybeRespondToPage(); 327 MaybeRespondToPage();
328 } 328 }
329 329
330 void CheckVersion(const base::FilePath& pnacl_path, std::string* version) { 330 void CheckVersion(const base::FilePath& pnacl_path, std::string* version) {
331 base::FilePath pnacl_json_path = 331 base::FilePath pnacl_json_path =
332 pnacl_path.AppendASCII("pnacl_public_pnacl_json"); 332 pnacl_path.AppendASCII("pnacl_public_pnacl_json");
333 JSONFileValueDeserializer deserializer(pnacl_json_path); 333 JSONFileValueDeserializer deserializer(pnacl_json_path);
334 std::string error; 334 std::string error;
335 scoped_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); 335 std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, &error);
336 if (!root || !root->IsType(base::Value::TYPE_DICTIONARY)) 336 if (!root || !root->IsType(base::Value::TYPE_DICTIONARY))
337 return; 337 return;
338 338
339 // Now try to get the field. This may leave version empty if the 339 // Now try to get the field. This may leave version empty if the
340 // the "get" fails (no key, or wrong type). 340 // the "get" fails (no key, or wrong type).
341 static_cast<base::DictionaryValue*>(root.get())->GetStringASCII( 341 static_cast<base::DictionaryValue*>(root.get())->GetStringASCII(
342 "pnacl-version", version); 342 "pnacl-version", version);
343 } 343 }
344 344
345 bool CheckPathAndVersion(std::string* version) { 345 bool CheckPathAndVersion(std::string* version) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 385
386 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { 386 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) {
387 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); 387 content::RecordAction(UserMetricsAction("ViewAboutNaCl"));
388 388
389 web_ui->AddMessageHandler(new NaClDomHandler()); 389 web_ui->AddMessageHandler(new NaClDomHandler());
390 390
391 // Set up the about:nacl source. 391 // Set up the about:nacl source.
392 Profile* profile = Profile::FromWebUI(web_ui); 392 Profile* profile = Profile::FromWebUI(web_ui);
393 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); 393 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource());
394 } 394 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/mojo_web_ui_controller.h ('k') | chrome/browser/ui/webui/net_export_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698