Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 1962923002: Fix rendering of flash content inside an out-of-process iframe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removing unneded includes Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 history_list_offset_(-1), 621 history_list_offset_(-1),
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),
632 webview_(nullptr), 631 webview_(nullptr),
633 has_scrolled_focused_editable_node_into_rect_(false), 632 has_scrolled_focused_editable_node_into_rect_(false),
634 page_zoom_level_(params.page_zoom_level), 633 page_zoom_level_(params.page_zoom_level),
635 main_render_frame_(nullptr), 634 main_render_frame_(nullptr),
636 frame_widget_(nullptr), 635 frame_widget_(nullptr),
637 speech_recognition_dispatcher_(NULL), 636 speech_recognition_dispatcher_(NULL),
638 mouse_lock_dispatcher_(NULL), 637 mouse_lock_dispatcher_(NULL),
639 #if defined(OS_ANDROID) 638 #if defined(OS_ANDROID)
640 expected_content_intent_id_(0), 639 expected_content_intent_id_(0),
641 #endif 640 #endif
642 #if defined(ENABLE_PLUGINS)
643 focused_pepper_plugin_(NULL),
644 pepper_last_mouse_event_target_(NULL),
645 #endif
646 enumeration_completion_id_(0), 641 enumeration_completion_id_(0),
647 session_storage_namespace_id_(params.session_storage_namespace_id) { 642 session_storage_namespace_id_(params.session_storage_namespace_id) {
648 GetWidget()->set_owner_delegate(this); 643 GetWidget()->set_owner_delegate(this);
649 } 644 }
650 645
651 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, 646 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params,
652 bool was_created_by_renderer) { 647 bool was_created_by_renderer) {
653 SetRoutingID(params.view_id); 648 SetRoutingID(params.view_id);
654 649
655 int opener_view_routing_id; 650 int opener_view_routing_id;
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { 1145 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) {
1151 observer->RenderViewGone(); 1146 observer->RenderViewGone();
1152 observers_.RemoveObserver(observer); 1147 observers_.RemoveObserver(observer);
1153 } 1148 }
1154 1149
1155 blink::WebView* RenderViewImpl::webview() const { 1150 blink::WebView* RenderViewImpl::webview() const {
1156 return webview_; 1151 return webview_;
1157 } 1152 }
1158 1153
1159 #if defined(ENABLE_PLUGINS) 1154 #if defined(ENABLE_PLUGINS)
1160 void RenderViewImpl::PepperInstanceCreated(
1161 PepperPluginInstanceImpl* instance) {
1162 active_pepper_instances_.insert(instance);
1163
1164 RenderFrameImpl* const render_frame = instance->render_frame();
1165 render_frame->Send(
1166 new FrameHostMsg_PepperInstanceCreated(render_frame->GetRoutingID()));
1167 }
1168
1169 void RenderViewImpl::PepperInstanceDeleted(
1170 PepperPluginInstanceImpl* instance) {
1171 active_pepper_instances_.erase(instance);
1172
1173 if (pepper_last_mouse_event_target_ == instance)
1174 pepper_last_mouse_event_target_ = NULL;
1175 if (focused_pepper_plugin_ == instance)
1176 PepperFocusChanged(instance, false);
1177
1178 RenderFrameImpl* const render_frame = instance->render_frame();
1179 if (render_frame)
1180 render_frame->Send(
1181 new FrameHostMsg_PepperInstanceDeleted(render_frame->GetRoutingID()));
1182 }
1183
1184 void RenderViewImpl::PepperFocusChanged(PepperPluginInstanceImpl* instance,
1185 bool focused) {
1186 if (focused)
1187 focused_pepper_plugin_ = instance;
1188 else if (focused_pepper_plugin_ == instance)
1189 focused_pepper_plugin_ = NULL;
1190
1191 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_NON_IME);
1192 UpdateSelectionBounds();
1193 }
1194 1155
1195 #if defined(OS_MACOSX) 1156 #if defined(OS_MACOSX)
1196 void RenderViewImpl::OnGetRenderedText() { 1157 void RenderViewImpl::OnGetRenderedText() {
1197 if (!webview()) 1158 if (!webview())
1198 return; 1159 return;
1199 1160
1200 if (!webview()->mainFrame()->isWebLocalFrame()) 1161 if (!webview()->mainFrame()->isWebLocalFrame())
1201 return; 1162 return;
1202 1163
1203 // Get rendered text from WebLocalFrame. 1164 // Get rendered text from WebLocalFrame.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 return false; 1212 return false;
1252 } 1213 }
1253 1214
1254 bool RenderViewImpl::RenderWidgetWillHandleMouseEvent( 1215 bool RenderViewImpl::RenderWidgetWillHandleMouseEvent(
1255 const blink::WebMouseEvent& event) { 1216 const blink::WebMouseEvent& event) {
1256 possible_drag_event_info_.event_source = 1217 possible_drag_event_info_.event_source =
1257 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; 1218 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE;
1258 possible_drag_event_info_.event_location = 1219 possible_drag_event_info_.event_location =
1259 gfx::Point(event.globalX, event.globalY); 1220 gfx::Point(event.globalX, event.globalY);
1260 1221
1261 #if defined(ENABLE_PLUGINS)
1262 // This method is called for every mouse event that the render view receives.
1263 // And then the mouse event is forwarded to WebKit, which dispatches it to the
1264 // event target. Potentially a Pepper plugin will receive the event.
1265 // In order to tell whether a plugin gets the last mouse event and which it
1266 // is, we set |pepper_last_mouse_event_target_| to NULL here. If a plugin gets
1267 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
1268 // |pepper_last_mouse_event_target_|.
1269 pepper_last_mouse_event_target_ = NULL;
1270 #endif
1271
1272 // If the mouse is locked, only the current owner of the mouse lock can 1222 // If the mouse is locked, only the current owner of the mouse lock can
1273 // process mouse events. 1223 // process mouse events.
1274 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); 1224 return mouse_lock_dispatcher_->WillHandleMouseEvent(event);
1275 } 1225 }
1276 1226
1277 // IPC::Listener implementation ---------------------------------------------- 1227 // IPC::Listener implementation ----------------------------------------------
1278 1228
1279 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { 1229 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
1280 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; 1230 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL;
1281 if (main_frame && main_frame->isWebLocalFrame()) 1231 if (main_frame && main_frame->isWebLocalFrame())
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2721 2671
2722 top_controls_shrink_blink_size_ = params.top_controls_shrink_blink_size; 2672 top_controls_shrink_blink_size_ = params.top_controls_shrink_blink_size;
2723 top_controls_height_ = params.top_controls_height; 2673 top_controls_height_ = params.top_controls_height;
2724 2674
2725 RenderWidget::OnResize(params); 2675 RenderWidget::OnResize(params);
2726 2676
2727 if (old_visible_viewport_size != visible_viewport_size_) 2677 if (old_visible_viewport_size != visible_viewport_size_)
2728 has_scrolled_focused_editable_node_into_rect_ = false; 2678 has_scrolled_focused_editable_node_into_rect_ = false;
2729 } 2679 }
2730 2680
2731 void RenderViewImpl::RenderWidgetDidCommitAndDrawCompositorFrame() {
2732 #if defined(ENABLE_PLUGINS)
2733 // Notify all instances that we painted. The same caveats apply as for
2734 // ViewFlushedPaint regarding instances closing themselves, so we take
2735 // similar precautions.
2736 PepperPluginSet plugins = active_pepper_instances_;
2737 for (PepperPluginSet::iterator i = plugins.begin(); i != plugins.end(); ++i) {
2738 if (active_pepper_instances_.find(*i) != active_pepper_instances_.end())
2739 (*i)->ViewInitiatedPaint();
2740 }
2741 #endif
2742 }
2743
2744 void RenderViewImpl::RenderWidgetDidFlushPaint() { 2681 void RenderViewImpl::RenderWidgetDidFlushPaint() {
2745 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. 2682 // If the RenderWidget is closing down then early-exit, otherwise we'll crash.
2746 // See crbug.com/112921. 2683 // See crbug.com/112921.
2747 if (!webview()) 2684 if (!webview())
2748 return; 2685 return;
2749 2686
2750 WebFrame* main_frame = webview()->mainFrame(); 2687 WebFrame* main_frame = webview()->mainFrame();
2751 for (WebFrame* frame = main_frame; frame; 2688 for (WebFrame* frame = main_frame; frame;
2752 frame = frame->traverseNext(false)) { 2689 frame = frame->traverseNext(false)) {
2753 // TODO(nasko): This is a hack for the case in which the top-level 2690 // TODO(nasko): This is a hack for the case in which the top-level
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2826 2763
2827 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) 2764 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
2828 RenderThreadImpl::current()->video_capture_impl_manager()-> 2765 RenderThreadImpl::current()->video_capture_impl_manager()->
2829 SuspendDevices(true); 2766 SuspendDevices(true);
2830 if (speech_recognition_dispatcher_) 2767 if (speech_recognition_dispatcher_)
2831 speech_recognition_dispatcher_->AbortAllRecognitions(); 2768 speech_recognition_dispatcher_->AbortAllRecognitions();
2832 #endif 2769 #endif
2833 2770
2834 if (webview()) 2771 if (webview())
2835 webview()->setVisibilityState(visibilityState(), false); 2772 webview()->setVisibilityState(visibilityState(), false);
2836
2837 #if defined(ENABLE_PLUGINS)
2838 for (PepperPluginSet::iterator i = active_pepper_instances_.begin();
2839 i != active_pepper_instances_.end(); ++i)
2840 (*i)->PageVisibilityChanged(false);
2841 #endif // ENABLE_PLUGINS
2842 } 2773 }
2843 2774
2844 void RenderViewImpl::OnWasShown(bool needs_repainting, 2775 void RenderViewImpl::OnWasShown(bool needs_repainting,
2845 const ui::LatencyInfo& latency_info) { 2776 const ui::LatencyInfo& latency_info) {
2846 RenderWidget::OnWasShown(needs_repainting, latency_info); 2777 RenderWidget::OnWasShown(needs_repainting, latency_info);
2847 2778
2848 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) 2779 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
2849 RenderThreadImpl::current()->video_capture_impl_manager()-> 2780 RenderThreadImpl::current()->video_capture_impl_manager()->
2850 SuspendDevices(false); 2781 SuspendDevices(false);
2851 #endif 2782 #endif
2852 2783
2853 if (webview()) 2784 if (webview())
2854 webview()->setVisibilityState(visibilityState(), false); 2785 webview()->setVisibilityState(visibilityState(), false);
2855
2856 #if defined(ENABLE_PLUGINS)
2857 for (PepperPluginSet::iterator i = active_pepper_instances_.begin();
2858 i != active_pepper_instances_.end(); ++i)
2859 (*i)->PageVisibilityChanged(true);
2860 #endif // ENABLE_PLUGINS
2861 } 2786 }
2862 2787
2863 GURL RenderViewImpl::GetURLForGraphicsContext3D() { 2788 GURL RenderViewImpl::GetURLForGraphicsContext3D() {
2864 DCHECK(webview()); 2789 DCHECK(webview());
2865 if (webview()->mainFrame()->isWebLocalFrame()) 2790 if (webview()->mainFrame()->isWebLocalFrame())
2866 return GURL(webview()->mainFrame()->document().url()); 2791 return GURL(webview()->mainFrame()->document().url());
2867 else 2792 else
2868 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); 2793 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D");
2869 } 2794 }
2870 2795
2871 void RenderViewImpl::OnSetFocus(bool enable) { 2796 void RenderViewImpl::OnSetFocus(bool enable) {
2872 // This message must always be received when the main frame is a 2797 // This message must always be received when the main frame is a
2873 // WebLocalFrame. 2798 // WebLocalFrame.
2874 CHECK(webview()->mainFrame()->isWebLocalFrame()); 2799 CHECK(webview()->mainFrame()->isWebLocalFrame());
2875 SetFocus(enable); 2800 SetFocus(enable);
2876 } 2801 }
2877 2802
2878 void RenderViewImpl::SetFocus(bool enable) { 2803 void RenderViewImpl::SetFocus(bool enable) {
2879 has_focus_ = enable;
2880 RenderWidget::OnSetFocus(enable); 2804 RenderWidget::OnSetFocus(enable);
2881 2805
2882 #if defined(ENABLE_PLUGINS)
2883 // Notify all Pepper plugins.
2884 for (PepperPluginSet::iterator i = active_pepper_instances_.begin();
2885 i != active_pepper_instances_.end(); ++i)
2886 (*i)->SetContentAreaFocus(enable);
2887 #endif
2888 // Notify all BrowserPlugins of the RenderView's focus state. 2806 // Notify all BrowserPlugins of the RenderView's focus state.
2889 if (BrowserPluginManager::Get()) 2807 if (BrowserPluginManager::Get())
2890 BrowserPluginManager::Get()->UpdateFocusState(); 2808 BrowserPluginManager::Get()->UpdateFocusState();
2891 } 2809 }
2892 2810
2893 void RenderViewImpl::OnImeSetComposition( 2811 void RenderViewImpl::OnImeSetComposition(
2894 const base::string16& text, 2812 const base::string16& text,
2895 const std::vector<blink::WebCompositionUnderline>& underlines, 2813 const std::vector<blink::WebCompositionUnderline>& underlines,
2896 const gfx::Range& replacement_range, 2814 const gfx::Range& replacement_range,
2897 int selection_start, 2815 int selection_start,
2898 int selection_end) { 2816 int selection_end) {
2899 #if defined(ENABLE_PLUGINS) 2817 #if defined(ENABLE_PLUGINS)
2900 if (focused_pepper_plugin_) { 2818 PepperPluginInstanceImpl* focused_pepper_plugin = GetFocusedPepperPlugin();
2901 focused_pepper_plugin_->render_frame()->OnImeSetComposition( 2819 if (focused_pepper_plugin) {
2820 focused_pepper_plugin->render_frame()->OnImeSetComposition(
2902 text, underlines, selection_start, selection_end); 2821 text, underlines, selection_start, selection_end);
2903 return; 2822 return;
2904 } 2823 }
2905 #endif // ENABLE_PLUGINS 2824 #endif // ENABLE_PLUGINS
2906 if (replacement_range.IsValid() && webview()) { 2825 if (replacement_range.IsValid() && webview()) {
2907 // Select the text in |replacement_range|, it will then be replaced by 2826 // Select the text in |replacement_range|, it will then be replaced by
2908 // text added by the call to RenderWidget::OnImeSetComposition(). 2827 // text added by the call to RenderWidget::OnImeSetComposition().
2909 if (WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame()) { 2828 if (WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame()) {
2910 WebRange webrange = WebRange::fromDocumentRange( 2829 WebRange webrange = WebRange::fromDocumentRange(
2911 frame, replacement_range.start(), replacement_range.length()); 2830 frame, replacement_range.start(), replacement_range.length());
2912 if (!webrange.isNull()) 2831 if (!webrange.isNull())
2913 frame->selectRange(webrange); 2832 frame->selectRange(webrange);
2914 } 2833 }
2915 } 2834 }
2916 RenderWidget::OnImeSetComposition(text, 2835 RenderWidget::OnImeSetComposition(text,
2917 underlines, 2836 underlines,
2918 replacement_range, 2837 replacement_range,
2919 selection_start, 2838 selection_start,
2920 selection_end); 2839 selection_end);
2921 } 2840 }
2922 2841
2923 void RenderViewImpl::OnImeConfirmComposition( 2842 void RenderViewImpl::OnImeConfirmComposition(
2924 const base::string16& text, 2843 const base::string16& text,
2925 const gfx::Range& replacement_range, 2844 const gfx::Range& replacement_range,
2926 bool keep_selection) { 2845 bool keep_selection) {
2927 #if defined(ENABLE_PLUGINS) 2846 #if defined(ENABLE_PLUGINS)
2928 if (focused_pepper_plugin_) { 2847 PepperPluginInstanceImpl* focused_pepper_plugin = GetFocusedPepperPlugin();
2929 focused_pepper_plugin_->render_frame()->OnImeConfirmComposition( 2848 if (focused_pepper_plugin) {
2849 focused_pepper_plugin->render_frame()->OnImeConfirmComposition(
2930 text, replacement_range, keep_selection); 2850 text, replacement_range, keep_selection);
2931 return; 2851 return;
2932 } 2852 }
2933 #endif // ENABLE_PLUGINS 2853 #endif // ENABLE_PLUGINS
2934 if (replacement_range.IsValid() && webview()) { 2854 if (replacement_range.IsValid() && webview()) {
2935 // Select the text in |replacement_range|, it will then be replaced by 2855 // Select the text in |replacement_range|, it will then be replaced by
2936 // text added by the call to RenderWidget::OnImeConfirmComposition(). 2856 // text added by the call to RenderWidget::OnImeConfirmComposition().
2937 if (WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame()) { 2857 if (WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame()) {
2938 WebRange webrange = WebRange::fromDocumentRange( 2858 WebRange webrange = WebRange::fromDocumentRange(
2939 frame, replacement_range.start(), replacement_range.length()); 2859 frame, replacement_range.start(), replacement_range.length());
(...skipping 15 matching lines...) Expand all
2955 webview()->resetDeviceColorProfileForTesting(); 2875 webview()->resetDeviceColorProfileForTesting();
2956 } else { 2876 } else {
2957 WebVector<char> colorProfile = profile; 2877 WebVector<char> colorProfile = profile;
2958 webview()->setDeviceColorProfile(colorProfile); 2878 webview()->setDeviceColorProfile(colorProfile);
2959 } 2879 }
2960 } 2880 }
2961 } 2881 }
2962 2882
2963 ui::TextInputType RenderViewImpl::GetTextInputType() { 2883 ui::TextInputType RenderViewImpl::GetTextInputType() {
2964 #if defined(ENABLE_PLUGINS) 2884 #if defined(ENABLE_PLUGINS)
2965 if (focused_pepper_plugin_) 2885 PepperPluginInstanceImpl* focused_pepper_plugin = GetFocusedPepperPlugin();
2966 return focused_pepper_plugin_->text_input_type(); 2886 if (focused_pepper_plugin)
2887 return focused_pepper_plugin->text_input_type();
2967 #endif 2888 #endif
2968 return RenderWidget::GetTextInputType(); 2889 return RenderWidget::GetTextInputType();
2969 } 2890 }
2970 2891
2971 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) { 2892 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) {
2972 #if defined(ENABLE_PLUGINS) 2893 #if defined(ENABLE_PLUGINS)
2973 if (focused_pepper_plugin_) { 2894 PepperPluginInstanceImpl* focused_pepper_plugin = GetFocusedPepperPlugin();
2895 if (focused_pepper_plugin) {
2974 // TODO(kinaba) http://crbug.com/101101 2896 // TODO(kinaba) http://crbug.com/101101
2975 // Current Pepper IME API does not handle selection bounds. So we simply 2897 // Current Pepper IME API does not handle selection bounds. So we simply
2976 // use the caret position as an empty range for now. It will be updated 2898 // use the caret position as an empty range for now. It will be updated
2977 // after Pepper API equips features related to surrounding text retrieval. 2899 // after Pepper API equips features related to surrounding text retrieval.
2978 blink::WebRect caret(focused_pepper_plugin_->GetCaretBounds()); 2900 blink::WebRect caret(focused_pepper_plugin->GetCaretBounds());
2979 ConvertViewportToWindowViaWidget(&caret); 2901 ConvertViewportToWindowViaWidget(&caret);
2980 *start = caret; 2902 *start = caret;
2981 *end = caret; 2903 *end = caret;
2982 return; 2904 return;
2983 } 2905 }
2984 #endif 2906 #endif
2985 RenderWidget::GetSelectionBounds(start, end); 2907 RenderWidget::GetSelectionBounds(start, end);
2986 } 2908 }
2987 2909
2988 void RenderViewImpl::GetCompositionCharacterBounds( 2910 void RenderViewImpl::GetCompositionCharacterBounds(
2989 std::vector<gfx::Rect>* bounds_in_window) { 2911 std::vector<gfx::Rect>* bounds_in_window) {
2990 DCHECK(bounds_in_window); 2912 DCHECK(bounds_in_window);
2991 bounds_in_window->clear(); 2913 bounds_in_window->clear();
2992 2914
2993 #if defined(ENABLE_PLUGINS) 2915 #if defined(ENABLE_PLUGINS)
2994 if (focused_pepper_plugin_) { 2916 PepperPluginInstanceImpl* focused_pepper_plugin = GetFocusedPepperPlugin();
2917 if (focused_pepper_plugin)
2995 return; 2918 return;
2996 }
2997 #endif 2919 #endif
2998 2920
2999 if (!webview()) 2921 if (!webview())
3000 return; 2922 return;
3001 size_t start_offset = 0; 2923 size_t start_offset = 0;
3002 size_t character_count = 0; 2924 size_t character_count = 0;
3003 if (!webview()->compositionRange(&start_offset, &character_count)) 2925 if (!webview()->compositionRange(&start_offset, &character_count))
3004 return; 2926 return;
3005 if (character_count == 0) 2927 if (character_count == 0)
3006 return; 2928 return;
(...skipping 10 matching lines...) Expand all
3017 bounds_in_window->clear(); 2939 bounds_in_window->clear();
3018 return; 2940 return;
3019 } 2941 }
3020 ConvertViewportToWindowViaWidget(&webrect); 2942 ConvertViewportToWindowViaWidget(&webrect);
3021 bounds_in_window->push_back(webrect); 2943 bounds_in_window->push_back(webrect);
3022 } 2944 }
3023 } 2945 }
3024 2946
3025 void RenderViewImpl::GetCompositionRange(gfx::Range* range) { 2947 void RenderViewImpl::GetCompositionRange(gfx::Range* range) {
3026 #if defined(ENABLE_PLUGINS) 2948 #if defined(ENABLE_PLUGINS)
3027 if (focused_pepper_plugin_) { 2949 PepperPluginInstanceImpl* focused_pepper_plugin = GetFocusedPepperPlugin();
2950 if (focused_pepper_plugin)
3028 return; 2951 return;
3029 }
3030 #endif 2952 #endif
3031 RenderWidget::GetCompositionRange(range); 2953 RenderWidget::GetCompositionRange(range);
3032 } 2954 }
3033 2955
3034 bool RenderViewImpl::CanComposeInline() { 2956 bool RenderViewImpl::CanComposeInline() {
3035 #if defined(ENABLE_PLUGINS) 2957 #if defined(ENABLE_PLUGINS)
3036 if (focused_pepper_plugin_) 2958 PepperPluginInstanceImpl* focused_pepper_plugin = GetFocusedPepperPlugin();
3037 return focused_pepper_plugin_->IsPluginAcceptingCompositionEvents(); 2959 if (focused_pepper_plugin)
2960 return focused_pepper_plugin->IsPluginAcceptingCompositionEvents();
3038 #endif 2961 #endif
3039 return true; 2962 return true;
3040 } 2963 }
3041 2964
3042 void RenderViewImpl::DidCompletePageScaleAnimation() { 2965 void RenderViewImpl::DidCompletePageScaleAnimation() {
3043 GetWidget()->FocusChangeComplete(); 2966 GetWidget()->FocusChangeComplete();
3044 } 2967 }
3045 2968
3046 void RenderViewImpl::OnDeviceScaleFactorChanged() { 2969 void RenderViewImpl::OnDeviceScaleFactorChanged() {
3047 RenderWidget::OnDeviceScaleFactorChanged(); 2970 RenderWidget::OnDeviceScaleFactorChanged();
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
3426 return; 3349 return;
3427 if (IsUseZoomForDSFEnabled()) { 3350 if (IsUseZoomForDSFEnabled()) {
3428 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); 3351 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_);
3429 } else { 3352 } else {
3430 webview()->setDeviceScaleFactor(device_scale_factor_); 3353 webview()->setDeviceScaleFactor(device_scale_factor_);
3431 } 3354 }
3432 webview()->settings()->setPreferCompositingToLCDTextEnabled( 3355 webview()->settings()->setPreferCompositingToLCDTextEnabled(
3433 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); 3356 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_));
3434 } 3357 }
3435 3358
3359 #if defined(ENABLE_PLUGINS)
3360 PepperPluginInstanceImpl* RenderViewImpl::GetFocusedPepperPlugin() {
3361 blink::WebFrame* frame = GetWebView()->mainFrame();
3362
3363 while (frame) {
3364 if (frame->isWebLocalFrame()) {
3365 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame);
3366 if (render_frame->focused_pepper_plugin())
3367 return render_frame->focused_pepper_plugin();
3368 }
3369 frame = frame->traverseNext(false);
3370 }
3371
3372 return nullptr;
3373 }
3374 #endif
3375
3436 } // namespace content 3376 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698