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

Unified Diff: content/renderer/render_view_impl.cc

Issue 10544175: Add an ability to call WebKit's WebFrame::loadData via NavigationController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamings for clarity Created 8 years, 6 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 9f8ba3ebb89eb4c871f33b7d9913943e7e212df8..463aab7f8dbfac4a1de3aa1405e35ea13575f229 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -101,6 +101,7 @@
#include "media/base/message_loop_factory.h"
#include "media/filters/audio_renderer_impl.h"
#include "media/filters/gpu_video_decoder.h"
+#include "net/base/data_url.h"
#include "net/base/escape.h"
#include "net/base/net_errors.h"
#include "net/http/http_util.h"
@@ -1051,6 +1052,18 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
DCHECK_NE(params.page_id, -1);
main_frame->loadHistoryItem(
webkit_glue::HistoryItemFromString(params.state));
+ } else if (!params.base_url_for_data_url.is_empty()) {
+ // A loadData request with a specified base URL.
+ std::string mime_type, charset, data;
+ if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) {
Charlie Reis 2012/07/03 17:54:37 If this parsing fails (e.g., someone later tries t
mnaganov (inactive) 2012/07/04 15:25:57 Added an explicit bailout.
+ main_frame->loadData(
+ WebData(data.c_str(), data.length()),
+ WebString::fromUTF8(mime_type),
+ WebString::fromUTF8(charset),
+ params.base_url_for_data_url,
+ params.history_url_for_data_url,
+ false);
+ }
} else {
// Navigate to the given URL.
WebURLRequest request(params.url);

Powered by Google App Engine
This is Rietveld 408576698