diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 20:58:49 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 20:58:49 +0000 |
commit | e2971684b079e12a1720bb9194bb7d77e5578335 (patch) | |
tree | 85dd287a620ded9a3af47a4feb1e92da1a31423a /chrome/renderer | |
parent | 61e0a026e59376f3366a746c126cf7932e90eb98 (diff) | |
download | chromium_src-e2971684b079e12a1720bb9194bb7d77e5578335.zip chromium_src-e2971684b079e12a1720bb9194bb7d77e5578335.tar.gz chromium_src-e2971684b079e12a1720bb9194bb7d77e5578335.tar.bz2 |
Change ViewHostMsg_SetCookie to be routed so we can show the blocked cookie
notification.
We get the RenderView identifier by looking at the current WebFrame.
This will need to be changed since we do not always have a current
WebFrame (e.g., when processing a <META http-equiv="set-cookie">).
I'd like to proceed with this temporary fix for now since I think it
is actually good enough for a 4.1 release. I'll work to make the
necessary webkit changes to expose the WebFrame properly in parallel.
R=jorlow
BUG=34573
TEST=none
Review URL: http://codereview.chromium.org/605003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38939 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/renderer_webkitclient_impl.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc index 5580ab9..504d8f3 100644 --- a/chrome/renderer/renderer_webkitclient_impl.cc +++ b/chrome/renderer/renderer_webkitclient_impl.cc @@ -1,6 +1,6 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "chrome/renderer/renderer_webkitclient_impl.h" @@ -21,10 +21,12 @@ #include "chrome/plugin/npobject_util.h" #include "chrome/renderer/net/render_dns_master.h" #include "chrome/renderer/render_thread.h" +#include "chrome/renderer/render_view.h" #include "chrome/renderer/renderer_webstoragenamespace_impl.h" #include "chrome/renderer/visitedlink_slave.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/WebKit/chromium/public/WebCookie.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" @@ -43,6 +45,7 @@ using WebKit::WebApplicationCacheHost; using WebKit::WebApplicationCacheHostClient; using WebKit::WebCookie; +using WebKit::WebFrame; using WebKit::WebKitClient; using WebKit::WebStorageArea; using WebKit::WebStorageEventDispatcher; @@ -111,10 +114,21 @@ RendererWebKitClientImpl::createMessagePortChannel() { void RendererWebKitClientImpl::setCookies(const WebURL& url, const WebURL& first_party_for_cookies, const WebString& value) { + // TODO(darin): Modify WebKit to pass the WebFrame. This code may be reached + // when there is no active script context. + int routing_id = MSG_ROUTING_CONTROL; + if (v8::Context::InContext()) { + RenderView* view = + RenderView::FromWebView(WebFrame::frameForCurrentContext()->view()); + DCHECK(view); + routing_id = view->routing_id(); + } + std::string value_utf8; UTF16ToUTF8(value.data(), value.length(), &value_utf8); RenderThread::current()->Send( - new ViewHostMsg_SetCookie(url, first_party_for_cookies, value_utf8)); + new ViewHostMsg_SetCookie(routing_id, url, first_party_for_cookies, + value_utf8)); } WebString RendererWebKitClientImpl::cookies( |