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 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 Loading... |
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 } |
OLD | NEW |