Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: Source/WebKit/chromium/src/WebHelperPluginImpl.cpp

Issue 12575006: Merge 145319 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/WebKit/chromium/src/WebHelperPluginImpl.cpp
===================================================================
--- Source/WebKit/chromium/src/WebHelperPluginImpl.cpp (revision 145645)
+++ Source/WebKit/chromium/src/WebHelperPluginImpl.cpp (working copy)
@@ -40,6 +40,7 @@
#include "Page.h"
#include "PageWidgetDelegate.h"
#include "Settings.h"
+#include "WebDocument.h"
#include "WebFrameImpl.h"
#include "WebPlugin.h"
#include "WebPluginContainerImpl.h"
@@ -59,11 +60,15 @@
writer.addData(str8.data(), str8.length());
}
-void writeDocument(WebCore::DocumentWriter& writer, const String& pluginType)
+void writeDocument(const String& pluginType, const WebDocument& hostDocument, WebCore::DocumentWriter& writer)
{
+ // Give the new document the same URL as the hose document so that content
+ // settings and other decisions can be made based on the correct origin.
+ const WebURL& url = hostDocument.url();
+
writer.setMIMEType("text/html");
writer.setEncoding("UTF-8", false);
- writer.begin();
+ writer.begin(url);
addLiteral("<!DOCTYPE html><head><meta charset='UTF-8'></head><body>\n", writer);
String objectTag = "<object type=\"" + pluginType + "\"></object>";
@@ -115,12 +120,12 @@
ASSERT(!m_page);
}
-bool WebHelperPluginImpl::initialize(WebViewImpl* webView, const String& pluginType)
+bool WebHelperPluginImpl::initialize(const String& pluginType, const WebDocument& hostDocument, WebViewImpl* webView)
{
ASSERT(webView);
m_webView = webView;
- return initializePage(webView, pluginType);
+ return initializePage(pluginType, hostDocument);
}
void WebHelperPluginImpl::closeHelperPlugin()
@@ -175,7 +180,7 @@
return plugin;
}
-bool WebHelperPluginImpl::initializePage(WebKit::WebViewImpl* webView, const String& pluginType)
+bool WebHelperPluginImpl::initializePage(const String& pluginType, const WebDocument& hostDocument)
{
Page::PageClients pageClients;
fillWithEmptyClients(pageClients);
@@ -190,7 +195,7 @@
unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones));
- webView->client()->initializeHelperPluginWebFrame(this);
+ m_webView->client()->initializeHelperPluginWebFrame(this);
// The page's main frame was set in initializeFrame() as a result of the above call.
Frame* frame = m_page->mainFrame();
@@ -199,7 +204,7 @@
// No need to set a size or make it not transparent.
DocumentWriter* writer = frame->loader()->activeDocumentLoader()->writer();
- writeDocument(*writer, pluginType);
+ writeDocument(pluginType, hostDocument, *writer);
return true;
}
« no previous file with comments | « Source/WebKit/chromium/src/WebHelperPluginImpl.h ('k') | Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698