summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-20 17:58:32 +0000
committerjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-20 17:58:32 +0000
commit8c1ae5ec4d47638315096f54819793484383c91f (patch)
treec7749cae01663511be911c22e3928f7ef5aa8aab /chrome/browser/net
parente90eca1550812bb5694c9523ffc75963c845d46d (diff)
downloadchromium_src-8c1ae5ec4d47638315096f54819793484383c91f.zip
chromium_src-8c1ae5ec4d47638315096f54819793484383c91f.tar.gz
chromium_src-8c1ae5ec4d47638315096f54819793484383c91f.tar.bz2
Pass in the HostContentSettingsMap to the CookieModalDialog so IsValid can make its decision. Before, it used the TabContents to get the profile to get the map, but this was incorrect because the current tab isn't necessarily from the same profile as the original request.
As long as we have the HostContentSettingsMap, we might as well handle "remember" in CookieModalDialog. This bug exists in 4.1. TEST=none BUG=none Review URL: http://codereview.chromium.org/651023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39558 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/chrome_cookie_policy.cc41
-rw-r--r--chrome/browser/net/chrome_cookie_policy.h3
2 files changed, 17 insertions, 27 deletions
diff --git a/chrome/browser/net/chrome_cookie_policy.cc b/chrome/browser/net/chrome_cookie_policy.cc
index 583328b..e0956fb 100644
--- a/chrome/browser/net/chrome_cookie_policy.cc
+++ b/chrome/browser/net/chrome_cookie_policy.cc
@@ -31,30 +31,29 @@ class ChromeCookiePolicy::PromptDelegate
}
// CookiesPromptViewDelegate methods:
- virtual void AllowSiteData(bool remember, bool session_expire);
- virtual void BlockSiteData(bool remember);
+ virtual void AllowSiteData(bool session_expire);
+ virtual void BlockSiteData();
private:
- void NotifyDone(int policy, bool remember);
+ void NotifyDone(int policy);
scoped_refptr<ChromeCookiePolicy> cookie_policy_;
std::string host_;
};
-void ChromeCookiePolicy::PromptDelegate::AllowSiteData(bool remember,
- bool session_expire) {
+void ChromeCookiePolicy::PromptDelegate::AllowSiteData(bool session_expire) {
int policy = net::OK;
if (session_expire)
policy = net::OK_FOR_SESSION_ONLY;
- NotifyDone(policy, remember);
+ NotifyDone(policy);
}
-void ChromeCookiePolicy::PromptDelegate::BlockSiteData(bool remember) {
- NotifyDone(net::ERR_ACCESS_DENIED, remember);
+void ChromeCookiePolicy::PromptDelegate::BlockSiteData() {
+ NotifyDone(net::ERR_ACCESS_DENIED);
}
-void ChromeCookiePolicy::PromptDelegate::NotifyDone(int policy, bool remember) {
- cookie_policy_->DidPromptForSetCookie(host_, policy, remember);
+void ChromeCookiePolicy::PromptDelegate::NotifyDone(int policy) {
+ cookie_policy_->DidPromptForSetCookie(host_, policy);
delete this;
}
@@ -164,42 +163,34 @@ void ChromeCookiePolicy::PromptForSetCookie(const GURL& url,
// The policy may have changed (due to the "remember" option)
int policy = CheckPolicy(url);
if (policy != net::ERR_IO_PENDING) {
- DidPromptForSetCookie(host, policy, false);
+ DidPromptForSetCookie(host, policy);
return;
}
// Show the prompt on top of the current tab.
Browser* browser = BrowserList::GetLastActive();
if (!browser || !browser->GetSelectedTabContents()) {
- DidPromptForSetCookie(host, net::ERR_ACCESS_DENIED, false);
+ DidPromptForSetCookie(host, net::ERR_ACCESS_DENIED);
return;
}
#if defined(OS_WIN)
- RunCookiePrompt(browser->GetSelectedTabContents(), url, cookie_line,
+ RunCookiePrompt(browser->GetSelectedTabContents(),
+ host_content_settings_map_, url, cookie_line,
new PromptDelegate(this, host));
#else
// TODO(darin): Enable prompting for other ports.
- DidPromptForSetCookie(host, net::ERR_ACCESS_DENIED, false);
+ DidPromptForSetCookie(host, net::ERR_ACCESS_DENIED);
#endif
}
void ChromeCookiePolicy::DidPromptForSetCookie(const std::string& host,
- int policy, bool remember) {
+ int policy) {
if (!ChromeThread::CurrentlyOn(ChromeThread::IO)) {
- // Process the remember flag immediately.
- if (remember) {
- ContentSetting content_setting = CONTENT_SETTING_BLOCK;
- if (policy == net::OK || policy == net::OK_FOR_SESSION_ONLY)
- content_setting = CONTENT_SETTING_ALLOW;
- host_content_settings_map_->SetContentSetting(
- host, CONTENT_SETTINGS_TYPE_COOKIES, content_setting);
- }
-
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(this, &ChromeCookiePolicy::DidPromptForSetCookie,
- host, policy, remember));
+ host, policy));
return;
}
diff --git a/chrome/browser/net/chrome_cookie_policy.h b/chrome/browser/net/chrome_cookie_policy.h
index ae60764..92afcdb 100644
--- a/chrome/browser/net/chrome_cookie_policy.h
+++ b/chrome/browser/net/chrome_cookie_policy.h
@@ -68,8 +68,7 @@ class ChromeCookiePolicy
int CheckPolicy(const GURL& url) const;
void PromptForSetCookie(const GURL& url, const std::string& cookie_line);
- void DidPromptForSetCookie(const std::string& host, int result,
- bool remember);
+ void DidPromptForSetCookie(const std::string& host, int result);
// A map from hostname to callbacks awaiting a cookie policy response.
// This map is only accessed on the IO thread.