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 <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 CookieStore cookie_store; | 115 CookieStore cookie_store; |
116 bool rv = CookieStore::Populate(dict, &cookie_store); | 116 bool rv = CookieStore::Populate(dict, &cookie_store); |
117 CHECK(rv); | 117 CHECK(rv); |
118 return cookie_store; | 118 return cookie_store; |
119 } | 119 } |
120 | 120 |
121 void GetCookieListFromStore( | 121 void GetCookieListFromStore( |
122 net::CookieStore* cookie_store, | 122 net::CookieStore* cookie_store, |
123 const GURL& url, | 123 const GURL& url, |
124 const net::CookieMonster::GetCookieListCallback& callback) { | 124 net::CookieMonster::GetCookieListCallback callback) { |
125 DCHECK(cookie_store); | 125 DCHECK(cookie_store); |
126 if (!url.is_empty()) { | 126 if (!url.is_empty()) { |
127 DCHECK(url.is_valid()); | 127 DCHECK(url.is_valid()); |
128 cookie_store->GetAllCookiesForURLAsync(url, callback); | 128 cookie_store->GetAllCookiesForURLAsync(url, std::move(callback)); |
129 } else { | 129 } else { |
130 cookie_store->GetAllCookiesAsync(callback); | 130 cookie_store->GetAllCookiesAsync(std::move(callback)); |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 GURL GetURLFromCanonicalCookie(const net::CanonicalCookie& cookie) { | 134 GURL GetURLFromCanonicalCookie(const net::CanonicalCookie& cookie) { |
135 const std::string& domain_key = cookie.Domain(); | 135 const std::string& domain_key = cookie.Domain(); |
136 const std::string scheme = | 136 const std::string scheme = |
137 cookie.IsSecure() ? url::kHttpsScheme : url::kHttpScheme; | 137 cookie.IsSecure() ? url::kHttpsScheme : url::kHttpScheme; |
138 const std::string host = | 138 const std::string host = |
139 base::StartsWith(domain_key, ".", base::CompareCase::SENSITIVE) | 139 base::StartsWith(domain_key, ".", base::CompareCase::SENSITIVE) |
140 ? domain_key.substr(1) | 140 ? domain_key.substr(1) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (sub_domain == *details_->domain) | 214 if (sub_domain == *details_->domain) |
215 return true; | 215 return true; |
216 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. | 216 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. |
217 sub_domain.erase(0, next_dot); | 217 sub_domain.erase(0, next_dot); |
218 } | 218 } |
219 return false; | 219 return false; |
220 } | 220 } |
221 | 221 |
222 } // namespace cookies_helpers | 222 } // namespace cookies_helpers |
223 } // namespace extensions | 223 } // namespace extensions |
OLD | NEW |