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

Unified Diff: Source/web/WebHelperPluginImpl.cpp

Issue 120513004: Don't expose DocumentWriter to embedding layer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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
« no previous file with comments | « Source/web/DateTimeChooserImpl.cpp ('k') | Source/web/WebPagePopupImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebHelperPluginImpl.cpp
diff --git a/Source/web/WebHelperPluginImpl.cpp b/Source/web/WebHelperPluginImpl.cpp
index 04c3e26f5521fbd2de705938443283abf6b2b3d4..a62890b65e3c2c390da486dbb0edb4a48f542676 100644
--- a/Source/web/WebHelperPluginImpl.cpp
+++ b/Source/web/WebHelperPluginImpl.cpp
@@ -42,8 +42,8 @@
#include "WebWidgetClient.h"
#include "core/dom/NodeList.h"
#include "core/html/HTMLPlugInElement.h"
-#include "core/loader/DocumentLoader.h"
#include "core/loader/EmptyClients.h"
+#include "core/loader/FrameLoadRequest.h"
#include "core/page/FocusController.h"
#include "core/frame/FrameView.h"
#include "core/page/Page.h"
@@ -53,28 +53,17 @@ using namespace WebCore;
namespace blink {
-#define addLiteral(literal, writer) writer->addData(literal, sizeof(literal) - 1)
+static const char documentStartLiteral[] = "<!DOCTYPE html><head><meta charset='UTF-8'></head><body>\n<object type=\"";
+static const char documentEndLiteral[] = "\"></object></body>\n";
-static inline void addString(const String& str, DocumentWriter* writer)
+static void writeDocument(const String& pluginType, const WebURL& url, WebCore::FrameLoader& loader)
{
- CString str8 = str.utf8();
- writer->addData(str8.data(), str8.length());
-}
-
-static void writeDocument(const String& pluginType, const WebDocument& hostDocument, WebCore::DocumentLoader* loader)
-{
- // 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();
-
- DocumentWriter* writer = loader->beginWriting("text/html", "UTF-8", url);
-
- addLiteral("<!DOCTYPE html><head><meta charset='UTF-8'></head><body>\n", writer);
- String objectTag = "<object type=\"" + pluginType + "\"></object>";
- addString(objectTag, writer);
- addLiteral("</body>\n", writer);
+ RefPtr<SharedBuffer> data = SharedBuffer::create();
+ data->append(documentStartLiteral, sizeof(documentStartLiteral) - 1);
+ data->append(pluginType.utf8().data(), pluginType.utf8().length());
+ data->append(documentEndLiteral, sizeof(documentEndLiteral) - 1);
- loader->endWriting(writer);
+ loader.load(FrameLoadRequest(0, ResourceRequest(url.isValid() ? KURL(url) : blankURL()), SubstituteData(data, "text/html", "UTF-8", KURL(), ForceSynchronousLoad)));
}
class HelperPluginChromeClient : public EmptyChromeClient {
@@ -227,7 +216,7 @@ bool WebHelperPluginImpl::initializePage(const String& pluginType, const WebDocu
frame->setView(FrameView::create(frame));
// No need to set a size or make it not transparent.
- writeDocument(pluginType, hostDocument, frame->loader().documentLoader());
+ writeDocument(pluginType, hostDocument.url(), frame->loader());
return true;
}
« no previous file with comments | « Source/web/DateTimeChooserImpl.cpp ('k') | Source/web/WebPagePopupImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698