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 SetRoutingID(params.view_id); | 700 RenderWidget::InitRoutingID(params.view_id); |
701 | 701 |
702 int opener_view_routing_id; | 702 int opener_view_routing_id = MSG_ROUTING_NONE; |
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 (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) | 705 if (!was_created_by_renderer) |
706 opener_id_ = opener_view_routing_id; | 706 opener_view_routing_id = MSG_ROUTING_NONE; |
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::DoInit(MSG_ROUTING_NONE, webview_->widget(), | 713 RenderWidget::Init(opener_view_routing_id, webview_->widget()); |
714 CreateWidgetCallback()); | |
715 | 714 |
716 g_view_map.Get().insert(std::make_pair(webview(), this)); | 715 g_view_map.Get().insert(std::make_pair(webview(), this)); |
717 g_routing_id_view_map.Get().insert(std::make_pair(GetRoutingID(), this)); | 716 g_routing_id_view_map.Get().insert(std::make_pair(GetRoutingID(), this)); |
718 | 717 |
719 const base::CommandLine& command_line = | 718 const base::CommandLine& command_line = |
720 *base::CommandLine::ForCurrentProcess(); | 719 *base::CommandLine::ForCurrentProcess(); |
721 | 720 |
722 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 721 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
723 stats_collection_observer_.reset(new StatsCollectionObserver(this)); | 722 stats_collection_observer_.reset(new StatsCollectionObserver(this)); |
724 | 723 |
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2168 | 2167 |
2169 RenderWidget* RenderViewImpl::GetWidget() const { | 2168 RenderWidget* RenderViewImpl::GetWidget() const { |
2170 return const_cast<RenderWidget*>(static_cast<const RenderWidget*>(this)); | 2169 return const_cast<RenderWidget*>(static_cast<const RenderWidget*>(this)); |
2171 } | 2170 } |
2172 | 2171 |
2173 RenderFrameImpl* RenderViewImpl::GetMainRenderFrame() { | 2172 RenderFrameImpl* RenderViewImpl::GetMainRenderFrame() { |
2174 return main_render_frame_; | 2173 return main_render_frame_; |
2175 } | 2174 } |
2176 | 2175 |
2177 int RenderViewImpl::GetRoutingID() const { | 2176 int RenderViewImpl::GetRoutingID() const { |
| 2177 DCHECK_NE(routing_id(), MSG_ROUTING_NONE) |
| 2178 << "Tried to obtain routing ID before it was set."; |
2178 return routing_id(); | 2179 return routing_id(); |
2179 } | 2180 } |
2180 | 2181 |
2181 gfx::Size RenderViewImpl::GetSize() const { | 2182 gfx::Size RenderViewImpl::GetSize() const { |
2182 return size(); | 2183 return size(); |
2183 } | 2184 } |
2184 | 2185 |
2185 float RenderViewImpl::GetDeviceScaleFactor() const { | 2186 float RenderViewImpl::GetDeviceScaleFactor() const { |
2186 return device_scale_factor_; | 2187 return device_scale_factor_; |
2187 } | 2188 } |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2995 NotifyInputEventHandled(input_event->type, | 2996 NotifyInputEventHandled(input_event->type, |
2996 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2997 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
2997 } | 2998 } |
2998 | 2999 |
2999 std::unique_ptr<InputEventAck> ack( | 3000 std::unique_ptr<InputEventAck> ack( |
3000 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 3001 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
3001 OnInputEventAck(std::move(ack)); | 3002 OnInputEventAck(std::move(ack)); |
3002 } | 3003 } |
3003 | 3004 |
3004 } // namespace content | 3005 } // namespace content |
OLD | NEW |