| 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 "media/blink/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" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "net/http/http_util.h" | 12 #include "net/http/http_util.h" |
| 13 #include "net/http/http_version.h" | 13 #include "net/http/http_version.h" |
| 14 #include "third_party/WebKit/public/platform/WebCString.h" | 14 #include "third_party/WebKit/public/platform/WebCString.h" |
| 15 #include "third_party/WebKit/public/platform/WebString.h" | 15 #include "third_party/WebKit/public/platform/WebString.h" |
| 16 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 16 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 17 | 17 |
| 18 using base::Time; | 18 using base::Time; |
| 19 using base::TimeDelta; | 19 using base::TimeDelta; |
| 20 using net::HttpVersion; | 20 using net::HttpVersion; |
| 21 using blink::WebURLResponse; | 21 using blink::WebURLResponse; |
| 22 | 22 |
| 23 namespace content { | 23 namespace media { |
| 24 | 24 |
| 25 enum { kHttpOK = 200, kHttpPartialContent = 206 }; | 25 enum { kHttpOK = 200, kHttpPartialContent = 206 }; |
| 26 | 26 |
| 27 uint32 GetReasonsForUncacheability(const WebURLResponse& response) { | 27 uint32 GetReasonsForUncacheability(const WebURLResponse& response) { |
| 28 uint32 reasons = 0; | 28 uint32 reasons = 0; |
| 29 const int code = response.httpStatusCode(); | 29 const int code = response.httpStatusCode(); |
| 30 const int version = response.httpVersion(); | 30 const int version = response.httpVersion(); |
| 31 const HttpVersion http_version = | 31 const HttpVersion http_version = |
| 32 version == WebURLResponse::HTTP_1_1 ? HttpVersion(1, 1) : | 32 version == WebURLResponse::HTTP_1_1 ? HttpVersion(1, 1) : |
| 33 version == WebURLResponse::HTTP_1_0 ? HttpVersion(1, 0) : | 33 version == WebURLResponse::HTTP_1_0 ? HttpVersion(1, 0) : |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 Time::FromString(response.httpHeaderField("Expires").utf8().data(), | 77 Time::FromString(response.httpHeaderField("Expires").utf8().data(), |
| 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 media |
| OLD | NEW |