| 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 void RenderViewImpl::AddObserver(RenderViewObserver* observer) { | 1148 void RenderViewImpl::AddObserver(RenderViewObserver* observer) { |
| 1147 observers_.AddObserver(observer); | 1149 observers_.AddObserver(observer); |
| 1148 } | 1150 } |
| 1149 | 1151 |
| 1150 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { | 1152 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { |
| 1151 observer->RenderViewGone(); | 1153 observer->RenderViewGone(); |
| 1152 observers_.RemoveObserver(observer); | 1154 observers_.RemoveObserver(observer); |
| 1153 } | 1155 } |
| 1154 | 1156 |
| 1155 blink::WebView* RenderViewImpl::webview() const { | 1157 blink::WebView* RenderViewImpl::webview() const { |
| 1156 return static_cast<blink::WebView*>(webwidget()); | 1158 return webview_; |
| 1157 } | 1159 } |
| 1158 | 1160 |
| 1159 #if defined(ENABLE_PLUGINS) | 1161 #if defined(ENABLE_PLUGINS) |
| 1160 void RenderViewImpl::PepperInstanceCreated( | 1162 void RenderViewImpl::PepperInstanceCreated( |
| 1161 PepperPluginInstanceImpl* instance) { | 1163 PepperPluginInstanceImpl* instance) { |
| 1162 active_pepper_instances_.insert(instance); | 1164 active_pepper_instances_.insert(instance); |
| 1163 | 1165 |
| 1164 RenderFrameImpl* const render_frame = instance->render_frame(); | 1166 RenderFrameImpl* const render_frame = instance->render_frame(); |
| 1165 render_frame->Send( | 1167 render_frame->Send( |
| 1166 new FrameHostMsg_PepperInstanceCreated(render_frame->GetRoutingID())); | 1168 new FrameHostMsg_PepperInstanceCreated(render_frame->GetRoutingID())); |
| (...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2806 } | 2808 } |
| 2807 | 2809 |
| 2808 void RenderViewImpl::CloseForFrame() { | 2810 void RenderViewImpl::CloseForFrame() { |
| 2809 DCHECK(frame_widget_); | 2811 DCHECK(frame_widget_); |
| 2810 frame_widget_->close(); | 2812 frame_widget_->close(); |
| 2811 frame_widget_ = nullptr; | 2813 frame_widget_ = nullptr; |
| 2812 } | 2814 } |
| 2813 | 2815 |
| 2814 void RenderViewImpl::Close() { | 2816 void RenderViewImpl::Close() { |
| 2815 // We need to grab a pointer to the doomed WebView before we destroy it. | 2817 // We need to grab a pointer to the doomed WebView before we destroy it. |
| 2816 WebView* doomed = webview(); | 2818 WebView* doomed = webview_; |
| 2817 RenderWidget::Close(); | 2819 RenderWidget::Close(); |
| 2820 webview_ = nullptr; |
| 2818 g_view_map.Get().erase(doomed); | 2821 g_view_map.Get().erase(doomed); |
| 2819 g_routing_id_view_map.Get().erase(GetRoutingID()); | 2822 g_routing_id_view_map.Get().erase(GetRoutingID()); |
| 2820 RenderThread::Get()->Send(new ViewHostMsg_Close_ACK(GetRoutingID())); | 2823 RenderThread::Get()->Send(new ViewHostMsg_Close_ACK(GetRoutingID())); |
| 2821 } | 2824 } |
| 2822 | 2825 |
| 2823 void RenderViewImpl::OnWasHidden() { | 2826 void RenderViewImpl::OnWasHidden() { |
| 2824 RenderWidget::OnWasHidden(); | 2827 RenderWidget::OnWasHidden(); |
| 2825 | 2828 |
| 2826 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) | 2829 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) |
| 2827 RenderThreadImpl::current()->video_capture_impl_manager()-> | 2830 RenderThreadImpl::current()->video_capture_impl_manager()-> |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3428 if (IsUseZoomForDSFEnabled()) { | 3431 if (IsUseZoomForDSFEnabled()) { |
| 3429 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3432 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3430 } else { | 3433 } else { |
| 3431 webview()->setDeviceScaleFactor(device_scale_factor_); | 3434 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3432 } | 3435 } |
| 3433 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3436 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3434 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3437 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3435 } | 3438 } |
| 3436 | 3439 |
| 3437 } // namespace content | 3440 } // namespace content |
| OLD | NEW |