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 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 #include "content/renderer/load_progress_tracker.h" | 81 #include "content/renderer/load_progress_tracker.h" |
82 #include "content/renderer/media/media_stream_dependency_factory.h" | 82 #include "content/renderer/media/media_stream_dependency_factory.h" |
83 #include "content/renderer/media/media_stream_dispatcher.h" | 83 #include "content/renderer/media/media_stream_dispatcher.h" |
84 #include "content/renderer/media/media_stream_impl.h" | 84 #include "content/renderer/media/media_stream_impl.h" |
85 #include "content/renderer/media/render_audiosourceprovider.h" | 85 #include "content/renderer/media/render_audiosourceprovider.h" |
86 #include "content/renderer/media/render_media_log.h" | 86 #include "content/renderer/media/render_media_log.h" |
87 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" | 87 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" |
88 #include "content/renderer/media/rtc_peer_connection_handler.h" | 88 #include "content/renderer/media/rtc_peer_connection_handler.h" |
89 #include "content/renderer/mhtml_generator.h" | 89 #include "content/renderer/mhtml_generator.h" |
90 #include "content/renderer/notification_provider.h" | 90 #include "content/renderer/notification_provider.h" |
| 91 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
91 #include "content/renderer/plugin_channel_host.h" | 92 #include "content/renderer/plugin_channel_host.h" |
92 #include "content/renderer/render_process.h" | 93 #include "content/renderer/render_process.h" |
93 #include "content/renderer/render_thread_impl.h" | 94 #include "content/renderer/render_thread_impl.h" |
94 #include "content/renderer/render_view_impl_params.h" | 95 #include "content/renderer/render_view_impl_params.h" |
95 #include "content/renderer/render_view_mouse_lock_dispatcher.h" | 96 #include "content/renderer/render_view_mouse_lock_dispatcher.h" |
96 #include "content/renderer/render_widget_fullscreen_pepper.h" | 97 #include "content/renderer/render_widget_fullscreen_pepper.h" |
97 #include "content/renderer/renderer_accessibility.h" | 98 #include "content/renderer/renderer_accessibility.h" |
98 #include "content/renderer/renderer_accessibility_complete.h" | 99 #include "content/renderer/renderer_accessibility_complete.h" |
99 #include "content/renderer/renderer_accessibility_focus_only.h" | 100 #include "content/renderer/renderer_accessibility_focus_only.h" |
100 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 101 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 #include "webkit/glue/webkit_constants.h" | 193 #include "webkit/glue/webkit_constants.h" |
193 #include "webkit/glue/webkit_glue.h" | 194 #include "webkit/glue/webkit_glue.h" |
194 #include "webkit/glue/weburlresponse_extradata_impl.h" | 195 #include "webkit/glue/weburlresponse_extradata_impl.h" |
195 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 196 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
196 #include "webkit/media/webmediaplayer_impl.h" | 197 #include "webkit/media/webmediaplayer_impl.h" |
197 #include "webkit/media/webmediaplayer_ms.h" | 198 #include "webkit/media/webmediaplayer_ms.h" |
198 #include "webkit/plugins/npapi/plugin_list.h" | 199 #include "webkit/plugins/npapi/plugin_list.h" |
199 #include "webkit/plugins/npapi/webplugin_delegate.h" | 200 #include "webkit/plugins/npapi/webplugin_delegate.h" |
200 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 201 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
201 #include "webkit/plugins/npapi/webplugin_impl.h" | 202 #include "webkit/plugins/npapi/webplugin_impl.h" |
202 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" | |
203 | 203 |
204 #if defined(OS_ANDROID) | 204 #if defined(OS_ANDROID) |
205 #include "content/common/android/device_info.h" | 205 #include "content/common/android/device_info.h" |
206 #include "content/renderer/android/address_detector.h" | 206 #include "content/renderer/android/address_detector.h" |
207 #include "content/renderer/android/content_detector.h" | 207 #include "content/renderer/android/content_detector.h" |
208 #include "content/renderer/android/email_detector.h" | 208 #include "content/renderer/android/email_detector.h" |
209 #include "content/renderer/android/phone_number_detector.h" | 209 #include "content/renderer/android/phone_number_detector.h" |
210 #include "content/renderer/media/stream_texture_factory_impl_android.h" | 210 #include "content/renderer/media/stream_texture_factory_impl_android.h" |
211 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" | 211 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" |
212 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" | 212 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 load_progress_tracker_(new LoadProgressTracker(this))), | 601 load_progress_tracker_(new LoadProgressTracker(this))), |
602 #endif | 602 #endif |
603 session_storage_namespace_id_(params->session_storage_namespace_id), | 603 session_storage_namespace_id_(params->session_storage_namespace_id), |
604 handling_select_range_(false), | 604 handling_select_range_(false), |
605 #if defined(OS_WIN) | 605 #if defined(OS_WIN) |
606 focused_plugin_id_(-1), | 606 focused_plugin_id_(-1), |
607 #endif | 607 #endif |
608 updating_frame_tree_(false), | 608 updating_frame_tree_(false), |
609 pending_frame_tree_update_(false), | 609 pending_frame_tree_update_(false), |
610 target_process_id_(0), | 610 target_process_id_(0), |
611 target_routing_id_(0), | 611 target_routing_id_(0) { |
612 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { | 612 #if defined(ENABLE_PLUGINS) |
| 613 pepper_helper_.reset(new PepperPluginDelegateImpl(this)); |
| 614 #else |
| 615 pepper_helper_.reset(new RenderViewPepperHelper()); |
| 616 #endif |
613 set_throttle_input_events(params->renderer_prefs.throttle_input_events); | 617 set_throttle_input_events(params->renderer_prefs.throttle_input_events); |
614 routing_id_ = params->routing_id; | 618 routing_id_ = params->routing_id; |
615 surface_id_ = params->surface_id; | 619 surface_id_ = params->surface_id; |
616 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) | 620 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) |
617 opener_id_ = params->opener_id; | 621 opener_id_ = params->opener_id; |
618 | 622 |
619 // Ensure we start with a valid next_page_id_ from the browser. | 623 // Ensure we start with a valid next_page_id_ from the browser. |
620 DCHECK_GE(next_page_id_, 0); | 624 DCHECK_GE(next_page_id_, 0); |
621 | 625 |
622 #if defined(ENABLE_NOTIFICATIONS) | 626 #if defined(ENABLE_NOTIFICATIONS) |
(...skipping 3745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4368 } | 4372 } |
4369 } | 4373 } |
4370 | 4374 |
4371 return false; | 4375 return false; |
4372 } | 4376 } |
4373 | 4377 |
4374 WebKit::WebPlugin* RenderViewImpl::CreatePlugin( | 4378 WebKit::WebPlugin* RenderViewImpl::CreatePlugin( |
4375 WebKit::WebFrame* frame, | 4379 WebKit::WebFrame* frame, |
4376 const webkit::WebPluginInfo& info, | 4380 const webkit::WebPluginInfo& info, |
4377 const WebKit::WebPluginParams& params) { | 4381 const WebKit::WebPluginParams& params) { |
4378 bool pepper_plugin_was_registered = false; | 4382 WebKit::WebPlugin* pepper_webplugin = |
4379 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( | 4383 pepper_helper_->CreatePepperWebPlugin(info, params); |
4380 pepper_delegate_.CreatePepperPluginModule(info, | 4384 |
4381 &pepper_plugin_was_registered)); | 4385 if (pepper_webplugin) |
4382 if (pepper_plugin_was_registered) { | 4386 return pepper_webplugin; |
4383 if (!pepper_module) | |
4384 return NULL; | |
4385 return new webkit::ppapi::WebPluginImpl( | |
4386 pepper_module.get(), params, pepper_delegate_.AsWeakPtr()); | |
4387 } | |
4388 | 4387 |
4389 #if defined(USE_AURA) && !defined(OS_WIN) | 4388 #if defined(USE_AURA) && !defined(OS_WIN) |
4390 return NULL; | 4389 return NULL; |
4391 #else | 4390 #else |
4392 return new webkit::npapi::WebPluginImpl( | 4391 return new webkit::npapi::WebPluginImpl( |
4393 frame, params, info.path, AsWeakPtr()); | 4392 frame, params, info.path, AsWeakPtr()); |
4394 #endif | 4393 #endif |
4395 } | 4394 } |
4396 | 4395 |
4397 void RenderViewImpl::EvaluateScript(const string16& frame_xpath, | 4396 void RenderViewImpl::EvaluateScript(const string16& frame_xpath, |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4561 | 4560 |
4562 void RenderViewImpl::SyncSelectionIfRequired() { | 4561 void RenderViewImpl::SyncSelectionIfRequired() { |
4563 WebFrame* frame = webview()->focusedFrame(); | 4562 WebFrame* frame = webview()->focusedFrame(); |
4564 if (!frame) | 4563 if (!frame) |
4565 return; | 4564 return; |
4566 | 4565 |
4567 string16 text; | 4566 string16 text; |
4568 size_t offset; | 4567 size_t offset; |
4569 ui::Range range; | 4568 ui::Range range; |
4570 | 4569 |
4571 if (pepper_delegate_.IsPluginFocused()) { | 4570 if (pepper_helper_->IsPluginFocused()) { |
4572 pepper_delegate_.GetSurroundingText(&text, &range); | 4571 pepper_helper_->GetSurroundingText(&text, &range); |
4573 offset = 0; // Pepper API does not support offset reporting. | 4572 offset = 0; // Pepper API does not support offset reporting. |
4574 // TODO(kinaba): cut as needed. | 4573 // TODO(kinaba): cut as needed. |
4575 } else { | 4574 } else { |
4576 size_t location, length; | 4575 size_t location, length; |
4577 if (!webview()->caretOrSelectionRange(&location, &length)) | 4576 if (!webview()->caretOrSelectionRange(&location, &length)) |
4578 return; | 4577 return; |
4579 | 4578 |
4580 range = ui::Range(location, location + length); | 4579 range = ui::Range(location, location + length); |
4581 | 4580 |
4582 if (webview()->textInputType() != WebKit::WebTextInputTypeNone) { | 4581 if (webview()->textInputType() != WebKit::WebTextInputTypeNone) { |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5531 ShouldDisplayScrollbars(new_size.width(), new_size.height())); | 5530 ShouldDisplayScrollbars(new_size.width(), new_size.height())); |
5532 } | 5531 } |
5533 UpdateScrollState(webview()->mainFrame()); | 5532 UpdateScrollState(webview()->mainFrame()); |
5534 } | 5533 } |
5535 | 5534 |
5536 RenderWidget::OnResize(new_size, resizer_rect, is_fullscreen); | 5535 RenderWidget::OnResize(new_size, resizer_rect, is_fullscreen); |
5537 } | 5536 } |
5538 | 5537 |
5539 void RenderViewImpl::WillInitiatePaint() { | 5538 void RenderViewImpl::WillInitiatePaint() { |
5540 // Notify the pepper plugins that we're about to paint. | 5539 // Notify the pepper plugins that we're about to paint. |
5541 pepper_delegate_.ViewWillInitiatePaint(); | 5540 pepper_helper_->ViewWillInitiatePaint(); |
5542 } | 5541 } |
5543 | 5542 |
5544 void RenderViewImpl::DidInitiatePaint() { | 5543 void RenderViewImpl::DidInitiatePaint() { |
5545 // Notify the pepper plugins that we've painted, and are waiting to flush. | 5544 // Notify the pepper plugins that we've painted, and are waiting to flush. |
5546 pepper_delegate_.ViewInitiatedPaint(); | 5545 pepper_helper_->ViewInitiatedPaint(); |
5547 } | 5546 } |
5548 | 5547 |
5549 void RenderViewImpl::DidFlushPaint() { | 5548 void RenderViewImpl::DidFlushPaint() { |
5550 // Notify any pepper plugins that we painted. This will call into the plugin, | 5549 // Notify any pepper plugins that we painted. This will call into the plugin, |
5551 // and we it may ask to close itself as a result. This will, in turn, modify | 5550 // and we it may ask to close itself as a result. This will, in turn, modify |
5552 // our set, possibly invalidating the iterator. So we iterate on a copy that | 5551 // our set, possibly invalidating the iterator. So we iterate on a copy that |
5553 // won't change out from under us. | 5552 // won't change out from under us. |
5554 pepper_delegate_.ViewFlushedPaint(); | 5553 pepper_helper_->ViewFlushedPaint(); |
5555 | 5554 |
5556 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. | 5555 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. |
5557 // See crbug.com/112921. | 5556 // See crbug.com/112921. |
5558 if (!webview()) | 5557 if (!webview()) |
5559 return; | 5558 return; |
5560 | 5559 |
5561 WebFrame* main_frame = webview()->mainFrame(); | 5560 WebFrame* main_frame = webview()->mainFrame(); |
5562 | 5561 |
5563 // If we have a provisional frame we are between the start and commit stages | 5562 // If we have a provisional frame we are between the start and commit stages |
5564 // of loading and we don't want to save stats. | 5563 // of loading and we don't want to save stats. |
(...skipping 25 matching lines...) Expand all Loading... |
5590 void RenderViewImpl::OnViewContextSwapBuffersAborted() { | 5589 void RenderViewImpl::OnViewContextSwapBuffersAborted() { |
5591 RenderWidget::OnSwapBuffersAborted(); | 5590 RenderWidget::OnSwapBuffersAborted(); |
5592 } | 5591 } |
5593 | 5592 |
5594 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( | 5593 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( |
5595 const gfx::Rect& paint_bounds, | 5594 const gfx::Rect& paint_bounds, |
5596 TransportDIB** dib, | 5595 TransportDIB** dib, |
5597 gfx::Rect* location, | 5596 gfx::Rect* location, |
5598 gfx::Rect* clip, | 5597 gfx::Rect* clip, |
5599 float* scale_factor) { | 5598 float* scale_factor) { |
5600 return pepper_delegate_.GetBitmapForOptimizedPluginPaint( | 5599 return pepper_helper_->GetBitmapForOptimizedPluginPaint( |
5601 paint_bounds, dib, location, clip, scale_factor); | 5600 paint_bounds, dib, location, clip, scale_factor); |
5602 } | 5601 } |
5603 | 5602 |
5604 gfx::Vector2d RenderViewImpl::GetScrollOffset() { | 5603 gfx::Vector2d RenderViewImpl::GetScrollOffset() { |
5605 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); | 5604 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); |
5606 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); | 5605 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); |
5607 } | 5606 } |
5608 | 5607 |
5609 void RenderViewImpl::OnClearFocusedNode() { | 5608 void RenderViewImpl::OnClearFocusedNode() { |
5610 if (webview()) | 5609 if (webview()) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5711 | 5710 |
5712 void RenderViewImpl::DidHandleKeyEvent() { | 5711 void RenderViewImpl::DidHandleKeyEvent() { |
5713 ClearEditCommands(); | 5712 ClearEditCommands(); |
5714 } | 5713 } |
5715 | 5714 |
5716 bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 5715 bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
5717 possible_drag_event_info_.event_source = | 5716 possible_drag_event_info_.event_source = |
5718 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; | 5717 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; |
5719 possible_drag_event_info_.event_location = | 5718 possible_drag_event_info_.event_location = |
5720 gfx::Point(event.globalX, event.globalY); | 5719 gfx::Point(event.globalX, event.globalY); |
5721 pepper_delegate_.WillHandleMouseEvent(); | 5720 pepper_helper_->WillHandleMouseEvent(); |
5722 | 5721 |
5723 // If the mouse is locked, only the current owner of the mouse lock can | 5722 // If the mouse is locked, only the current owner of the mouse lock can |
5724 // process mouse events. | 5723 // process mouse events. |
5725 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); | 5724 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); |
5726 } | 5725 } |
5727 | 5726 |
5728 bool RenderViewImpl::WillHandleGestureEvent( | 5727 bool RenderViewImpl::WillHandleGestureEvent( |
5729 const WebKit::WebGestureEvent& event) { | 5728 const WebKit::WebGestureEvent& event) { |
5730 possible_drag_event_info_.event_source = | 5729 possible_drag_event_info_.event_source = |
5731 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; | 5730 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; |
(...skipping 28 matching lines...) Expand all Loading... |
5760 media_player_manager_->ReleaseMediaResources(); | 5759 media_player_manager_->ReleaseMediaResources(); |
5761 #endif | 5760 #endif |
5762 | 5761 |
5763 if (webview()) { | 5762 if (webview()) { |
5764 webview()->settings()->setMinimumTimerInterval( | 5763 webview()->settings()->setMinimumTimerInterval( |
5765 webkit_glue::kBackgroundTabTimerInterval); | 5764 webkit_glue::kBackgroundTabTimerInterval); |
5766 webview()->setVisibilityState(visibilityState(), false); | 5765 webview()->setVisibilityState(visibilityState(), false); |
5767 } | 5766 } |
5768 | 5767 |
5769 // Inform PPAPI plugins that their page is no longer visible. | 5768 // Inform PPAPI plugins that their page is no longer visible. |
5770 pepper_delegate_.PageVisibilityChanged(false); | 5769 pepper_helper_->PageVisibilityChanged(false); |
5771 | 5770 |
5772 #if defined(OS_MACOSX) | 5771 #if defined(OS_MACOSX) |
5773 // Inform NPAPI plugins that their container is no longer visible. | 5772 // Inform NPAPI plugins that their container is no longer visible. |
5774 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 5773 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
5775 for (plugin_it = plugin_delegates_.begin(); | 5774 for (plugin_it = plugin_delegates_.begin(); |
5776 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 5775 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
5777 (*plugin_it)->SetContainerVisibility(false); | 5776 (*plugin_it)->SetContainerVisibility(false); |
5778 } | 5777 } |
5779 #endif // OS_MACOSX | 5778 #endif // OS_MACOSX |
5780 } | 5779 } |
5781 | 5780 |
5782 void RenderViewImpl::OnWasShown(bool needs_repainting) { | 5781 void RenderViewImpl::OnWasShown(bool needs_repainting) { |
5783 RenderWidget::OnWasShown(needs_repainting); | 5782 RenderWidget::OnWasShown(needs_repainting); |
5784 | 5783 |
5785 if (webview()) { | 5784 if (webview()) { |
5786 webview()->settings()->setMinimumTimerInterval( | 5785 webview()->settings()->setMinimumTimerInterval( |
5787 webkit_glue::kForegroundTabTimerInterval); | 5786 webkit_glue::kForegroundTabTimerInterval); |
5788 webview()->setVisibilityState(visibilityState(), false); | 5787 webview()->setVisibilityState(visibilityState(), false); |
5789 } | 5788 } |
5790 | 5789 |
5791 // Inform PPAPI plugins that their page is visible. | 5790 // Inform PPAPI plugins that their page is visible. |
5792 pepper_delegate_.PageVisibilityChanged(true); | 5791 pepper_helper_->PageVisibilityChanged(true); |
5793 | 5792 |
5794 #if defined(OS_MACOSX) | 5793 #if defined(OS_MACOSX) |
5795 // Inform NPAPI plugins that their container is now visible. | 5794 // Inform NPAPI plugins that their container is now visible. |
5796 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 5795 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
5797 for (plugin_it = plugin_delegates_.begin(); | 5796 for (plugin_it = plugin_delegates_.begin(); |
5798 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 5797 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
5799 (*plugin_it)->SetContainerVisibility(true); | 5798 (*plugin_it)->SetContainerVisibility(true); |
5800 } | 5799 } |
5801 #endif // OS_MACOSX | 5800 #endif // OS_MACOSX |
5802 } | 5801 } |
(...skipping 23 matching lines...) Expand all Loading... |
5826 #if defined(OS_MACOSX) | 5825 #if defined(OS_MACOSX) |
5827 // RenderWidget's call to setFocus can cause the underlying webview's | 5826 // RenderWidget's call to setFocus can cause the underlying webview's |
5828 // activation state to change just like a call to setIsActive. | 5827 // activation state to change just like a call to setIsActive. |
5829 if (enable) | 5828 if (enable) |
5830 (*plugin_it)->SetWindowFocus(true); | 5829 (*plugin_it)->SetWindowFocus(true); |
5831 #endif | 5830 #endif |
5832 (*plugin_it)->SetContentAreaFocus(enable); | 5831 (*plugin_it)->SetContentAreaFocus(enable); |
5833 } | 5832 } |
5834 } | 5833 } |
5835 // Notify all Pepper plugins. | 5834 // Notify all Pepper plugins. |
5836 pepper_delegate_.OnSetFocus(enable); | 5835 pepper_helper_->OnSetFocus(enable); |
5837 // Notify all BrowserPlugins of the RenderView's focus state. | 5836 // Notify all BrowserPlugins of the RenderView's focus state. |
5838 if (browser_plugin_manager_) | 5837 if (browser_plugin_manager_) |
5839 browser_plugin_manager()->SetEmbedderFocus(this, enable); | 5838 browser_plugin_manager()->SetEmbedderFocus(this, enable); |
5840 } | 5839 } |
5841 | 5840 |
5842 void RenderViewImpl::PpapiPluginFocusChanged() { | 5841 void RenderViewImpl::PpapiPluginFocusChanged() { |
5843 UpdateTextInputState(DO_NOT_SHOW_IME); | 5842 UpdateTextInputState(DO_NOT_SHOW_IME); |
5844 UpdateSelectionBounds(); | 5843 UpdateSelectionBounds(); |
5845 } | 5844 } |
5846 | 5845 |
5847 void RenderViewImpl::PpapiPluginTextInputTypeChanged() { | 5846 void RenderViewImpl::PpapiPluginTextInputTypeChanged() { |
5848 UpdateTextInputState(DO_NOT_SHOW_IME); | 5847 UpdateTextInputState(DO_NOT_SHOW_IME); |
5849 if (renderer_accessibility_) | 5848 if (renderer_accessibility_) |
5850 renderer_accessibility_->FocusedNodeChanged(WebNode()); | 5849 renderer_accessibility_->FocusedNodeChanged(WebNode()); |
5851 } | 5850 } |
5852 | 5851 |
5853 void RenderViewImpl::PpapiPluginCaretPositionChanged() { | 5852 void RenderViewImpl::PpapiPluginCaretPositionChanged() { |
5854 UpdateSelectionBounds(); | 5853 UpdateSelectionBounds(); |
5855 } | 5854 } |
5856 | 5855 |
5857 bool RenderViewImpl::GetPpapiPluginCaretBounds(gfx::Rect* rect) { | 5856 bool RenderViewImpl::GetPpapiPluginCaretBounds(gfx::Rect* rect) { |
5858 if (!pepper_delegate_.IsPluginFocused()) | 5857 if (!pepper_helper_->IsPluginFocused()) |
5859 return false; | 5858 return false; |
5860 *rect = pepper_delegate_.GetCaretBounds(); | 5859 *rect = pepper_helper_->GetCaretBounds(); |
5861 return true; | 5860 return true; |
5862 } | 5861 } |
5863 | 5862 |
5864 void RenderViewImpl::SimulateImeSetComposition( | 5863 void RenderViewImpl::SimulateImeSetComposition( |
5865 const string16& text, | 5864 const string16& text, |
5866 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 5865 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
5867 int selection_start, | 5866 int selection_start, |
5868 int selection_end) { | 5867 int selection_end) { |
5869 OnImeSetComposition(text, underlines, selection_start, selection_end); | 5868 OnImeSetComposition(text, underlines, selection_start, selection_end); |
5870 } | 5869 } |
(...skipping 18 matching lines...) Expand all Loading... |
5889 void RenderViewImpl::PpapiPluginCreated(RendererPpapiHost* host) { | 5888 void RenderViewImpl::PpapiPluginCreated(RendererPpapiHost* host) { |
5890 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 5889 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
5891 DidCreatePepperPlugin(host)); | 5890 DidCreatePepperPlugin(host)); |
5892 } | 5891 } |
5893 | 5892 |
5894 void RenderViewImpl::OnImeSetComposition( | 5893 void RenderViewImpl::OnImeSetComposition( |
5895 const string16& text, | 5894 const string16& text, |
5896 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 5895 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
5897 int selection_start, | 5896 int selection_start, |
5898 int selection_end) { | 5897 int selection_end) { |
5899 if (pepper_delegate_.IsPluginFocused()) { | 5898 if (pepper_helper_->IsPluginFocused()) { |
5900 // When a PPAPI plugin has focus, we bypass WebKit. | 5899 // When a PPAPI plugin has focus, we bypass WebKit. |
5901 pepper_delegate_.OnImeSetComposition(text, | 5900 pepper_helper_->OnImeSetComposition(text, |
5902 underlines, | 5901 underlines, |
5903 selection_start, | 5902 selection_start, |
5904 selection_end); | 5903 selection_end); |
5905 } else { | 5904 } else { |
5906 #if defined(OS_WIN) | 5905 #if defined(OS_WIN) |
5907 // When a plug-in has focus, we create platform-specific IME data used by | 5906 // When a plug-in has focus, we create platform-specific IME data used by |
5908 // our IME emulator and send it directly to the focused plug-in, i.e. we | 5907 // our IME emulator and send it directly to the focused plug-in, i.e. we |
5909 // bypass WebKit. (WebPluginDelegate dispatches this IME data only when its | 5908 // bypass WebKit. (WebPluginDelegate dispatches this IME data only when its |
5910 // instance ID is the same one as the specified ID.) | 5909 // instance ID is the same one as the specified ID.) |
5911 if (focused_plugin_id_ >= 0) { | 5910 if (focused_plugin_id_ >= 0) { |
5912 std::vector<int> clauses; | 5911 std::vector<int> clauses; |
5913 std::vector<int> target; | 5912 std::vector<int> target; |
5914 for (size_t i = 0; i < underlines.size(); ++i) { | 5913 for (size_t i = 0; i < underlines.size(); ++i) { |
(...skipping 16 matching lines...) Expand all Loading... |
5931 #endif | 5930 #endif |
5932 RenderWidget::OnImeSetComposition(text, | 5931 RenderWidget::OnImeSetComposition(text, |
5933 underlines, | 5932 underlines, |
5934 selection_start, | 5933 selection_start, |
5935 selection_end); | 5934 selection_end); |
5936 } | 5935 } |
5937 } | 5936 } |
5938 | 5937 |
5939 void RenderViewImpl::OnImeConfirmComposition( | 5938 void RenderViewImpl::OnImeConfirmComposition( |
5940 const string16& text, const ui::Range& replacement_range) { | 5939 const string16& text, const ui::Range& replacement_range) { |
5941 if (pepper_delegate_.IsPluginFocused()) { | 5940 if (pepper_helper_->IsPluginFocused()) { |
5942 // When a PPAPI plugin has focus, we bypass WebKit. | 5941 // When a PPAPI plugin has focus, we bypass WebKit. |
5943 pepper_delegate_.OnImeConfirmComposition(text); | 5942 pepper_helper_->OnImeConfirmComposition(text); |
5944 } else { | 5943 } else { |
5945 #if defined(OS_WIN) | 5944 #if defined(OS_WIN) |
5946 // Same as OnImeSetComposition(), we send the text from IMEs directly to | 5945 // Same as OnImeSetComposition(), we send the text from IMEs directly to |
5947 // plug-ins. When we send IME text directly to plug-ins, we should not send | 5946 // plug-ins. When we send IME text directly to plug-ins, we should not send |
5948 // it to WebKit to prevent WebKit from controlling IMEs. | 5947 // it to WebKit to prevent WebKit from controlling IMEs. |
5949 // TODO(thakis): Honor |replacement_range| for plugins? | 5948 // TODO(thakis): Honor |replacement_range| for plugins? |
5950 if (focused_plugin_id_ >= 0) { | 5949 if (focused_plugin_id_ >= 0) { |
5951 std::set<WebPluginDelegateProxy*>::iterator it; | 5950 std::set<WebPluginDelegateProxy*>::iterator it; |
5952 for (it = plugin_delegates_.begin(); | 5951 for (it = plugin_delegates_.begin(); |
5953 it != plugin_delegates_.end(); ++it) { | 5952 it != plugin_delegates_.end(); ++it) { |
(...skipping 16 matching lines...) Expand all Loading... |
5970 } | 5969 } |
5971 } | 5970 } |
5972 | 5971 |
5973 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { | 5972 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { |
5974 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 5973 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
5975 if (webview()) | 5974 if (webview()) |
5976 webview()->setDeviceScaleFactor(device_scale_factor); | 5975 webview()->setDeviceScaleFactor(device_scale_factor); |
5977 } | 5976 } |
5978 | 5977 |
5979 ui::TextInputType RenderViewImpl::GetTextInputType() { | 5978 ui::TextInputType RenderViewImpl::GetTextInputType() { |
5980 return pepper_delegate_.IsPluginFocused() ? | 5979 return pepper_helper_->IsPluginFocused() ? |
5981 pepper_delegate_.GetTextInputType() : RenderWidget::GetTextInputType(); | 5980 pepper_helper_->GetTextInputType() : RenderWidget::GetTextInputType(); |
5982 } | 5981 } |
5983 | 5982 |
5984 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) { | 5983 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) { |
5985 if (pepper_delegate_.IsPluginFocused()) { | 5984 if (pepper_helper_->IsPluginFocused()) { |
5986 // TODO(kinaba) http://crbug.com/101101 | 5985 // TODO(kinaba) http://crbug.com/101101 |
5987 // Current Pepper IME API does not handle selection bounds. So we simply | 5986 // Current Pepper IME API does not handle selection bounds. So we simply |
5988 // use the caret position as an empty range for now. It will be updated | 5987 // use the caret position as an empty range for now. It will be updated |
5989 // after Pepper API equips features related to surrounding text retrieval. | 5988 // after Pepper API equips features related to surrounding text retrieval. |
5990 gfx::Rect caret = pepper_delegate_.GetCaretBounds(); | 5989 gfx::Rect caret = pepper_helper_->GetCaretBounds(); |
5991 *start = caret; | 5990 *start = caret; |
5992 *end = caret; | 5991 *end = caret; |
5993 return; | 5992 return; |
5994 } | 5993 } |
5995 RenderWidget::GetSelectionBounds(start, end); | 5994 RenderWidget::GetSelectionBounds(start, end); |
5996 } | 5995 } |
5997 | 5996 |
5998 void RenderViewImpl::GetCompositionCharacterBounds( | 5997 void RenderViewImpl::GetCompositionCharacterBounds( |
5999 std::vector<gfx::Rect>* bounds) { | 5998 std::vector<gfx::Rect>* bounds) { |
6000 DCHECK(bounds); | 5999 DCHECK(bounds); |
(...skipping 18 matching lines...) Expand all Loading... |
6019 if (!frame->firstRectForCharacterRange(start_offset + i, 1, webrect)) { | 6018 if (!frame->firstRectForCharacterRange(start_offset + i, 1, webrect)) { |
6020 DLOG(ERROR) << "Could not retrieve character rectangle at " << i; | 6019 DLOG(ERROR) << "Could not retrieve character rectangle at " << i; |
6021 bounds->clear(); | 6020 bounds->clear(); |
6022 return; | 6021 return; |
6023 } | 6022 } |
6024 bounds->push_back(webrect); | 6023 bounds->push_back(webrect); |
6025 } | 6024 } |
6026 } | 6025 } |
6027 | 6026 |
6028 bool RenderViewImpl::CanComposeInline() { | 6027 bool RenderViewImpl::CanComposeInline() { |
6029 return pepper_delegate_.IsPluginFocused() ? | 6028 return pepper_helper_->IsPluginFocused() ? |
6030 pepper_delegate_.CanComposeInline() : true; | 6029 pepper_helper_->CanComposeInline() : true; |
6031 } | 6030 } |
6032 | 6031 |
6033 #if defined(OS_WIN) | 6032 #if defined(OS_WIN) |
6034 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { | 6033 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { |
6035 if (focused) | 6034 if (focused) |
6036 focused_plugin_id_ = plugin_id; | 6035 focused_plugin_id_ = plugin_id; |
6037 else | 6036 else |
6038 focused_plugin_id_ = -1; | 6037 focused_plugin_id_ = -1; |
6039 } | 6038 } |
6040 #endif | 6039 #endif |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6275 size_t request_id) { | 6274 size_t request_id) { |
6276 if (request_id != expected_content_intent_id_) | 6275 if (request_id != expected_content_intent_id_) |
6277 return; | 6276 return; |
6278 | 6277 |
6279 // Remove the content highlighting if any. | 6278 // Remove the content highlighting if any. |
6280 scheduleComposite(); | 6279 scheduleComposite(); |
6281 | 6280 |
6282 if (!intent.is_empty()) | 6281 if (!intent.is_empty()) |
6283 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent)); | 6282 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent)); |
6284 } | 6283 } |
6285 #endif | 6284 #endif // defined(OS_ANDROID) |
6286 | 6285 |
6287 void RenderViewImpl::OnAsyncFileOpened( | 6286 void RenderViewImpl::OnAsyncFileOpened( |
6288 base::PlatformFileError error_code, | 6287 base::PlatformFileError error_code, |
6289 IPC::PlatformFileForTransit file_for_transit, | 6288 IPC::PlatformFileForTransit file_for_transit, |
6290 int message_id) { | 6289 int message_id) { |
6291 pepper_delegate_.OnAsyncFileOpened( | 6290 pepper_helper_->OnAsyncFileOpened( |
6292 error_code, | 6291 error_code, |
6293 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), | 6292 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), |
6294 message_id); | 6293 message_id); |
6295 } | 6294 } |
6296 | 6295 |
6297 void RenderViewImpl::OnPpapiBrokerChannelCreated( | 6296 void RenderViewImpl::OnPpapiBrokerChannelCreated( |
6298 int request_id, | 6297 int request_id, |
6299 const IPC::ChannelHandle& handle) { | 6298 const IPC::ChannelHandle& handle) { |
6300 pepper_delegate_.OnPpapiBrokerChannelCreated(request_id, | 6299 pepper_helper_->OnPpapiBrokerChannelCreated(request_id, |
6301 handle); | 6300 handle); |
6302 } | 6301 } |
6303 | 6302 |
6304 void RenderViewImpl::OnPpapiBrokerPermissionResult( | 6303 void RenderViewImpl::OnPpapiBrokerPermissionResult( |
6305 int request_id, | 6304 int request_id, |
6306 bool result) { | 6305 bool result) { |
6307 pepper_delegate_.OnPpapiBrokerPermissionResult(request_id, result); | 6306 pepper_helper_->OnPpapiBrokerPermissionResult(request_id, result); |
6308 } | 6307 } |
6309 | 6308 |
6310 #if defined(OS_MACOSX) | 6309 #if defined(OS_MACOSX) |
6311 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) { | 6310 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) { |
6312 if (external_popup_menu_ == NULL) { | 6311 if (external_popup_menu_ == NULL) { |
6313 // Crash reports from the field indicate that we can be notified with a | 6312 // Crash reports from the field indicate that we can be notified with a |
6314 // NULL external popup menu (we probably get notified twice). | 6313 // NULL external popup menu (we probably get notified twice). |
6315 // If you hit this please file a bug against jcivelli and include the page | 6314 // If you hit this please file a bug against jcivelli and include the page |
6316 // and steps to repro. | 6315 // and steps to repro. |
6317 NOTREACHED(); | 6316 NOTREACHED(); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6438 } | 6437 } |
6439 #endif | 6438 #endif |
6440 | 6439 |
6441 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6440 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6442 TransportDIB::Handle dib_handle) { | 6441 TransportDIB::Handle dib_handle) { |
6443 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6442 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6444 RenderProcess::current()->ReleaseTransportDIB(dib); | 6443 RenderProcess::current()->ReleaseTransportDIB(dib); |
6445 } | 6444 } |
6446 | 6445 |
6447 } // namespace content | 6446 } // namespace content |
OLD | NEW |