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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1497743005: Allow huge data: URIs only via WebView.loadDataWithBaseUrl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sort out the tests Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 // CommitNavigation IPC, and then back to the browser again in the 535 // CommitNavigation IPC, and then back to the browser again in the
536 // DidCommitProvisionalLoad and the DocumentLoadComplete IPCs. 536 // DidCommitProvisionalLoad and the DocumentLoadComplete IPCs.
537 base::TimeTicks ui_timestamp = 537 base::TimeTicks ui_timestamp =
538 base::TimeTicks() + base::TimeDelta::FromSecondsD(request->uiStartTime()); 538 base::TimeTicks() + base::TimeDelta::FromSecondsD(request->uiStartTime());
539 FrameMsg_UILoadMetricsReportType::Value report_type = 539 FrameMsg_UILoadMetricsReportType::Value report_type =
540 static_cast<FrameMsg_UILoadMetricsReportType::Value>( 540 static_cast<FrameMsg_UILoadMetricsReportType::Value>(
541 request->inputPerfMetricReportPolicy()); 541 request->inputPerfMetricReportPolicy());
542 return CommonNavigationParams( 542 return CommonNavigationParams(
543 request->url(), referrer, extra_data->transition_type(), 543 request->url(), referrer, extra_data->transition_type(),
544 FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry, 544 FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry,
545 ui_timestamp, report_type, GURL(), GURL(), LOFI_UNSPECIFIED, 545 ui_timestamp, report_type, GURL(), GURL(), std::string(),
546 base::TimeTicks::Now()); 546 LOFI_UNSPECIFIED, base::TimeTicks::Now());
547 } 547 }
548 548
549 #if !defined(OS_ANDROID) || defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID) 549 #if !defined(OS_ANDROID) || defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID)
550 media::Context3D GetSharedMainThreadContext3D() { 550 media::Context3D GetSharedMainThreadContext3D() {
551 cc::ContextProvider* provider = 551 cc::ContextProvider* provider =
552 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); 552 RenderThreadImpl::current()->SharedMainThreadContextProvider().get();
553 if (!provider) 553 if (!provider)
554 return media::Context3D(); 554 return media::Context3D();
555 return media::Context3D(provider->ContextGL(), provider->GrContext()); 555 return media::Context3D(provider->ContextGL(), provider->GrContext());
556 } 556 }
(...skipping 2805 matching lines...) Expand 10 before | Expand all | Expand 10 after
3362 if (GetRenderWidget()->has_host_context_menu_location()) { 3362 if (GetRenderWidget()->has_host_context_menu_location()) {
3363 params.x = GetRenderWidget()->host_context_menu_location().x(); 3363 params.x = GetRenderWidget()->host_context_menu_location().x();
3364 params.y = GetRenderWidget()->host_context_menu_location().y(); 3364 params.y = GetRenderWidget()->host_context_menu_location().y();
3365 } 3365 }
3366 3366
3367 // Serializing a GURL longer than kMaxURLChars will fail, so don't do 3367 // Serializing a GURL longer than kMaxURLChars will fail, so don't do
3368 // it. We replace it with an empty GURL so the appropriate items are disabled 3368 // it. We replace it with an empty GURL so the appropriate items are disabled
3369 // in the context menu. 3369 // in the context menu.
3370 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large 3370 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large
3371 // data encoded images. We should have a way to save them. 3371 // data encoded images. We should have a way to save them.
3372 if (params.src_url.spec().size() > GetMaxURLChars()) 3372 if (params.src_url.spec().size() > kMaxURLChars)
3373 params.src_url = GURL(); 3373 params.src_url = GURL();
3374 context_menu_node_ = data.node; 3374 context_menu_node_ = data.node;
3375 3375
3376 #if defined(OS_ANDROID) 3376 #if defined(OS_ANDROID)
3377 gfx::Rect start_rect; 3377 gfx::Rect start_rect;
3378 gfx::Rect end_rect; 3378 gfx::Rect end_rect;
3379 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect); 3379 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect);
3380 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom()); 3380 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom());
3381 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom()); 3381 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom());
3382 #endif 3382 #endif
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
5124 request->skipServiceWorker(), 5124 request->skipServiceWorker(),
5125 GetRequestContextTypeForWebURLRequest(*request)), 5125 GetRequestContextTypeForWebURLRequest(*request)),
5126 GetRequestBodyForWebURLRequest(*request))); 5126 GetRequestBodyForWebURLRequest(*request)));
5127 } 5127 }
5128 5128
5129 void RenderFrameImpl::LoadDataURL(const CommonNavigationParams& params, 5129 void RenderFrameImpl::LoadDataURL(const CommonNavigationParams& params,
5130 WebFrame* frame, 5130 WebFrame* frame,
5131 blink::WebFrameLoadType load_type) { 5131 blink::WebFrameLoadType load_type) {
5132 // A loadData request with a specified base URL. 5132 // A loadData request with a specified base URL.
5133 std::string mime_type, charset, data; 5133 std::string mime_type, charset, data;
5134 if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) { 5134 if (net::DataURL::Parse(params.data_url_as_string.empty()
5135 ? params.url
5136 : GURL(params.data_url_as_string),
5137 &mime_type, &charset, &data)) {
5135 const GURL base_url = params.base_url_for_data_url.is_empty() ? 5138 const GURL base_url = params.base_url_for_data_url.is_empty() ?
5136 params.url : params.base_url_for_data_url; 5139 params.url : params.base_url_for_data_url;
5137 bool replace = load_type == blink::WebFrameLoadType::ReloadFromOrigin || 5140 bool replace = load_type == blink::WebFrameLoadType::ReloadFromOrigin ||
5138 load_type == blink::WebFrameLoadType::Reload; 5141 load_type == blink::WebFrameLoadType::Reload;
5139 frame->loadData( 5142 frame->loadData(
5140 WebData(data.c_str(), data.length()), 5143 WebData(data.c_str(), data.length()),
5141 WebString::fromUTF8(mime_type), 5144 WebString::fromUTF8(mime_type),
5142 WebString::fromUTF8(charset), 5145 WebString::fromUTF8(charset),
5143 base_url, 5146 base_url,
5144 // Needed so that history-url-only changes don't become reloads. 5147 // Needed so that history-url-only changes don't become reloads.
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
5444 media::ConvertToSwitchOutputDeviceCB(web_callbacks); 5447 media::ConvertToSwitchOutputDeviceCB(web_callbacks);
5445 scoped_refptr<media::AudioOutputDevice> device = 5448 scoped_refptr<media::AudioOutputDevice> device =
5446 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), 5449 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(),
5447 security_origin); 5450 security_origin);
5448 media::OutputDeviceStatus status = device->GetDeviceStatus(); 5451 media::OutputDeviceStatus status = device->GetDeviceStatus();
5449 device->Stop(); 5452 device->Stop();
5450 callback.Run(status); 5453 callback.Run(status);
5451 } 5454 }
5452 5455
5453 } // namespace content 5456 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698