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 "extensions/browser/api/web_request/web_request_api_helpers.h" | 5 #include "extensions/browser/api/web_request/web_request_api_helpers.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 int64_t* seconds_till_expiry) { | 108 int64_t* seconds_till_expiry) { |
109 // 'Max-Age' is processed first because according to: | 109 // 'Max-Age' is processed first because according to: |
110 // http://tools.ietf.org/html/rfc6265#section-5.3 'Max-Age' attribute | 110 // http://tools.ietf.org/html/rfc6265#section-5.3 'Max-Age' attribute |
111 // overrides 'Expires' attribute. | 111 // overrides 'Expires' attribute. |
112 if (cookie->HasMaxAge() && | 112 if (cookie->HasMaxAge() && |
113 base::StringToInt64(cookie->MaxAge(), seconds_till_expiry)) { | 113 base::StringToInt64(cookie->MaxAge(), seconds_till_expiry)) { |
114 return true; | 114 return true; |
115 } | 115 } |
116 | 116 |
117 Time parsed_expiry_time; | 117 Time parsed_expiry_time; |
118 if (cookie->HasExpires()) { | 118 if (cookie->HasExpires()) |
119 parsed_expiry_time = | 119 parsed_expiry_time = net::cookie_util::ParseCookieTime(cookie->Expires()); |
120 net::cookie_util::ParseCookieExpirationTime(cookie->Expires()); | |
121 } | |
122 | 120 |
123 if (!parsed_expiry_time.is_null()) { | 121 if (!parsed_expiry_time.is_null()) { |
124 *seconds_till_expiry = | 122 *seconds_till_expiry = |
125 ceil((parsed_expiry_time - Time::Now()).InSecondsF()); | 123 ceil((parsed_expiry_time - Time::Now()).InSecondsF()); |
126 return *seconds_till_expiry >= 0; | 124 return *seconds_till_expiry >= 0; |
127 } | 125 } |
128 return false; | 126 return false; |
129 } | 127 } |
130 | 128 |
131 bool NullableEquals(const int* a, const int* b) { | 129 bool NullableEquals(const int* a, const int* b) { |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 for (size_t i = 0; i < kResourceTypeStringsLength; ++i) { | 1315 for (size_t i = 0; i < kResourceTypeStringsLength; ++i) { |
1318 if (type_str == kResourceTypeStrings[i]) { | 1316 if (type_str == kResourceTypeStrings[i]) { |
1319 found = true; | 1317 found = true; |
1320 types->push_back(kResourceTypeValues[i]); | 1318 types->push_back(kResourceTypeValues[i]); |
1321 } | 1319 } |
1322 } | 1320 } |
1323 return found; | 1321 return found; |
1324 } | 1322 } |
1325 | 1323 |
1326 } // namespace extension_web_request_api_helpers | 1324 } // namespace extension_web_request_api_helpers |
OLD | NEW |