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

Side by Side Diff: chrome/browser/extensions/extension_cookies_helpers.cc

Issue 2845031: Reland r50296 which removes some uses of CookieMonster on the UI thread. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Get rid of spurious whitespace. Created 10 years, 5 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extension_cookies_helpers.h" 7 #include "chrome/browser/extensions/extension_cookies_helpers.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 const std::string& domain_key = cookie_pair.first; 87 const std::string& domain_key = cookie_pair.first;
88 const net::CookieMonster::CanonicalCookie& cookie = cookie_pair.second; 88 const net::CookieMonster::CanonicalCookie& cookie = cookie_pair.second;
89 const std::string scheme = 89 const std::string scheme =
90 cookie.IsSecure() ? chrome::kHttpsScheme : chrome::kHttpScheme; 90 cookie.IsSecure() ? chrome::kHttpsScheme : chrome::kHttpScheme;
91 const std::string host = 91 const std::string host =
92 domain_key.find('.') != 0 ? domain_key : domain_key.substr(1); 92 domain_key.find('.') != 0 ? domain_key : domain_key.substr(1);
93 return GURL(scheme + chrome::kStandardSchemeSeparator + host + "/"); 93 return GURL(scheme + chrome::kStandardSchemeSeparator + host + "/");
94 } 94 }
95 95
96 void AppendMatchingCookiesToList( 96 void AppendMatchingCookiesToList(
97 net::CookieStore* cookie_store, const std::string& store_id, 97 const net::CookieMonster::CookieList& all_cookies,
98 const std::string& store_id,
98 const GURL& url, const DictionaryValue* details, 99 const GURL& url, const DictionaryValue* details,
99 const Extension* extension, 100 const Extension* extension,
100 ListValue* match_list) { 101 ListValue* match_list) {
101 net::CookieMonster::CookieList all_cookies = GetCookieListFromStore(
102 cookie_store, url);
103 net::CookieMonster::CookieList::const_iterator it; 102 net::CookieMonster::CookieList::const_iterator it;
104 for (it = all_cookies.begin(); it != all_cookies.end(); ++it) { 103 for (it = all_cookies.begin(); it != all_cookies.end(); ++it) {
105 // Ignore any cookie whose domain doesn't match the extension's 104 // Ignore any cookie whose domain doesn't match the extension's
106 // host permissions. 105 // host permissions.
107 GURL cookie_domain_url = GetURLFromCookiePair(*it); 106 GURL cookie_domain_url = GetURLFromCookiePair(*it);
108 if (!extension->HasHostPermission(cookie_domain_url)) 107 if (!extension->HasHostPermission(cookie_domain_url))
109 continue; 108 continue;
110 // Filter the cookie using the match filter. 109 // Filter the cookie using the match filter.
111 extension_cookies_helpers::MatchFilter filter(details); 110 extension_cookies_helpers::MatchFilter filter(details);
112 if (filter.MatchesCookie(*it)) 111 if (filter.MatchesCookie(*it))
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 sub_domain.length() >= filter_value.length();) { 176 sub_domain.length() >= filter_value.length();) {
178 if (sub_domain == filter_value) 177 if (sub_domain == filter_value)
179 return true; 178 return true;
180 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. 179 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot.
181 sub_domain.erase(0, next_dot); 180 sub_domain.erase(0, next_dot);
182 } 181 }
183 return false; 182 return false;
184 } 183 }
185 184
186 } // namespace extension_cookies_helpers 185 } // namespace extension_cookies_helpers
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_cookies_helpers.h ('k') | chrome/browser/extensions/extension_data_deleter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698