Chromium Code Reviews| 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 718 | 718 |
| 719 UpdateWebViewWithDeviceScaleFactor(); | 719 UpdateWebViewWithDeviceScaleFactor(); |
| 720 OnSetRendererPrefs(params.renderer_preferences); | 720 OnSetRendererPrefs(params.renderer_preferences); |
| 721 | 721 |
| 722 if (!params.enable_auto_resize) { | 722 if (!params.enable_auto_resize) { |
| 723 OnResize(params.initial_size); | 723 OnResize(params.initial_size); |
| 724 } else { | 724 } else { |
| 725 OnEnableAutoResize(params.min_size, params.max_size); | 725 OnEnableAutoResize(params.min_size, params.max_size); |
| 726 } | 726 } |
| 727 | 727 |
| 728 new IdleUserDetector(this); | 728 idle_user_detector_.reset(new IdleUserDetector(this)); |
| 729 | 729 |
| 730 GetContentClient()->renderer()->RenderViewCreated(this); | 730 GetContentClient()->renderer()->RenderViewCreated(this); |
| 731 | 731 |
| 732 // Ensure that sandbox flags are inherited from an opener in a different | 732 // Ensure that sandbox flags are inherited from an opener in a different |
| 733 // process. In that case, the browser process will set any inherited sandbox | 733 // process. In that case, the browser process will set any inherited sandbox |
| 734 // flags in |replicated_frame_state|, so apply them here. | 734 // flags in |replicated_frame_state|, so apply them here. |
| 735 if (!was_created_by_renderer && webview()->MainFrame()->IsWebLocalFrame()) { | 735 if (!was_created_by_renderer && webview()->MainFrame()->IsWebLocalFrame()) { |
| 736 webview()->MainFrame()->ToWebLocalFrame()->ForceSandboxFlags( | 736 webview()->MainFrame()->ToWebLocalFrame()->ForceSandboxFlags( |
| 737 params.replicated_frame_state.sandbox_flags); | 737 params.replicated_frame_state.sandbox_flags); |
| 738 } | 738 } |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 758 // Make sure we are no longer referenced by the ViewMap or RoutingIDViewMap. | 758 // Make sure we are no longer referenced by the ViewMap or RoutingIDViewMap. |
| 759 ViewMap* views = g_view_map.Pointer(); | 759 ViewMap* views = g_view_map.Pointer(); |
| 760 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) | 760 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) |
| 761 DCHECK_NE(this, it->second) << "Failed to call Close?"; | 761 DCHECK_NE(this, it->second) << "Failed to call Close?"; |
| 762 RoutingIDViewMap* routing_id_views = g_routing_id_view_map.Pointer(); | 762 RoutingIDViewMap* routing_id_views = g_routing_id_view_map.Pointer(); |
| 763 for (RoutingIDViewMap::iterator it = routing_id_views->begin(); | 763 for (RoutingIDViewMap::iterator it = routing_id_views->begin(); |
| 764 it != routing_id_views->end(); ++it) | 764 it != routing_id_views->end(); ++it) |
| 765 DCHECK_NE(this, it->second) << "Failed to call Close?"; | 765 DCHECK_NE(this, it->second) << "Failed to call Close?"; |
| 766 #endif | 766 #endif |
| 767 | 767 |
| 768 idle_user_detector_.reset(); | |
| 768 for (auto& observer : observers_) | 769 for (auto& observer : observers_) |
| 769 observer.RenderViewGone(); | 770 observer.RenderViewGone(); |
| 770 for (auto& observer : observers_) | 771 for (auto& observer : observers_) |
| 771 observer.OnDestruct(); | 772 observer.OnDestruct(); |
| 772 } | 773 } |
| 773 | 774 |
| 774 /*static*/ | 775 /*static*/ |
| 775 RenderViewImpl* RenderViewImpl::FromWebView(WebView* webview) { | 776 RenderViewImpl* RenderViewImpl::FromWebView(WebView* webview) { |
| 776 ViewMap* views = g_view_map.Pointer(); | 777 ViewMap* views = g_view_map.Pointer(); |
| 777 ViewMap::iterator it = views->find(webview); | 778 ViewMap::iterator it = views->find(webview); |
| (...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2654 } | 2655 } |
| 2655 webview()->GetSettings()->SetPreferCompositingToLCDTextEnabled( | 2656 webview()->GetSettings()->SetPreferCompositingToLCDTextEnabled( |
| 2656 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 2657 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 2657 } | 2658 } |
| 2658 | 2659 |
| 2659 void RenderViewImpl::OnDiscardInputEvent( | 2660 void RenderViewImpl::OnDiscardInputEvent( |
| 2660 const blink::WebInputEvent* input_event, | 2661 const blink::WebInputEvent* input_event, |
| 2661 const std::vector<const blink::WebInputEvent*>& coalesced_events, | 2662 const std::vector<const blink::WebInputEvent*>& coalesced_events, |
| 2662 const ui::LatencyInfo& latency_info, | 2663 const ui::LatencyInfo& latency_info, |
| 2663 InputEventDispatchType dispatch_type) { | 2664 InputEventDispatchType dispatch_type) { |
| 2664 if (!input_event || (dispatch_type != DISPATCH_TYPE_BLOCKING && | 2665 if (!input_event || dispatch_type != DISPATCH_TYPE_BLOCKING) { |
|
tdresser
2017/04/10 15:54:17
== DISPATCH_TYPE_NONBLOCKING?
dtapuska
2017/04/13 16:56:24
Done.
| |
| 2665 dispatch_type != DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN)) { | |
| 2666 return; | 2666 return; |
| 2667 } | 2667 } |
| 2668 | 2668 |
| 2669 if (dispatch_type == DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN) { | |
| 2670 NotifyInputEventHandled(input_event->GetType(), | |
| 2671 blink::WebInputEventResult::kNotHandled, | |
| 2672 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2673 } | |
| 2674 | |
| 2675 std::unique_ptr<InputEventAck> ack(new InputEventAck( | 2669 std::unique_ptr<InputEventAck> ack(new InputEventAck( |
| 2676 InputEventAckSource::MAIN_THREAD, input_event->GetType(), | 2670 InputEventAckSource::MAIN_THREAD, input_event->GetType(), |
| 2677 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2671 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 2678 OnInputEventAck(std::move(ack)); | 2672 OnInputEventAck(std::move(ack)); |
| 2679 } | 2673 } |
| 2680 | 2674 |
| 2675 InputEventAckState RenderViewImpl::HandleInputEvent( | |
| 2676 const blink::WebCoalescedInputEvent& input_event, | |
| 2677 const ui::LatencyInfo& latency_info, | |
| 2678 InputEventDispatchType dispatch_type) { | |
| 2679 if (is_swapped_out_) { | |
| 2680 OnDiscardInputEvent(&input_event.Event(), | |
| 2681 input_event.GetCoalescedEventsPointers(), latency_info, | |
| 2682 dispatch_type); | |
| 2683 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | |
| 2684 } | |
| 2685 idle_user_detector_->HandleInputMessageReceived(); | |
| 2686 return RenderWidget::HandleInputEvent(input_event, latency_info, | |
| 2687 dispatch_type); | |
| 2688 } | |
| 2689 | |
| 2681 } // namespace content | 2690 } // namespace content |
| OLD | NEW |