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

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

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add todo about not failed trybot Created 5 years, 2 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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 pnacl_path_exists_ = is_valid; 321 pnacl_path_exists_ = is_valid;
322 pnacl_version_string_ = *version; 322 pnacl_version_string_ = *version;
323 MaybeRespondToPage(); 323 MaybeRespondToPage();
324 } 324 }
325 325
326 void CheckVersion(const base::FilePath& pnacl_path, std::string* version) { 326 void CheckVersion(const base::FilePath& pnacl_path, std::string* version) {
327 base::FilePath pnacl_json_path = 327 base::FilePath pnacl_json_path =
328 pnacl_path.AppendASCII("pnacl_public_pnacl_json"); 328 pnacl_path.AppendASCII("pnacl_public_pnacl_json");
329 JSONFileValueDeserializer deserializer(pnacl_json_path); 329 JSONFileValueDeserializer deserializer(pnacl_json_path);
330 std::string error; 330 std::string error;
331 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, &error)); 331 scoped_ptr<base::Value> root = deserializer.Deserialize(NULL, &error);
332 if (!root || !root->IsType(base::Value::TYPE_DICTIONARY)) 332 if (!root || !root->IsType(base::Value::TYPE_DICTIONARY))
333 return; 333 return;
334 334
335 // Now try to get the field. This may leave version empty if the 335 // Now try to get the field. This may leave version empty if the
336 // the "get" fails (no key, or wrong type). 336 // the "get" fails (no key, or wrong type).
337 static_cast<base::DictionaryValue*>(root.get())->GetStringASCII( 337 static_cast<base::DictionaryValue*>(root.get())->GetStringASCII(
338 "pnacl-version", version); 338 "pnacl-version", version);
339 } 339 }
340 340
341 bool CheckPathAndVersion(std::string* version) { 341 bool CheckPathAndVersion(std::string* version) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { 382 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) {
383 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); 383 content::RecordAction(UserMetricsAction("ViewAboutNaCl"));
384 384
385 web_ui->AddMessageHandler(new NaClDomHandler()); 385 web_ui->AddMessageHandler(new NaClDomHandler());
386 386
387 // Set up the about:nacl source. 387 // Set up the about:nacl source.
388 Profile* profile = Profile::FromWebUI(web_ui); 388 Profile* profile = Profile::FromWebUI(web_ui);
389 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); 389 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource());
390 } 390 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698