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