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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 358 |
359 void NaClDomHandler::MaybeRespondToPage() { | 359 void NaClDomHandler::MaybeRespondToPage() { |
360 // Don't reply until everything is ready. The page will show a 'loading' | 360 // Don't reply until everything is ready. The page will show a 'loading' |
361 // message until then. | 361 // message until then. |
362 if (!page_has_requested_data_ || !has_plugin_info_) | 362 if (!page_has_requested_data_ || !has_plugin_info_) |
363 return; | 363 return; |
364 | 364 |
365 if (!pnacl_path_validated_) { | 365 if (!pnacl_path_validated_) { |
366 std::string* version_string = new std::string; | 366 std::string* version_string = new std::string; |
367 base::PostTaskWithTraitsAndReplyWithResult( | 367 base::PostTaskWithTraitsAndReplyWithResult( |
368 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 368 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
369 base::TaskPriority::BACKGROUND), | |
370 base::Bind(&CheckPathAndVersion, version_string), | 369 base::Bind(&CheckPathAndVersion, version_string), |
371 base::Bind(&NaClDomHandler::DidCheckPathAndVersion, | 370 base::Bind(&NaClDomHandler::DidCheckPathAndVersion, |
372 weak_ptr_factory_.GetWeakPtr(), | 371 weak_ptr_factory_.GetWeakPtr(), |
373 base::Owned(version_string))); | 372 base::Owned(version_string))); |
374 return; | 373 return; |
375 } | 374 } |
376 | 375 |
377 base::DictionaryValue naclInfo; | 376 base::DictionaryValue naclInfo; |
378 PopulatePageInformation(&naclInfo); | 377 PopulatePageInformation(&naclInfo); |
379 web_ui()->CallJavascriptFunctionUnsafe("nacl.returnNaClInfo", naclInfo); | 378 web_ui()->CallJavascriptFunctionUnsafe("nacl.returnNaClInfo", naclInfo); |
380 } | 379 } |
381 | 380 |
382 } // namespace | 381 } // namespace |
383 | 382 |
384 /////////////////////////////////////////////////////////////////////////////// | 383 /////////////////////////////////////////////////////////////////////////////// |
385 // | 384 // |
386 // NaClUI | 385 // NaClUI |
387 // | 386 // |
388 /////////////////////////////////////////////////////////////////////////////// | 387 /////////////////////////////////////////////////////////////////////////////// |
389 | 388 |
390 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 389 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
391 base::RecordAction(UserMetricsAction("ViewAboutNaCl")); | 390 base::RecordAction(UserMetricsAction("ViewAboutNaCl")); |
392 | 391 |
393 web_ui->AddMessageHandler(base::MakeUnique<NaClDomHandler>()); | 392 web_ui->AddMessageHandler(base::MakeUnique<NaClDomHandler>()); |
394 | 393 |
395 // Set up the about:nacl source. | 394 // Set up the about:nacl source. |
396 Profile* profile = Profile::FromWebUI(web_ui); | 395 Profile* profile = Profile::FromWebUI(web_ui); |
397 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); | 396 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); |
398 } | 397 } |
OLD | NEW |