Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: chrome/browser/extensions/api/cookies/cookies_helpers.cc

Issue 315573003: Remove PermissionsData::ForExtension() completely (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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::ForExtension(extension) 139 if (!extension->permissions_data()->HasHostPermission(cookie_domain_url))
140 ->HasHostPermission(cookie_domain_url))
141 continue; 140 continue;
142 // Filter the cookie using the match filter. 141 // Filter the cookie using the match filter.
143 cookies_helpers::MatchFilter filter(details); 142 cookies_helpers::MatchFilter filter(details);
144 if (filter.MatchesCookie(*it)) { 143 if (filter.MatchesCookie(*it)) {
145 match_vector->push_back(make_linked_ptr( 144 match_vector->push_back(make_linked_ptr(
146 CreateCookie(*it, *details->store_id).release())); 145 CreateCookie(*it, *details->store_id).release()));
147 } 146 }
148 } 147 }
149 } 148 }
150 149
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (sub_domain == *details_->domain) 201 if (sub_domain == *details_->domain)
203 return true; 202 return true;
204 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.
205 sub_domain.erase(0, next_dot); 204 sub_domain.erase(0, next_dot);
206 } 205 }
207 return false; 206 return false;
208 } 207 }
209 208
210 } // namespace cookies_helpers 209 } // namespace cookies_helpers
211 } // namespace extensions 210 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698