summaryrefslogtreecommitdiffstats
path: root/chrome_frame/chrome_frame_activex_base.h
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 19:13:00 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 19:13:00 +0000
commit70daf0b18defd88e97f5f9ebcc9486c22898b66b (patch)
tree71e5c7cd9c7733ecafd589e8be81a67c67b2070a /chrome_frame/chrome_frame_activex_base.h
parent47b950579d39dc79127c1dc69f44c33c8ad269b0 (diff)
downloadchromium_src-70daf0b18defd88e97f5f9ebcc9486c22898b66b.zip
chromium_src-70daf0b18defd88e97f5f9ebcc9486c22898b66b.tar.gz
chromium_src-70daf0b18defd88e97f5f9ebcc9486c22898b66b.tar.bz2
ChromeFrame should honor the host browser's cookie policy. To achieve this we always read the cookies from
the host browser when the renderer requests them. This also cleans up the mess with the host network stack code parsing cookies from the host looking for persistent cookies. Fixes bug http://code.google.com/p/chromium/issues/detail?id=34151 Bug=34151 Test=Covered by existing host network stack tests and chrome frame cookie tests. Review URL: http://codereview.chromium.org/661290 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40402 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_frame_activex_base.h')
-rw-r--r--chrome_frame/chrome_frame_activex_base.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h
index 6d27604..487a3f6 100644
--- a/chrome_frame/chrome_frame_activex_base.h
+++ b/chrome_frame/chrome_frame_activex_base.h
@@ -492,9 +492,14 @@ END_MSG_MAP()
// Verify if the cookie is being deleted. The cookie format is as below
// value[; expires=date][; domain=domain][; path=path][; secure]
// If the first semicolon appears immediately after the name= string,
- // it means that the cookie is being deleted.
- if (!parsed_cookie.Value().empty())
+ // it means that the cookie is being deleted, in which case we should
+ // pass the data as is to the InternetSetCookie function.
+ if (!parsed_cookie.Value().empty()) {
+ name.clear();
+ data = cookie;
+ } else {
data = cookie.substr(name_end + 1);
+ }
} else {
data = cookie;
}
@@ -504,6 +509,34 @@ END_MSG_MAP()
DCHECK(ret) << "InternetSetcookie failed. Error: " << GetLastError();
}
+ virtual void OnGetCookiesFromHost(int tab_handle, const GURL& url,
+ int cookie_id) {
+ DWORD cookie_size = 0;
+ bool success = true;
+ std::string cookie_string;
+ InternetGetCookieA(url.spec().c_str(), NULL, NULL, &cookie_size);
+ if (cookie_size) {
+ scoped_array<char> cookies(new char[cookie_size + 1]);
+ if (!InternetGetCookieA(url.spec().c_str(), NULL, cookies.get(),
+ &cookie_size)) {
+ success = false;
+ NOTREACHED() << "InternetGetCookie failed. Error: " << GetLastError();
+ } else {
+ cookie_string = cookies.get();
+ }
+ } else {
+ success = false;
+ DLOG(INFO) << "InternetGetCookie failed. Error: " << GetLastError();
+ }
+
+ if (automation_client_->automation_server()) {
+ automation_client_->automation_server()->Send(
+ new AutomationMsg_GetCookiesHostResponse(0, tab_handle, success,
+ url, cookie_string,
+ cookie_id));
+ }
+ }
+
virtual void OnAttachExternalTab(int tab_handle,
intptr_t cookie,
int disposition) {