| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { |
| 134 net::CookieList::const_iterator it; | 134 net::CookieList::const_iterator it; |
| 135 for (it = all_cookies.begin(); it != all_cookies.end(); ++it) { | 135 for (it = all_cookies.begin(); it != all_cookies.end(); ++it) { |
| 136 // Ignore any cookie whose domain doesn't match the extension's | 136 // Ignore any cookie whose domain doesn't match the extension's |
| 137 // host permissions. | 137 // host permissions. |
| 138 GURL cookie_domain_url = GetURLFromCanonicalCookie(*it); | 138 GURL cookie_domain_url = GetURLFromCanonicalCookie(*it); |
| 139 if (!PermissionsData::HasHostPermission(extension, cookie_domain_url)) | 139 if (!PermissionsData::ForExtension(extension) |
| 140 ->HasHostPermission(cookie_domain_url)) |
| 140 continue; | 141 continue; |
| 141 // Filter the cookie using the match filter. | 142 // Filter the cookie using the match filter. |
| 142 cookies_helpers::MatchFilter filter(details); | 143 cookies_helpers::MatchFilter filter(details); |
| 143 if (filter.MatchesCookie(*it)) { | 144 if (filter.MatchesCookie(*it)) { |
| 144 match_vector->push_back(make_linked_ptr( | 145 match_vector->push_back(make_linked_ptr( |
| 145 CreateCookie(*it, *details->store_id).release())); | 146 CreateCookie(*it, *details->store_id).release())); |
| 146 } | 147 } |
| 147 } | 148 } |
| 148 } | 149 } |
| 149 | 150 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 if (sub_domain == *details_->domain) | 202 if (sub_domain == *details_->domain) |
| 202 return true; | 203 return true; |
| 203 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. | 204 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. |
| 204 sub_domain.erase(0, next_dot); | 205 sub_domain.erase(0, next_dot); |
| 205 } | 206 } |
| 206 return false; | 207 return false; |
| 207 } | 208 } |
| 208 | 209 |
| 209 } // namespace cookies_helpers | 210 } // namespace cookies_helpers |
| 210 } // namespace extensions | 211 } // namespace extensions |
| OLD | NEW |