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_ |
11 #define CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_HELPERS_H_ | 11 #define CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_HELPERS_H_ |
12 | 12 |
13 #include <memory> | |
14 #include <string> | 13 #include <string> |
15 #include <vector> | 14 #include <vector> |
16 | 15 |
17 #include "chrome/common/extensions/api/cookies.h" | 16 #include "chrome/common/extensions/api/cookies.h" |
18 #include "net/cookies/cookie_monster.h" | 17 #include "net/cookies/cookie_monster.h" |
19 #include "net/cookies/canonical_cookie.h" | 18 #include "net/cookies/canonical_cookie.h" |
20 | 19 |
21 class Browser; | 20 class Browser; |
22 class Profile; | 21 class Profile; |
23 | 22 |
(...skipping 20 matching lines...) Expand all Loading... |
44 | 43 |
45 // Returns the store ID for a particular user profile. | 44 // Returns the store ID for a particular user profile. |
46 const char* GetStoreIdFromProfile(Profile* profile); | 45 const char* GetStoreIdFromProfile(Profile* profile); |
47 | 46 |
48 // Constructs a new Cookie object representing a cookie as defined by the | 47 // Constructs a new Cookie object representing a cookie as defined by the |
49 // cookies API. | 48 // cookies API. |
50 api::cookies::Cookie CreateCookie(const net::CanonicalCookie& cookie, | 49 api::cookies::Cookie CreateCookie(const net::CanonicalCookie& cookie, |
51 const std::string& store_id); | 50 const std::string& store_id); |
52 | 51 |
53 // Constructs a new CookieStore object as defined by the cookies API. | 52 // Constructs a new CookieStore object as defined by the cookies API. |
54 api::cookies::CookieStore CreateCookieStore( | 53 api::cookies::CookieStore CreateCookieStore(Profile* profile, |
55 Profile* profile, | 54 base::ListValue* tab_ids); |
56 std::unique_ptr<base::ListValue> tab_ids); | |
57 | 55 |
58 // Retrieves all cookies from the given cookie store corresponding to the given | 56 // 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. | 57 // URL. If the URL is empty, all cookies in the cookie store are retrieved. |
60 // This can only be called on the IO thread. | 58 // This can only be called on the IO thread. |
61 void GetCookieListFromStore( | 59 void GetCookieListFromStore( |
62 net::CookieStore* cookie_store, | 60 net::CookieStore* cookie_store, |
63 const GURL& url, | 61 const GURL& url, |
64 const net::CookieMonster::GetCookieListCallback& callback); | 62 const net::CookieMonster::GetCookieListCallback& callback); |
65 | 63 |
66 // Constructs a URL from a cookie's information for use in checking | 64 // Constructs a URL from a cookie's information for use in checking |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // 'foo.bar.com', '.foo.bar.com', and 'baz.foo.bar.com'. | 109 // 'foo.bar.com', '.foo.bar.com', and 'baz.foo.bar.com'. |
112 bool MatchesDomain(const std::string& domain); | 110 bool MatchesDomain(const std::string& domain); |
113 | 111 |
114 const api::cookies::GetAll::Params::Details* details_; | 112 const api::cookies::GetAll::Params::Details* details_; |
115 }; | 113 }; |
116 | 114 |
117 } // namespace cookies_helpers | 115 } // namespace cookies_helpers |
118 } // namespace extensions | 116 } // namespace extensions |
119 | 117 |
120 #endif // CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_HELPERS_H_ | 118 #endif // CHROME_BROWSER_EXTENSIONS_API_COOKIES_COOKIES_HELPERS_H_ |
OLD | NEW |