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