| Index: content/renderer/render_view_impl.cc
|
| diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
|
| index 048a26cbcf9e46e65474d52c2c3c4a75fce18140..32131ef9f71149a06ff2c9d60687ab2a64178dcc 100644
|
| --- a/content/renderer/render_view_impl.cc
|
| +++ b/content/renderer/render_view_impl.cc
|
| @@ -759,13 +759,6 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) {
|
| WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get());
|
| main_render_frame_->SetWebFrame(web_frame);
|
|
|
| - if (params->proxy_routing_id != MSG_ROUTING_NONE) {
|
| - CHECK(params->swapped_out);
|
| - RenderFrameProxy* proxy = RenderFrameProxy::CreateProxyToReplaceFrame(
|
| - main_render_frame_.get(), params->proxy_routing_id);
|
| - main_render_frame_->set_render_frame_proxy(proxy);
|
| - }
|
| -
|
| webwidget_ = WebView::create(this);
|
| webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_));
|
|
|
| @@ -825,7 +818,21 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) {
|
| webview()->settings()->setAllowConnectingInsecureWebSocket(
|
| command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin));
|
|
|
| - webview()->setMainFrame(main_render_frame_->GetWebFrame());
|
| + RenderFrameProxy* proxy = NULL;
|
| + if (params->proxy_routing_id != MSG_ROUTING_NONE) {
|
| + CHECK(params->swapped_out);
|
| + proxy = RenderFrameProxy::CreateProxyToReplaceFrame(
|
| + main_render_frame_.get(), params->proxy_routing_id);
|
| + main_render_frame_->set_render_frame_proxy(proxy);
|
| + }
|
| +
|
| + // In --site-per-process, just use the WebRemoteFrame as the main frame.
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) &&
|
| + proxy) {
|
| + webview()->setMainFrame(proxy->web_frame());
|
| + } else {
|
| + webview()->setMainFrame(main_render_frame_->GetWebFrame());
|
| + }
|
| main_render_frame_->Initialize();
|
|
|
| if (switches::IsTouchDragDropEnabled())
|
| @@ -879,7 +886,7 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) {
|
|
|
| // If we are initially swapped out, navigate to kSwappedOutURL.
|
| // This ensures we are in a unique origin that others cannot script.
|
| - if (is_swapped_out_)
|
| + if (is_swapped_out_ && webview()->mainFrame()->isWebLocalFrame())
|
| NavigateToSwappedOutURL(webview()->mainFrame());
|
| }
|
|
|
| @@ -1331,7 +1338,7 @@ bool RenderViewImpl::HasIMETextFocus() {
|
|
|
| bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
|
| WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL;
|
| - if (main_frame)
|
| + if (main_frame && main_frame->isWebLocalFrame())
|
| GetContentClient()->SetActiveURL(main_frame->document().url());
|
|
|
| ObserverListBase<RenderViewObserver>::Iterator it(observers_);
|
| @@ -2275,6 +2282,7 @@ void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame,
|
|
|
| // Carry over the user agent override flag, if it exists.
|
| if (content_initiated && webview() && webview()->mainFrame() &&
|
| + webview()->mainFrame()->isWebLocalFrame() &&
|
| webview()->mainFrame()->dataSource()) {
|
| DocumentState* old_document_state =
|
| DocumentState::FromDataSource(webview()->mainFrame()->dataSource());
|
| @@ -2310,9 +2318,9 @@ void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame,
|
| const WebURLRequest& original_request = ds->originalRequest();
|
| const GURL referrer(
|
| original_request.httpHeaderField(WebString::fromUTF8("Referer")));
|
| - if (!referrer.is_empty() &&
|
| - DocumentState::FromDataSource(
|
| - old_frame->dataSource())->was_prefetcher()) {
|
| + if (!referrer.is_empty() && old_frame->isWebLocalFrame() &&
|
| + DocumentState::FromDataSource(old_frame->dataSource())
|
| + ->was_prefetcher()) {
|
| for (; old_frame; old_frame = old_frame->traverseNext(false)) {
|
| WebDataSource* old_frame_ds = old_frame->dataSource();
|
| if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) {
|
| @@ -2660,7 +2668,8 @@ blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() {
|
| return NULL;
|
|
|
| WebFrame* main_frame = webview()->mainFrame();
|
| - if (main_frame->document().isPluginDocument())
|
| + if (main_frame->isWebLocalFrame() &&
|
| + main_frame->document().isPluginDocument())
|
| return webview()->mainFrame()->document().to<WebPluginDocument>().plugin();
|
|
|
| #if defined(ENABLE_PLUGINS)
|
| @@ -3181,7 +3190,8 @@ void RenderViewImpl::OnSetRendererPrefs(
|
|
|
| // If the zoom level for this page matches the old zoom default, and this
|
| // is not a plugin, update the zoom level to match the new default.
|
| - if (webview() && !webview()->mainFrame()->document().isPluginDocument() &&
|
| + if (webview() && webview()->mainFrame()->isWebLocalFrame() &&
|
| + !webview()->mainFrame()->document().isPluginDocument() &&
|
| !ZoomValuesEqual(old_zoom_level,
|
| renderer_preferences_.default_zoom_level) &&
|
| ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) {
|
| @@ -3293,7 +3303,8 @@ void RenderViewImpl::NavigateToSwappedOutURL(blink::WebFrame* frame) {
|
| CHECK(is_swapped_out_ || rf->is_swapped_out());
|
| GURL swappedOutURL(kSwappedOutURL);
|
| WebURLRequest request(swappedOutURL);
|
| - frame->loadRequest(request);
|
| + if (frame->isWebLocalFrame())
|
| + frame->loadRequest(request);
|
| }
|
|
|
| void RenderViewImpl::OnClosePage() {
|
| @@ -3396,6 +3407,11 @@ void RenderViewImpl::DidFlushPaint() {
|
| return;
|
|
|
| WebFrame* main_frame = webview()->mainFrame();
|
| + for (WebFrame* frame = main_frame; frame;
|
| + frame = frame->traverseNext(false)) {
|
| + if (frame->isWebLocalFrame())
|
| + main_frame = frame;
|
| + }
|
|
|
| // If we have a provisional frame we are between the start and commit stages
|
| // of loading and we don't want to save stats.
|
| @@ -3417,7 +3433,19 @@ void RenderViewImpl::DidFlushPaint() {
|
| }
|
|
|
| gfx::Vector2d RenderViewImpl::GetScrollOffset() {
|
| - WebSize scroll_offset = webview()->mainFrame()->scrollOffset();
|
| + WebFrame* main_frame = webview()->mainFrame();
|
| + for (WebFrame* frame = main_frame; frame;
|
| + frame = frame->traverseNext(false)) {
|
| + // TODO(nasko): This is a hack for the case in which the top-level
|
| + // frame is being rendered in another process. It will not
|
| + // behave correctly for out of process iframes.
|
| + if (frame->isWebLocalFrame()) {
|
| + main_frame = frame;
|
| + break;
|
| + }
|
| + }
|
| +
|
| + WebSize scroll_offset = main_frame->scrollOffset();
|
| return gfx::Vector2d(scroll_offset.width, scroll_offset.height);
|
| }
|
|
|
| @@ -3604,7 +3632,7 @@ void RenderViewImpl::OnWasShown(bool needs_repainting) {
|
|
|
| GURL RenderViewImpl::GetURLForGraphicsContext3D() {
|
| DCHECK(webview());
|
| - if (webview()->mainFrame())
|
| + if (webview()->mainFrame()->isWebLocalFrame())
|
| return GURL(webview()->mainFrame()->document().url());
|
| else
|
| return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D");
|
|
|