Chromium Code Reviews| Index: chrome/browser/extensions/api/cookies/cookies_helpers.h |
| diff --git a/chrome/browser/extensions/api/cookies/cookies_helpers.h b/chrome/browser/extensions/api/cookies/cookies_helpers.h |
| index 3ece5ba9965e429bc38e5477a9b264dc19bf5fed..c264f20806fa2d6c94f15a8b5773bcf91e9ff2b1 100644 |
| --- a/chrome/browser/extensions/api/cookies/cookies_helpers.h |
| +++ b/chrome/browser/extensions/api/cookies/cookies_helpers.h |
| @@ -12,7 +12,10 @@ |
| #pragma once |
| #include <string> |
| +#include <vector> |
| +#include "base/memory/linked_ptr.h" |
| +#include "chrome/common/extensions/api/cookies.h" |
| #include "net/cookies/cookie_monster.h" |
| class Browser; |
| @@ -39,18 +42,17 @@ Profile* ChooseProfileFromStoreId(const std::string& store_id, |
| // Returns the store ID for a particular user profile. |
| const char* GetStoreIdFromProfile(Profile* profile); |
| -// Constructs a Cookie object as defined by the cookies API. This function |
| -// allocates a new DictionaryValue object; the caller is responsible for |
| -// freeing it. |
| -base::DictionaryValue* CreateCookieValue( |
| +// Allocates and construct a new Cookie object representing a cookie as defined |
| +// by the cookies API. The caller is responsible for freeing it. |
|
Aaron Boodman
2012/07/09 17:34:49
Change this to return scoped_ptr. Then you don't h
mitchellwrosen
2012/07/09 19:36:12
Done.
|
| +extensions::api::cookies::Cookie* CreateCookie( |
| const net::CookieMonster::CanonicalCookie& cookie, |
| const std::string& store_id); |
| -// Constructs a CookieStore object as defined by the cookies API. This function |
| -// allocates a new DictionaryValue object; the caller is responsible for |
| -// freeing it. |
| -base::DictionaryValue* CreateCookieStoreValue(Profile* profile, |
| - base::ListValue* tab_ids); |
| +// Allocates and constructs a new CookieStore object as defined by the cookies |
| +// API. The caller is responsible for freeing it. |
| +extensions::api::cookies::CookieStore* CreateCookieStore( |
| + Profile* profile, |
| + base::ListValue* tab_ids); |
| // Retrieves all cookies from the given cookie store corresponding to the given |
| // URL. If the URL is empty, all cookies in the cookie store are retrieved. |
| @@ -67,14 +69,14 @@ GURL GetURLFromCanonicalCookie( |
| const net::CookieMonster::CanonicalCookie& cookie); |
| // Looks through all cookies in the given cookie store, and appends to the |
| -// match list all the cookies that both match the given URL and cookie details |
| +// match vector all the cookies that both match the given URL and cookie details |
| // and are allowed by extension host permissions. |
| -void AppendMatchingCookiesToList( |
| +void AppendMatchingCookiesToVector( |
| const net::CookieList& all_cookies, |
| - const std::string& store_id, |
| - const GURL& url, const base::DictionaryValue* details, |
| + const GURL& url, |
| + const extensions::api::cookies::GetAll::Params::Details* details, |
| const Extension* extension, |
| - base::ListValue* match_list); |
| + std::vector<linked_ptr<extensions::api::cookies::Cookie> >* match_vector); |
|
Aaron Boodman
2012/07/09 17:34:49
Create a typedef for this.
mitchellwrosen
2012/07/09 19:36:12
Done.
|
| // Appends the IDs of all tabs belonging to the given browser to the |
| // given list. |
| @@ -89,25 +91,16 @@ void AppendToTabIdList(Browser* browser, base::ListValue* tab_ids); |
| class MatchFilter { |
| public: |
| // Takes the details dictionary argument given by the user as input. |
| - // This class does not take ownership of the lifetime of the DictionaryValue |
| + // This class does not take ownership of the lifetime of the Details |
| // object. |
| - explicit MatchFilter(const base::DictionaryValue* details); |
| + explicit MatchFilter( |
| + const extensions::api::cookies::GetAll::Params::Details* details); |
| // Returns true if the given cookie matches the properties in the match |
| // filter. |
| bool MatchesCookie(const net::CookieMonster::CanonicalCookie& cookie); |
| private: |
| - // Returns true if the details dictionary contains a string with the given |
| - // key and value. Also returns true if the dictionary doesn't contain the |
| - // given key at all (trival match). |
| - bool MatchesString(const char* key, const std::string& value); |
| - |
| - // Returns true if the details dictionary contains a boolean with the given |
| - // key and value. Also returns true if the dictionary doesn't contain the |
| - // given key at all (trival match). |
| - bool MatchesBoolean(const char* key, bool value); |
| - |
| // Returns true if the given cookie domain string matches the filter's |
| // domain. Any cookie domain which is equal to or is a subdomain of the |
| // filter's domain will be matched; leading '.' characters indicating |
| @@ -117,7 +110,7 @@ class MatchFilter { |
| // 'foo.bar.com', '.foo.bar.com', and 'baz.foo.bar.com'. |
| bool MatchesDomain(const std::string& domain); |
| - const base::DictionaryValue* details_; |
| + const extensions::api::cookies::GetAll::Params::Details* details_; |
| }; |
| } // namespace cookies_helpers |