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

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

Issue 1303773002: Give the main frame a RenderWidget. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 g_view_map.Get().insert(std::make_pair(webview(), this)); 684 g_view_map.Get().insert(std::make_pair(webview(), this));
685 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); 685 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this));
686 686
687 const base::CommandLine& command_line = 687 const base::CommandLine& command_line =
688 *base::CommandLine::ForCurrentProcess(); 688 *base::CommandLine::ForCurrentProcess();
689 689
690 if (command_line.HasSwitch(switches::kStatsCollectionController)) 690 if (command_line.HasSwitch(switches::kStatsCollectionController))
691 stats_collection_observer_.reset(new StatsCollectionObserver(this)); 691 stats_collection_observer_.reset(new StatsCollectionObserver(this));
692 692
693 if (params.main_frame_routing_id != MSG_ROUTING_NONE) { 693 if (params.main_frame_routing_id != MSG_ROUTING_NONE) {
694 main_render_frame_ = 694 main_render_frame_ = RenderFrameImpl::CreateMainFrame(
695 RenderFrameImpl::CreateMainFrame(this, params.main_frame_routing_id); 695 this, params.main_frame_routing_id, params.main_frame_widget_routing_id,
696 params.surface_id, params.hidden, screen_info(), compositor_deps_);
696 } 697 }
697 698
698 if (params.proxy_routing_id != MSG_ROUTING_NONE) { 699 if (params.proxy_routing_id != MSG_ROUTING_NONE) {
699 CHECK(params.swapped_out); 700 CHECK(params.swapped_out);
700 if (main_render_frame_) { 701 if (main_render_frame_) {
701 DCHECK(!SiteIsolationPolicy::IsSwappedOutStateForbidden()); 702 DCHECK(!SiteIsolationPolicy::IsSwappedOutStateForbidden());
702 RenderFrameProxy* proxy = RenderFrameProxy::CreateProxyToReplaceFrame( 703 RenderFrameProxy* proxy = RenderFrameProxy::CreateProxyToReplaceFrame(
703 main_render_frame_, params.proxy_routing_id, 704 main_render_frame_, params.proxy_routing_id,
704 blink::WebTreeScopeType::Document); 705 blink::WebTreeScopeType::Document);
705 main_render_frame_->set_render_frame_proxy(proxy); 706 main_render_frame_->set_render_frame_proxy(proxy);
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 params.disposition = NavigationPolicyToDisposition(policy); 1588 params.disposition = NavigationPolicyToDisposition(policy);
1588 if (!request.isNull()) { 1589 if (!request.isNull()) {
1589 params.target_url = request.url(); 1590 params.target_url = request.url();
1590 params.referrer = GetReferrerFromRequest(creator, request); 1591 params.referrer = GetReferrerFromRequest(creator, request);
1591 } 1592 }
1592 params.features = features; 1593 params.features = features;
1593 1594
1594 for (size_t i = 0; i < features.additionalFeatures.size(); ++i) 1595 for (size_t i = 0; i < features.additionalFeatures.size(); ++i)
1595 params.additional_features.push_back(features.additionalFeatures[i]); 1596 params.additional_features.push_back(features.additionalFeatures[i]);
1596 1597
1597 int32 routing_id = MSG_ROUTING_NONE; 1598 ViewHostMsg_CreateWindow_Reply reply;
1598 int32 main_frame_routing_id = MSG_ROUTING_NONE; 1599 reply.route_id = MSG_ROUTING_NONE;
1599 int32 surface_id = 0; 1600 reply.main_frame_route_id = MSG_ROUTING_NONE;
1600 int64 cloned_session_storage_namespace_id = 0; 1601 reply.main_frame_widget_route_id = MSG_ROUTING_NONE;
1602 reply.surface_id = 0;
1603 reply.cloned_session_storage_namespace_id = 0;
1601 1604
1602 RenderThread::Get()->Send(new ViewHostMsg_CreateWindow( 1605 RenderThread::Get()->Send(new ViewHostMsg_CreateWindow(params, &reply));
1603 params, &routing_id, &main_frame_routing_id, &surface_id, 1606 if (reply.route_id == MSG_ROUTING_NONE)
1604 &cloned_session_storage_namespace_id));
1605 if (routing_id == MSG_ROUTING_NONE)
1606 return NULL; 1607 return NULL;
1607 1608
1608 WebUserGestureIndicator::consumeUserGesture(); 1609 WebUserGestureIndicator::consumeUserGesture();
1609 1610
1610 // While this view may be a background extension page, it can spawn a visible 1611 // While this view may be a background extension page, it can spawn a visible
1611 // render view. So we just assume that the new one is not another background 1612 // render view. So we just assume that the new one is not another background
1612 // page instead of passing on our own value. 1613 // page instead of passing on our own value.
1613 // TODO(vangelis): Can we tell if the new view will be a background page? 1614 // TODO(vangelis): Can we tell if the new view will be a background page?
1614 bool never_visible = false; 1615 bool never_visible = false;
1615 1616
1616 ViewMsg_Resize_Params initial_size = ViewMsg_Resize_Params(); 1617 ViewMsg_Resize_Params initial_size = ViewMsg_Resize_Params();
1617 initial_size.screen_info = screen_info_; 1618 initial_size.screen_info = screen_info_;
1618 1619
1619 // The initial hidden state for the RenderViewImpl here has to match what the 1620 // The initial hidden state for the RenderViewImpl here has to match what the
1620 // browser will eventually decide for the given disposition. Since we have to 1621 // browser will eventually decide for the given disposition. Since we have to
1621 // return from this call synchronously, we just have to make our best guess 1622 // return from this call synchronously, we just have to make our best guess
1622 // and rely on the browser sending a WasHidden / WasShown message if it 1623 // and rely on the browser sending a WasHidden / WasShown message if it
1623 // disagrees. 1624 // disagrees.
1624 ViewMsg_New_Params view_params; 1625 ViewMsg_New_Params view_params;
1625 1626
1626 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator); 1627 RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator);
1627 view_params.opener_frame_route_id = creator_frame->GetRoutingID(); 1628 view_params.opener_frame_route_id = creator_frame->GetRoutingID();
1628 DCHECK_EQ(routing_id_, creator_frame->render_view()->GetRoutingID()); 1629 DCHECK_EQ(routing_id_, creator_frame->render_view()->GetRoutingID());
1629 1630
1630 view_params.window_was_created_with_opener = true; 1631 view_params.window_was_created_with_opener = true;
1631 view_params.renderer_preferences = renderer_preferences_; 1632 view_params.renderer_preferences = renderer_preferences_;
1632 view_params.web_preferences = webkit_preferences_; 1633 view_params.web_preferences = webkit_preferences_;
1633 view_params.view_id = routing_id; 1634 view_params.view_id = reply.route_id;
1634 view_params.main_frame_routing_id = main_frame_routing_id; 1635 view_params.main_frame_routing_id = reply.main_frame_route_id;
1635 view_params.surface_id = surface_id; 1636 view_params.main_frame_widget_routing_id = reply.main_frame_widget_route_id;
1637 view_params.surface_id = reply.surface_id;
1636 view_params.session_storage_namespace_id = 1638 view_params.session_storage_namespace_id =
1637 cloned_session_storage_namespace_id; 1639 reply.cloned_session_storage_namespace_id;
1638 view_params.swapped_out = false; 1640 view_params.swapped_out = false;
1639 // WebCore will take care of setting the correct name. 1641 // WebCore will take care of setting the correct name.
1640 view_params.replicated_frame_state = FrameReplicationState(); 1642 view_params.replicated_frame_state = FrameReplicationState();
1641 view_params.proxy_routing_id = MSG_ROUTING_NONE; 1643 view_params.proxy_routing_id = MSG_ROUTING_NONE;
1642 view_params.hidden = (params.disposition == NEW_BACKGROUND_TAB); 1644 view_params.hidden = (params.disposition == NEW_BACKGROUND_TAB);
1643 view_params.never_visible = never_visible; 1645 view_params.never_visible = never_visible;
1644 view_params.next_page_id = 1; 1646 view_params.next_page_id = 1;
1645 view_params.initial_size = initial_size; 1647 view_params.initial_size = initial_size;
1646 view_params.enable_auto_resize = false; 1648 view_params.enable_auto_resize = false;
1647 view_params.min_size = gfx::Size(); 1649 view_params.min_size = gfx::Size();
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3783 std::vector<gfx::Size> sizes; 3785 std::vector<gfx::Size> sizes;
3784 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 3786 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
3785 if (!url.isEmpty()) 3787 if (!url.isEmpty())
3786 urls.push_back( 3788 urls.push_back(
3787 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 3789 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
3788 } 3790 }
3789 SendUpdateFaviconURL(urls); 3791 SendUpdateFaviconURL(urls);
3790 } 3792 }
3791 3793
3792 } // namespace content 3794 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698