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

Unified Diff: content/renderer/render_view_impl.cc

Issue 1672073003: Shunt string-dumping functions from WebFrame to a side class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added/updated TODOs. Created 4 years, 10 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: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index be8956050c890dbba9729902c27ce9742d70591b..616392355a5ab48c8914a4ed0a96a747f85c7035 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -141,6 +141,7 @@
#include "third_party/WebKit/public/web/WebFormControlElement.h"
#include "third_party/WebKit/public/web/WebFormElement.h"
#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebFrameContentDumper.h"
#include "third_party/WebKit/public/web/WebHistoryItem.h"
#include "third_party/WebKit/public/web/WebHitTestResult.h"
#include "third_party/WebKit/public/web/WebInputElement.h"
@@ -220,6 +221,7 @@ using blink::WebFileChooserCompletion;
using blink::WebFormControlElement;
using blink::WebFormElement;
using blink::WebFrame;
+using blink::WebFrameContentDumper;
using blink::WebGestureEvent;
using blink::WebHistoryItem;
using blink::WebHTTPBody;
@@ -1237,13 +1239,23 @@ void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) {
void RenderViewImpl::OnGetRenderedText() {
if (!webview())
return;
+
+ if (!webview()->mainFrame()->isWebLocalFrame())
+ return;
+
// Get rendered text from WebLocalFrame.
// TODO: Currently IPC truncates any data that has a
// size > kMaximumMessageSize. May be split the text into smaller chunks and
// send back using multiple IPC. See http://crbug.com/393444.
static const size_t kMaximumMessageSize = 8 * 1024 * 1024;
- std::string text = webview()->mainFrame()->contentAsText(
- kMaximumMessageSize).utf8();
+ // TODO(dglazkov): Using this API is wrong. It's not OOPIF-compatible and
+ // sends text in the wrong order. See http://crbug.com/584798.
+ // TODO(dglazkov): WebFrameContentDumper should only be used for
+ // testing purposes. See http://crbug.com/585164.
+ std::string text =
+ WebFrameContentDumper::dumpFrameTreeAsText(
+ webview()->mainFrame()->toWebLocalFrame(), kMaximumMessageSize)
+ .utf8();
Send(new ViewMsg_GetRenderedTextCompleted(routing_id(), text));
}
« no previous file with comments | « content/renderer/render_view_browsertest_mac.mm ('k') | third_party/WebKit/Source/web/WebFrameContentDumper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698