| 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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 history_list_length_(0), | 623 history_list_length_(0), |
| 624 frames_in_progress_(0), | 624 frames_in_progress_(0), |
| 625 target_url_status_(TARGET_NONE), | 625 target_url_status_(TARGET_NONE), |
| 626 uses_temporary_zoom_level_(false), | 626 uses_temporary_zoom_level_(false), |
| 627 #if defined(OS_ANDROID) | 627 #if defined(OS_ANDROID) |
| 628 top_controls_constraints_(TOP_CONTROLS_STATE_BOTH), | 628 top_controls_constraints_(TOP_CONTROLS_STATE_BOTH), |
| 629 #endif | 629 #endif |
| 630 top_controls_shrink_blink_size_(false), | 630 top_controls_shrink_blink_size_(false), |
| 631 top_controls_height_(0.f), | 631 top_controls_height_(0.f), |
| 632 has_focus_(false), | 632 has_focus_(false), |
| 633 webview_(nullptr), |
| 633 has_scrolled_focused_editable_node_into_rect_(false), | 634 has_scrolled_focused_editable_node_into_rect_(false), |
| 634 page_zoom_level_(params.page_zoom_level), | 635 page_zoom_level_(params.page_zoom_level), |
| 635 main_render_frame_(nullptr), | 636 main_render_frame_(nullptr), |
| 636 frame_widget_(nullptr), | 637 frame_widget_(nullptr), |
| 637 speech_recognition_dispatcher_(NULL), | 638 speech_recognition_dispatcher_(NULL), |
| 638 mouse_lock_dispatcher_(NULL), | 639 mouse_lock_dispatcher_(NULL), |
| 639 #if defined(OS_ANDROID) | 640 #if defined(OS_ANDROID) |
| 640 expected_content_intent_id_(0), | 641 expected_content_intent_id_(0), |
| 641 #endif | 642 #endif |
| 642 #if defined(ENABLE_PLUGINS) | 643 #if defined(ENABLE_PLUGINS) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 656 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( | 657 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( |
| 657 params.opener_frame_route_id, &opener_view_routing_id); | 658 params.opener_frame_route_id, &opener_view_routing_id); |
| 658 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) | 659 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) |
| 659 opener_id_ = opener_view_routing_id; | 660 opener_id_ = opener_view_routing_id; |
| 660 | 661 |
| 661 display_mode_ = params.initial_size.display_mode; | 662 display_mode_ = params.initial_size.display_mode; |
| 662 | 663 |
| 663 // Ensure we start with a valid next_page_id_ from the browser. | 664 // Ensure we start with a valid next_page_id_ from the browser. |
| 664 DCHECK_GE(next_page_id_, 0); | 665 DCHECK_GE(next_page_id_, 0); |
| 665 | 666 |
| 666 webwidget_ = WebView::create(this); | 667 webview_ = WebView::create(this); |
| 668 webwidget_ = webview_->widget(); |
| 667 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); | 669 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); |
| 668 | 670 |
| 669 g_view_map.Get().insert(std::make_pair(webview(), this)); | 671 g_view_map.Get().insert(std::make_pair(webview(), this)); |
| 670 g_routing_id_view_map.Get().insert(std::make_pair(GetRoutingID(), this)); | 672 g_routing_id_view_map.Get().insert(std::make_pair(GetRoutingID(), this)); |
| 671 | 673 |
| 672 const base::CommandLine& command_line = | 674 const base::CommandLine& command_line = |
| 673 *base::CommandLine::ForCurrentProcess(); | 675 *base::CommandLine::ForCurrentProcess(); |
| 674 | 676 |
| 675 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 677 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
| 676 stats_collection_observer_.reset(new StatsCollectionObserver(this)); | 678 stats_collection_observer_.reset(new StatsCollectionObserver(this)); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 void RenderViewImpl::AddObserver(RenderViewObserver* observer) { | 1149 void RenderViewImpl::AddObserver(RenderViewObserver* observer) { |
| 1148 observers_.AddObserver(observer); | 1150 observers_.AddObserver(observer); |
| 1149 } | 1151 } |
| 1150 | 1152 |
| 1151 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { | 1153 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { |
| 1152 observer->RenderViewGone(); | 1154 observer->RenderViewGone(); |
| 1153 observers_.RemoveObserver(observer); | 1155 observers_.RemoveObserver(observer); |
| 1154 } | 1156 } |
| 1155 | 1157 |
| 1156 blink::WebView* RenderViewImpl::webview() const { | 1158 blink::WebView* RenderViewImpl::webview() const { |
| 1157 return static_cast<blink::WebView*>(webwidget()); | 1159 return webview_; |
| 1158 } | 1160 } |
| 1159 | 1161 |
| 1160 #if defined(ENABLE_PLUGINS) | 1162 #if defined(ENABLE_PLUGINS) |
| 1161 void RenderViewImpl::PepperInstanceCreated( | 1163 void RenderViewImpl::PepperInstanceCreated( |
| 1162 PepperPluginInstanceImpl* instance) { | 1164 PepperPluginInstanceImpl* instance) { |
| 1163 active_pepper_instances_.insert(instance); | 1165 active_pepper_instances_.insert(instance); |
| 1164 | 1166 |
| 1165 RenderFrameImpl* const render_frame = instance->render_frame(); | 1167 RenderFrameImpl* const render_frame = instance->render_frame(); |
| 1166 render_frame->Send( | 1168 render_frame->Send( |
| 1167 new FrameHostMsg_PepperInstanceCreated(render_frame->GetRoutingID())); | 1169 new FrameHostMsg_PepperInstanceCreated(render_frame->GetRoutingID())); |
| (...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2807 } | 2809 } |
| 2808 | 2810 |
| 2809 void RenderViewImpl::CloseForFrame() { | 2811 void RenderViewImpl::CloseForFrame() { |
| 2810 DCHECK(frame_widget_); | 2812 DCHECK(frame_widget_); |
| 2811 frame_widget_->close(); | 2813 frame_widget_->close(); |
| 2812 frame_widget_ = nullptr; | 2814 frame_widget_ = nullptr; |
| 2813 } | 2815 } |
| 2814 | 2816 |
| 2815 void RenderViewImpl::Close() { | 2817 void RenderViewImpl::Close() { |
| 2816 // We need to grab a pointer to the doomed WebView before we destroy it. | 2818 // We need to grab a pointer to the doomed WebView before we destroy it. |
| 2817 WebView* doomed = webview(); | 2819 WebView* doomed = webview_; |
| 2818 RenderWidget::Close(); | 2820 RenderWidget::Close(); |
| 2821 webview_ = nullptr; |
| 2819 g_view_map.Get().erase(doomed); | 2822 g_view_map.Get().erase(doomed); |
| 2820 g_routing_id_view_map.Get().erase(GetRoutingID()); | 2823 g_routing_id_view_map.Get().erase(GetRoutingID()); |
| 2821 RenderThread::Get()->Send(new ViewHostMsg_Close_ACK(GetRoutingID())); | 2824 RenderThread::Get()->Send(new ViewHostMsg_Close_ACK(GetRoutingID())); |
| 2822 } | 2825 } |
| 2823 | 2826 |
| 2824 void RenderViewImpl::OnWasHidden() { | 2827 void RenderViewImpl::OnWasHidden() { |
| 2825 RenderWidget::OnWasHidden(); | 2828 RenderWidget::OnWasHidden(); |
| 2826 | 2829 |
| 2827 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) | 2830 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) |
| 2828 RenderThreadImpl::current()->video_capture_impl_manager()-> | 2831 RenderThreadImpl::current()->video_capture_impl_manager()-> |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3429 if (IsUseZoomForDSFEnabled()) { | 3432 if (IsUseZoomForDSFEnabled()) { |
| 3430 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3433 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3431 } else { | 3434 } else { |
| 3432 webview()->setDeviceScaleFactor(device_scale_factor_); | 3435 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3433 } | 3436 } |
| 3434 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3437 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3435 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3438 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3436 } | 3439 } |
| 3437 | 3440 |
| 3438 } // namespace content | 3441 } // namespace content |
| OLD | NEW |