| 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 // Implements common functionality for the Chrome Extensions Cookies API. | 5 // Implements common functionality for the Chrome Extensions Cookies API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h" | 7 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 DCHECK(url.is_valid()); | 113 DCHECK(url.is_valid()); |
| 114 monster->GetAllCookiesForURLAsync(url, callback); | 114 monster->GetAllCookiesForURLAsync(url, callback); |
| 115 } else { | 115 } else { |
| 116 monster->GetAllCookiesAsync(callback); | 116 monster->GetAllCookiesAsync(callback); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 GURL GetURLFromCanonicalCookie(const net::CanonicalCookie& cookie) { | 120 GURL GetURLFromCanonicalCookie(const net::CanonicalCookie& cookie) { |
| 121 const std::string& domain_key = cookie.Domain(); | 121 const std::string& domain_key = cookie.Domain(); |
| 122 const std::string scheme = | 122 const std::string scheme = |
| 123 cookie.IsSecure() ? content::kHttpsScheme : content::kHttpScheme; | 123 cookie.IsSecure() ? url::kHttpsScheme : url::kHttpScheme; |
| 124 const std::string host = | 124 const std::string host = |
| 125 domain_key.find('.') != 0 ? domain_key : domain_key.substr(1); | 125 domain_key.find('.') != 0 ? domain_key : domain_key.substr(1); |
| 126 return GURL(scheme + content::kStandardSchemeSeparator + host + "/"); | 126 return GURL(scheme + content::kStandardSchemeSeparator + host + "/"); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void AppendMatchingCookiesToVector(const net::CookieList& all_cookies, | 129 void AppendMatchingCookiesToVector(const net::CookieList& all_cookies, |
| 130 const GURL& url, | 130 const GURL& url, |
| 131 const GetAll::Params::Details* details, | 131 const GetAll::Params::Details* details, |
| 132 const Extension* extension, | 132 const Extension* extension, |
| 133 LinkedCookieVec* match_vector) { | 133 LinkedCookieVec* match_vector) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 if (sub_domain == *details_->domain) | 201 if (sub_domain == *details_->domain) |
| 202 return true; | 202 return true; |
| 203 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. | 203 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. |
| 204 sub_domain.erase(0, next_dot); | 204 sub_domain.erase(0, next_dot); |
| 205 } | 205 } |
| 206 return false; | 206 return false; |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace cookies_helpers | 209 } // namespace cookies_helpers |
| 210 } // namespace extensions | 210 } // namespace extensions |
| OLD | NEW |