| 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 "content/renderer/media/cache_util.h" | 5 #include "content/renderer/media/cache_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 !net::HttpUtil::HasStrongValidators( | 41 !net::HttpUtil::HasStrongValidators( |
| 42 http_version, | 42 http_version, |
| 43 response.httpHeaderField("etag").utf8(), | 43 response.httpHeaderField("etag").utf8(), |
| 44 response.httpHeaderField("Last-Modified").utf8(), | 44 response.httpHeaderField("Last-Modified").utf8(), |
| 45 response.httpHeaderField("Date").utf8())) { | 45 response.httpHeaderField("Date").utf8())) { |
| 46 reasons |= kNoStrongValidatorOnPartialResponse; | 46 reasons |= kNoStrongValidatorOnPartialResponse; |
| 47 } | 47 } |
| 48 | 48 |
| 49 std::string cache_control_header = | 49 std::string cache_control_header = |
| 50 response.httpHeaderField("cache-control").utf8(); | 50 response.httpHeaderField("cache-control").utf8(); |
| 51 StringToLowerASCII(&cache_control_header); | 51 base::StringToLowerASCII(&cache_control_header); |
| 52 if (cache_control_header.find("no-cache") != std::string::npos) | 52 if (cache_control_header.find("no-cache") != std::string::npos) |
| 53 reasons |= kNoCache; | 53 reasons |= kNoCache; |
| 54 if (cache_control_header.find("no-store") != std::string::npos) | 54 if (cache_control_header.find("no-store") != std::string::npos) |
| 55 reasons |= kNoStore; | 55 reasons |= kNoStore; |
| 56 if (cache_control_header.find("must-revalidate") != std::string::npos) | 56 if (cache_control_header.find("must-revalidate") != std::string::npos) |
| 57 reasons |= kHasMustRevalidate; | 57 reasons |= kHasMustRevalidate; |
| 58 | 58 |
| 59 const TimeDelta kMinimumAgeForUsefulness = | 59 const TimeDelta kMinimumAgeForUsefulness = |
| 60 TimeDelta::FromSeconds(3600); // Arbitrary value. | 60 TimeDelta::FromSeconds(3600); // Arbitrary value. |
| 61 | 61 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 78 &expires) && | 78 &expires) && |
| 79 date > Time() && expires > Time() && | 79 date > Time() && expires > Time() && |
| 80 (expires - date) < kMinimumAgeForUsefulness) { | 80 (expires - date) < kMinimumAgeForUsefulness) { |
| 81 reasons |= kExpiresTooSoon; | 81 reasons |= kExpiresTooSoon; |
| 82 } | 82 } |
| 83 | 83 |
| 84 return reasons; | 84 return reasons; |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace content | 87 } // namespace content |
| OLD | NEW |