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 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 if (!success_) | 1613 if (!success_) |
1614 return; | 1614 return; |
1615 | 1615 |
1616 expected_content_length_ = response.expectedContentLength(); | 1616 expected_content_length_ = response.expectedContentLength(); |
1617 | 1617 |
1618 // Defer loading after receiving headers. This is because we may already | 1618 // Defer loading after receiving headers. This is because we may already |
1619 // have a cached translated nexe, so check for that now. | 1619 // have a cached translated nexe, so check for that now. |
1620 url_loader_->setDefersLoading(true); | 1620 url_loader_->setDefersLoading(true); |
1621 | 1621 |
1622 std::string etag = response.httpHeaderField("etag").utf8(); | 1622 std::string etag = response.httpHeaderField("etag").utf8(); |
| 1623 |
| 1624 // Parse the "last-modified" date string. An invalid string will result |
| 1625 // in a base::Time value of 0, which is supported by the only user of |
| 1626 // the |CacheInfo::last_modified| field (see |
| 1627 // pnacl::PnaclTranslationCache::GetKey()). |
1623 std::string last_modified = | 1628 std::string last_modified = |
1624 response.httpHeaderField("last-modified").utf8(); | 1629 response.httpHeaderField("last-modified").utf8(); |
1625 base::Time last_modified_time; | 1630 base::Time last_modified_time; |
1626 base::Time::FromString(last_modified.c_str(), &last_modified_time); | 1631 ignore_result( |
| 1632 base::Time::FromString(last_modified.c_str(), &last_modified_time)); |
1627 | 1633 |
1628 bool has_no_store_header = false; | 1634 bool has_no_store_header = false; |
1629 std::string cache_control = | 1635 std::string cache_control = |
1630 response.httpHeaderField("cache-control").utf8(); | 1636 response.httpHeaderField("cache-control").utf8(); |
1631 | 1637 |
1632 for (const std::string& cur : base::SplitString( | 1638 for (const std::string& cur : base::SplitString( |
1633 cache_control, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { | 1639 cache_control, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
1634 if (base::ToLowerASCII(cur) == "no-store") | 1640 if (base::ToLowerASCII(cur) == "no-store") |
1635 has_no_store_header = true; | 1641 has_no_store_header = true; |
1636 } | 1642 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 // Mark the request as requesting a PNaCl bitcode file, | 1743 // Mark the request as requesting a PNaCl bitcode file, |
1738 // so that component updater can detect this user action. | 1744 // so that component updater can detect this user action. |
1739 url_request.addHTTPHeaderField( | 1745 url_request.addHTTPHeaderField( |
1740 blink::WebString::fromUTF8("Accept"), | 1746 blink::WebString::fromUTF8("Accept"), |
1741 blink::WebString::fromUTF8("application/x-pnacl, */*")); | 1747 blink::WebString::fromUTF8("application/x-pnacl, */*")); |
1742 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); | 1748 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); |
1743 downloader->Load(url_request); | 1749 downloader->Load(url_request); |
1744 } | 1750 } |
1745 | 1751 |
1746 } // namespace nacl | 1752 } // namespace nacl |
OLD | NEW |