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 // Defines common functionality used by the implementation of the Chrome | 5 // Defines common functionality used by the implementation of the Chrome |
6 // Extensions Cookies API implemented in | 6 // Extensions Cookies API implemented in |
7 // chrome/browser/extensions/api/cookies/cookies_api.cc. This separate interface | 7 // chrome/browser/extensions/api/cookies/cookies_api.cc. This separate interface |
8 // exposes pieces of the API implementation mainly for unit testing purposes. | 8 // exposes pieces of the API implementation mainly for unit testing purposes. |
9 | 9 |
10 #ifndef CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_HELPERS_H_ | 10 #ifndef CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_HELPERS_H_ |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 const std::string& store_id); | 51 const std::string& store_id); |
52 | 52 |
53 // Constructs a new CookieStore object as defined by the cookies API. | 53 // Constructs a new CookieStore object as defined by the cookies API. |
54 api::cookies::CookieStore CreateCookieStore( | 54 api::cookies::CookieStore CreateCookieStore( |
55 Profile* profile, | 55 Profile* profile, |
56 std::unique_ptr<base::ListValue> tab_ids); | 56 std::unique_ptr<base::ListValue> tab_ids); |
57 | 57 |
58 // Retrieves all cookies from the given cookie store corresponding to the given | 58 // Retrieves all cookies from the given cookie store corresponding to the given |
59 // URL. If the URL is empty, all cookies in the cookie store are retrieved. | 59 // URL. If the URL is empty, all cookies in the cookie store are retrieved. |
60 // This can only be called on the IO thread. | 60 // This can only be called on the IO thread. |
61 void GetCookieListFromStore( | 61 void GetCookieListFromStore(net::CookieStore* cookie_store, |
62 net::CookieStore* cookie_store, | 62 const GURL& url, |
63 const GURL& url, | 63 net::CookieMonster::GetCookieListCallback callback); |
64 const net::CookieMonster::GetCookieListCallback& callback); | |
65 | 64 |
66 // Constructs a URL from a cookie's information for use in checking | 65 // Constructs a URL from a cookie's information for use in checking |
67 // a cookie against the extension's host permissions. The Secure | 66 // a cookie against the extension's host permissions. The Secure |
68 // property of the cookie defines the URL scheme, and the cookie's | 67 // property of the cookie defines the URL scheme, and the cookie's |
69 // domain becomes the URL host. | 68 // domain becomes the URL host. |
70 GURL GetURLFromCanonicalCookie( | 69 GURL GetURLFromCanonicalCookie( |
71 const net::CanonicalCookie& cookie); | 70 const net::CanonicalCookie& cookie); |
72 | 71 |
73 // Looks through all cookies in the given cookie store, and appends to the | 72 // Looks through all cookies in the given cookie store, and appends to the |
74 // match vector all the cookies that both match the given URL and cookie details | 73 // match vector all the cookies that both match the given URL and cookie details |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // 'foo.bar.com', '.foo.bar.com', and 'baz.foo.bar.com'. | 110 // 'foo.bar.com', '.foo.bar.com', and 'baz.foo.bar.com'. |
112 bool MatchesDomain(const std::string& domain); | 111 bool MatchesDomain(const std::string& domain); |
113 | 112 |
114 const api::cookies::GetAll::Params::Details* details_; | 113 const api::cookies::GetAll::Params::Details* details_; |
115 }; | 114 }; |
116 | 115 |
117 } // namespace cookies_helpers | 116 } // namespace cookies_helpers |
118 } // namespace extensions | 117 } // namespace extensions |
119 | 118 |
120 #endif // CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_HELPERS_H_ | 119 #endif // CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_HELPERS_H_ |
OLD | NEW |