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