OLD | NEW |
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 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 expected_content_intent_id_(0), | 690 expected_content_intent_id_(0), |
691 #endif | 691 #endif |
692 enumeration_completion_id_(0), | 692 enumeration_completion_id_(0), |
693 session_storage_namespace_id_(params.session_storage_namespace_id), | 693 session_storage_namespace_id_(params.session_storage_namespace_id), |
694 has_added_input_handler_(false) { | 694 has_added_input_handler_(false) { |
695 GetWidget()->set_owner_delegate(this); | 695 GetWidget()->set_owner_delegate(this); |
696 } | 696 } |
697 | 697 |
698 void RenderViewImpl::Initialize(const mojom::CreateViewParams& params, | 698 void RenderViewImpl::Initialize(const mojom::CreateViewParams& params, |
699 bool was_created_by_renderer) { | 699 bool was_created_by_renderer) { |
700 RenderWidget::InitRoutingID(params.view_id); | 700 SetRoutingID(params.view_id); |
701 | 701 |
702 int opener_view_routing_id = MSG_ROUTING_NONE; | 702 int opener_view_routing_id; |
703 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( | 703 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( |
704 params.opener_frame_route_id, &opener_view_routing_id); | 704 params.opener_frame_route_id, &opener_view_routing_id); |
705 if (!was_created_by_renderer) | 705 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) |
706 opener_view_routing_id = MSG_ROUTING_NONE; | 706 opener_id_ = opener_view_routing_id; |
707 | 707 |
708 display_mode_ = params.initial_size.display_mode; | 708 display_mode_ = params.initial_size.display_mode; |
709 | 709 |
710 webview_ = | 710 webview_ = |
711 WebView::create(this, is_hidden() ? blink::WebPageVisibilityStateHidden | 711 WebView::create(this, is_hidden() ? blink::WebPageVisibilityStateHidden |
712 : blink::WebPageVisibilityStateVisible); | 712 : blink::WebPageVisibilityStateVisible); |
713 RenderWidget::Init(opener_view_routing_id, webview_->widget()); | 713 RenderWidget::DoInit(MSG_ROUTING_NONE, webview_->widget(), |
| 714 CreateWidgetCallback()); |
714 | 715 |
715 g_view_map.Get().insert(std::make_pair(webview(), this)); | 716 g_view_map.Get().insert(std::make_pair(webview(), this)); |
716 g_routing_id_view_map.Get().insert(std::make_pair(GetRoutingID(), this)); | 717 g_routing_id_view_map.Get().insert(std::make_pair(GetRoutingID(), this)); |
717 | 718 |
718 const base::CommandLine& command_line = | 719 const base::CommandLine& command_line = |
719 *base::CommandLine::ForCurrentProcess(); | 720 *base::CommandLine::ForCurrentProcess(); |
720 | 721 |
721 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 722 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
722 stats_collection_observer_.reset(new StatsCollectionObserver(this)); | 723 stats_collection_observer_.reset(new StatsCollectionObserver(this)); |
723 | 724 |
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2167 | 2168 |
2168 RenderWidget* RenderViewImpl::GetWidget() const { | 2169 RenderWidget* RenderViewImpl::GetWidget() const { |
2169 return const_cast<RenderWidget*>(static_cast<const RenderWidget*>(this)); | 2170 return const_cast<RenderWidget*>(static_cast<const RenderWidget*>(this)); |
2170 } | 2171 } |
2171 | 2172 |
2172 RenderFrameImpl* RenderViewImpl::GetMainRenderFrame() { | 2173 RenderFrameImpl* RenderViewImpl::GetMainRenderFrame() { |
2173 return main_render_frame_; | 2174 return main_render_frame_; |
2174 } | 2175 } |
2175 | 2176 |
2176 int RenderViewImpl::GetRoutingID() const { | 2177 int RenderViewImpl::GetRoutingID() const { |
2177 DCHECK_NE(routing_id(), MSG_ROUTING_NONE) | |
2178 << "Tried to obtain routing ID before it was set."; | |
2179 return routing_id(); | 2178 return routing_id(); |
2180 } | 2179 } |
2181 | 2180 |
2182 gfx::Size RenderViewImpl::GetSize() const { | 2181 gfx::Size RenderViewImpl::GetSize() const { |
2183 return size(); | 2182 return size(); |
2184 } | 2183 } |
2185 | 2184 |
2186 float RenderViewImpl::GetDeviceScaleFactor() const { | 2185 float RenderViewImpl::GetDeviceScaleFactor() const { |
2187 return device_scale_factor_; | 2186 return device_scale_factor_; |
2188 } | 2187 } |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2996 NotifyInputEventHandled(input_event->type, | 2995 NotifyInputEventHandled(input_event->type, |
2997 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2996 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
2998 } | 2997 } |
2999 | 2998 |
3000 std::unique_ptr<InputEventAck> ack( | 2999 std::unique_ptr<InputEventAck> ack( |
3001 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 3000 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
3002 OnInputEventAck(std::move(ack)); | 3001 OnInputEventAck(std::move(ack)); |
3003 } | 3002 } |
3004 | 3003 |
3005 } // namespace content | 3004 } // namespace content |
OLD | NEW |