summaryrefslogtreecommitdiffstats
path: root/net/base/cookie_policy.h
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-03 19:58:57 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-03 19:58:57 +0000
commita0b0d63b60bbc0675115317a0b08ee4183436787 (patch)
treebe1e255eac2d1e176af658d492bfcf2b28d30ae3 /net/base/cookie_policy.h
parentb24586704bd0ab21ea365bd75eb6ab0ffc1e00ec (diff)
downloadchromium_src-a0b0d63b60bbc0675115317a0b08ee4183436787.zip
chromium_src-a0b0d63b60bbc0675115317a0b08ee4183436787.tar.gz
chromium_src-a0b0d63b60bbc0675115317a0b08ee4183436787.tar.bz2
Back out trunk r37998.
Modify CookiePolicy to work asynchronously This change will enable us to prompt the user before setting a cookie. While we only need to prompt before setting, we actually need to make both CanSetCookie and CanGetCookies asynchronous. This is necessary in order to preserve FIFO ordering since the value returned by GetCookies depends on the changes made to the cookie DB by SetCookie. This change also includes some simplification of CookieStore. Instead of N virtual functions, I distilled it down to only 4. The remaining functions are instead expressed in terms of those. While studying all the places where we currently use CookiePolicy, I found that some of them were not appropriate. After discussing with Amit, I decided to remove the policy checks in URLRequestAutomationJob. See the comments in the code regarding this. I changed the signature of CookieMonster::GetRawCookies to GetAllCookiesForURL to better match GetAllCookies. I also filed a bug about making it even closer in functionality. Related to this change webkit/glue/webcookie.h grows a constructor that takes a CanonicalCookie to help clean up some code. On the Chrome side, ChromeURLRequestContext now has a ChromeCookiePolicy object. That object is threadsafe ref counted because it is passed between the UI and IO threads. It is responsible for implementing the queuing logic described above. It will also in the future trigger the Chrome UI code to actually show the setcookie prompt. Please review the state machinery changes in URLRequestHttpJob carefully. R=eroman BUG=34331 TEST=no tests yet for prompting. Review URL: http://codereview.chromium.org/567015 TBR=darin@chromium.org Review URL: http://codereview.chromium.org/562037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38002 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/cookie_policy.h')
-rw-r--r--net/base/cookie_policy.h27
1 files changed, 7 insertions, 20 deletions
diff --git a/net/base/cookie_policy.h b/net/base/cookie_policy.h
index d2df2f5..91bbfb9 100644
--- a/net/base/cookie_policy.h
+++ b/net/base/cookie_policy.h
@@ -5,32 +5,19 @@
#ifndef NET_BASE_COOKIE_POLICY_H_
#define NET_BASE_COOKIE_POLICY_H_
-#include "net/base/completion_callback.h"
-
class GURL;
namespace net {
class CookiePolicy {
public:
- // Determines if the URL's cookies may be read. Returns OK if allowed to
- // read cookies for the given URL. Returns ERR_IO_PENDING to indicate that
- // the completion callback will be notified (asynchronously and on the
- // current thread) of the final result. Note: The completion callback must
- // remain valid until notified.
- virtual int CanGetCookies(const GURL& url,
- const GURL& first_party_for_cookies,
- CompletionCallback* callback) = 0;
-
- // Determines if the URL's cookies may be written. Returns OK if allowed to
- // write a cookie for the given URL. Returns ERR_IO_PENDING to indicate that
- // the completion callback will be notified (asynchronously and on the
- // current thread) of the final result. Note: The completion callback must
- // remain valid until notified.
- virtual int CanSetCookie(const GURL& url,
- const GURL& first_party_for_cookies,
- const std::string& cookie_line,
- CompletionCallback* callback) = 0;
+ // Determine if the URL's cookies may be read.
+ virtual bool CanGetCookies(const GURL& url,
+ const GURL& first_party_for_cookies) = 0;
+
+ // Determine if the URL's cookies may be written.
+ virtual bool CanSetCookie(const GURL& url,
+ const GURL& first_party_for_cookies) = 0;
protected:
virtual ~CookiePolicy() {}