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 <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 Loading... |
321 bool is_valid) { | 321 bool is_valid) { |
322 pnacl_path_validated_ = true; | 322 pnacl_path_validated_ = true; |
323 pnacl_path_exists_ = is_valid; | 323 pnacl_path_exists_ = is_valid; |
324 pnacl_version_string_ = *version; | 324 pnacl_version_string_ = *version; |
325 MaybeRespondToPage(); | 325 MaybeRespondToPage(); |
326 } | 326 } |
327 | 327 |
328 void CheckVersion(const base::FilePath& pnacl_path, std::string* version) { | 328 void CheckVersion(const base::FilePath& pnacl_path, std::string* version) { |
329 base::FilePath pnacl_json_path = | 329 base::FilePath pnacl_json_path = |
330 pnacl_path.AppendASCII("pnacl_public_pnacl_json"); | 330 pnacl_path.AppendASCII("pnacl_public_pnacl_json"); |
331 JSONFileValueSerializer serializer(pnacl_json_path); | 331 JSONFileValueDeserializer deserializer(pnacl_json_path); |
332 std::string error; | 332 std::string error; |
333 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, &error)); | 333 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, &error)); |
334 if (!root || !root->IsType(base::Value::TYPE_DICTIONARY)) | 334 if (!root || !root->IsType(base::Value::TYPE_DICTIONARY)) |
335 return; | 335 return; |
336 | 336 |
337 // Now try to get the field. This may leave version empty if the | 337 // Now try to get the field. This may leave version empty if the |
338 // the "get" fails (no key, or wrong type). | 338 // the "get" fails (no key, or wrong type). |
339 static_cast<base::DictionaryValue*>(root.get())->GetStringASCII( | 339 static_cast<base::DictionaryValue*>(root.get())->GetStringASCII( |
340 "pnacl-version", version); | 340 "pnacl-version", version); |
341 } | 341 } |
342 | 342 |
343 bool CheckPathAndVersion(std::string* version) { | 343 bool CheckPathAndVersion(std::string* version) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 384 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
385 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); | 385 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); |
386 | 386 |
387 web_ui->AddMessageHandler(new NaClDomHandler()); | 387 web_ui->AddMessageHandler(new NaClDomHandler()); |
388 | 388 |
389 // Set up the about:nacl source. | 389 // Set up the about:nacl source. |
390 Profile* profile = Profile::FromWebUI(web_ui); | 390 Profile* profile = Profile::FromWebUI(web_ui); |
391 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); | 391 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); |
392 } | 392 } |
OLD | NEW |