summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-18 23:04:40 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-18 23:04:40 +0000
commitfcbff851ba11ef0b8c26344c47a07037d782f436 (patch)
treec4ad6d0aef6b71fdfba235fafdd481ff2efa7c60 /chrome/browser/net
parentc020ddcd758257c58849298027f6ca9dd5554efe (diff)
downloadchromium_src-fcbff851ba11ef0b8c26344c47a07037d782f436.zip
chromium_src-fcbff851ba11ef0b8c26344c47a07037d782f436.tar.gz
chromium_src-fcbff851ba11ef0b8c26344c47a07037d782f436.tar.bz2
The PromptDelegate needs to delete itself once it gets a reply.
R=jorlow BUG=none TEST=none Review URL: http://codereview.chromium.org/646021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/chrome_cookie_policy.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/chrome/browser/net/chrome_cookie_policy.cc b/chrome/browser/net/chrome_cookie_policy.cc
index b825257..583328b 100644
--- a/chrome/browser/net/chrome_cookie_policy.cc
+++ b/chrome/browser/net/chrome_cookie_policy.cc
@@ -20,6 +20,8 @@ static const size_t kMaxCompletionsPerHost = 10000;
// ----------------------------------------------------------------------------
+// ChromeCookiePolicy cannot just subclass the delegate interface because we
+// may have several prompts pending.
class ChromeCookiePolicy::PromptDelegate
: public CookiePromptModalDialogDelegate {
public:
@@ -33,6 +35,8 @@ class ChromeCookiePolicy::PromptDelegate
virtual void BlockSiteData(bool remember);
private:
+ void NotifyDone(int policy, bool remember);
+
scoped_refptr<ChromeCookiePolicy> cookie_policy_;
std::string host_;
};
@@ -42,12 +46,16 @@ void ChromeCookiePolicy::PromptDelegate::AllowSiteData(bool remember,
int policy = net::OK;
if (session_expire)
policy = net::OK_FOR_SESSION_ONLY;
- cookie_policy_->DidPromptForSetCookie(host_, policy, remember);
+ NotifyDone(policy, remember);
}
void ChromeCookiePolicy::PromptDelegate::BlockSiteData(bool remember) {
- cookie_policy_->DidPromptForSetCookie(host_, net::ERR_ACCESS_DENIED,
- remember);
+ NotifyDone(net::ERR_ACCESS_DENIED, remember);
+}
+
+void ChromeCookiePolicy::PromptDelegate::NotifyDone(int policy, bool remember) {
+ cookie_policy_->DidPromptForSetCookie(host_, policy, remember);
+ delete this;
}
// ----------------------------------------------------------------------------