OLD | NEW |
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 <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 pnacl_version_string_ = *version; | 328 pnacl_version_string_ = *version; |
329 MaybeRespondToPage(); | 329 MaybeRespondToPage(); |
330 } | 330 } |
331 | 331 |
332 void CheckVersion(const base::FilePath& pnacl_path, std::string* version) { | 332 void CheckVersion(const base::FilePath& pnacl_path, std::string* version) { |
333 base::FilePath pnacl_json_path = | 333 base::FilePath pnacl_json_path = |
334 pnacl_path.AppendASCII("pnacl_public_pnacl_json"); | 334 pnacl_path.AppendASCII("pnacl_public_pnacl_json"); |
335 JSONFileValueDeserializer deserializer(pnacl_json_path); | 335 JSONFileValueDeserializer deserializer(pnacl_json_path); |
336 std::string error; | 336 std::string error; |
337 std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); | 337 std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); |
338 if (!root || !root->IsType(base::Value::TYPE_DICTIONARY)) | 338 if (!root || !root->IsType(base::Value::Type::DICTIONARY)) |
339 return; | 339 return; |
340 | 340 |
341 // Now try to get the field. This may leave version empty if the | 341 // Now try to get the field. This may leave version empty if the |
342 // the "get" fails (no key, or wrong type). | 342 // the "get" fails (no key, or wrong type). |
343 static_cast<base::DictionaryValue*>(root.get())->GetStringASCII( | 343 static_cast<base::DictionaryValue*>(root.get())->GetStringASCII( |
344 "pnacl-version", version); | 344 "pnacl-version", version); |
345 } | 345 } |
346 | 346 |
347 bool CheckPathAndVersion(std::string* version) { | 347 bool CheckPathAndVersion(std::string* version) { |
348 base::FilePath pnacl_path; | 348 base::FilePath pnacl_path; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 387 |
388 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 388 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
389 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); | 389 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); |
390 | 390 |
391 web_ui->AddMessageHandler(new NaClDomHandler()); | 391 web_ui->AddMessageHandler(new NaClDomHandler()); |
392 | 392 |
393 // Set up the about:nacl source. | 393 // Set up the about:nacl source. |
394 Profile* profile = Profile::FromWebUI(web_ui); | 394 Profile* profile = Profile::FromWebUI(web_ui); |
395 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); | 395 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); |
396 } | 396 } |
OLD | NEW |