OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/renderer/ppb_nacl_private.h" | 5 #include "components/nacl/renderer/ppb_nacl_private.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 DCHECK(load_manager); | 1462 DCHECK(load_manager); |
1463 if (!load_manager) { | 1463 if (!load_manager) { |
1464 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1464 base::ThreadTaskRunnerHandle::Get()->PostTask( |
1465 FROM_HERE, base::Bind(callback, static_cast<int32_t>(PP_ERROR_FAILED), | 1465 FROM_HERE, base::Bind(callback, static_cast<int32_t>(PP_ERROR_FAILED), |
1466 kInvalidNaClFileInfo)); | 1466 kInvalidNaClFileInfo)); |
1467 return; | 1467 return; |
1468 } | 1468 } |
1469 | 1469 |
1470 // Handle special PNaCl support files which are installed on the user's | 1470 // Handle special PNaCl support files which are installed on the user's |
1471 // machine. | 1471 // machine. |
1472 if (url.find(kPNaClTranslatorBaseUrl, 0) == 0) { | 1472 if (base::StartsWith(url, kPNaClTranslatorBaseUrl, |
| 1473 base::CompareCase::SENSITIVE)) { |
1473 PP_NaClFileInfo file_info = kInvalidNaClFileInfo; | 1474 PP_NaClFileInfo file_info = kInvalidNaClFileInfo; |
1474 PP_FileHandle handle = GetReadonlyPnaclFd(url.c_str(), | 1475 PP_FileHandle handle = GetReadonlyPnaclFd(url.c_str(), |
1475 false /* is_executable */, | 1476 false /* is_executable */, |
1476 &file_info.token_lo, | 1477 &file_info.token_lo, |
1477 &file_info.token_hi); | 1478 &file_info.token_hi); |
1478 if (handle == PP_kInvalidFileHandle) { | 1479 if (handle == PP_kInvalidFileHandle) { |
1479 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1480 base::ThreadTaskRunnerHandle::Get()->PostTask( |
1480 FROM_HERE, base::Bind(callback, static_cast<int32_t>(PP_ERROR_FAILED), | 1481 FROM_HERE, base::Bind(callback, static_cast<int32_t>(PP_ERROR_FAILED), |
1481 kInvalidNaClFileInfo)); | 1482 kInvalidNaClFileInfo)); |
1482 return; | 1483 return; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 // Mark the request as requesting a PNaCl bitcode file, | 1744 // Mark the request as requesting a PNaCl bitcode file, |
1744 // so that component updater can detect this user action. | 1745 // so that component updater can detect this user action. |
1745 url_request.addHTTPHeaderField( | 1746 url_request.addHTTPHeaderField( |
1746 blink::WebString::fromUTF8("Accept"), | 1747 blink::WebString::fromUTF8("Accept"), |
1747 blink::WebString::fromUTF8("application/x-pnacl, */*")); | 1748 blink::WebString::fromUTF8("application/x-pnacl, */*")); |
1748 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); | 1749 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); |
1749 downloader->Load(url_request); | 1750 downloader->Load(url_request); |
1750 } | 1751 } |
1751 | 1752 |
1752 } // namespace nacl | 1753 } // namespace nacl |
OLD | NEW |