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 | 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 598 #endif | 598 #endif |
| 599 session_storage_namespace_id_(params->session_storage_namespace_id), | 599 session_storage_namespace_id_(params->session_storage_namespace_id), |
| 600 handling_select_range_(false), | 600 handling_select_range_(false), |
| 601 #if defined(OS_WIN) | 601 #if defined(OS_WIN) |
| 602 focused_plugin_id_(-1), | 602 focused_plugin_id_(-1), |
| 603 #endif | 603 #endif |
| 604 updating_frame_tree_(false), | 604 updating_frame_tree_(false), |
| 605 pending_frame_tree_update_(false), | 605 pending_frame_tree_update_(false), |
| 606 target_process_id_(0), | 606 target_process_id_(0), |
| 607 target_routing_id_(0), | 607 target_routing_id_(0), |
| 608 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { | 608 #if defined(ENABLE_PPAPI) |
|
brettw
2012/11/30 23:18:12
I think this should just go in the constructor rat
nilesh
2012/12/01 00:41:35
Done.
| |
| 609 ALLOW_THIS_IN_INITIALIZER_LIST( | |
| 610 pepper_delegate_(new PepperPluginDelegateImpl(this))) | |
| 611 #else | |
| 612 pepper_delegate_(new PluginDelegateHelper()) | |
| 613 #endif | |
| 614 { | |
| 609 set_throttle_input_events(params->renderer_prefs.throttle_input_events); | 615 set_throttle_input_events(params->renderer_prefs.throttle_input_events); |
| 610 routing_id_ = params->routing_id; | 616 routing_id_ = params->routing_id; |
| 611 surface_id_ = params->surface_id; | 617 surface_id_ = params->surface_id; |
| 612 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) | 618 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) |
| 613 opener_id_ = params->opener_id; | 619 opener_id_ = params->opener_id; |
| 614 | 620 |
| 615 // Ensure we start with a valid next_page_id_ from the browser. | 621 // Ensure we start with a valid next_page_id_ from the browser. |
| 616 DCHECK_GE(next_page_id_, 0); | 622 DCHECK_GE(next_page_id_, 0); |
| 617 | 623 |
| 618 #if defined(ENABLE_NOTIFICATIONS) | 624 #if defined(ENABLE_NOTIFICATIONS) |
| (...skipping 3736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4355 } | 4361 } |
| 4356 } | 4362 } |
| 4357 | 4363 |
| 4358 return false; | 4364 return false; |
| 4359 } | 4365 } |
| 4360 | 4366 |
| 4361 WebKit::WebPlugin* RenderViewImpl::CreatePlugin( | 4367 WebKit::WebPlugin* RenderViewImpl::CreatePlugin( |
| 4362 WebKit::WebFrame* frame, | 4368 WebKit::WebFrame* frame, |
| 4363 const webkit::WebPluginInfo& info, | 4369 const webkit::WebPluginInfo& info, |
| 4364 const WebKit::WebPluginParams& params) { | 4370 const WebKit::WebPluginParams& params) { |
| 4365 bool pepper_plugin_was_registered = false; | 4371 WebKit::WebPlugin* pepper_webplugin = |
| 4366 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( | 4372 pepper_delegate_->CreatePepperWebPlugin(info, params); |
| 4367 pepper_delegate_.CreatePepperPluginModule(info, | 4373 |
| 4368 &pepper_plugin_was_registered)); | 4374 if (pepper_webplugin) |
| 4369 if (pepper_plugin_was_registered) { | 4375 return pepper_webplugin; |
| 4370 if (!pepper_module) | |
| 4371 return NULL; | |
| 4372 return new webkit::ppapi::WebPluginImpl( | |
| 4373 pepper_module.get(), params, pepper_delegate_.AsWeakPtr()); | |
| 4374 } | |
| 4375 | 4376 |
| 4376 #if defined(USE_AURA) && !defined(OS_WIN) | 4377 #if defined(USE_AURA) && !defined(OS_WIN) |
| 4377 return NULL; | 4378 return NULL; |
| 4378 #else | 4379 #else |
| 4379 return new webkit::npapi::WebPluginImpl( | 4380 return new webkit::npapi::WebPluginImpl( |
| 4380 frame, params, info.path, AsWeakPtr()); | 4381 frame, params, info.path, AsWeakPtr()); |
| 4381 #endif | 4382 #endif |
| 4382 } | 4383 } |
| 4383 | 4384 |
| 4384 void RenderViewImpl::EvaluateScript(const string16& frame_xpath, | 4385 void RenderViewImpl::EvaluateScript(const string16& frame_xpath, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4548 | 4549 |
| 4549 void RenderViewImpl::SyncSelectionIfRequired() { | 4550 void RenderViewImpl::SyncSelectionIfRequired() { |
| 4550 WebFrame* frame = webview()->focusedFrame(); | 4551 WebFrame* frame = webview()->focusedFrame(); |
| 4551 if (!frame) | 4552 if (!frame) |
| 4552 return; | 4553 return; |
| 4553 | 4554 |
| 4554 string16 text; | 4555 string16 text; |
| 4555 size_t offset; | 4556 size_t offset; |
| 4556 ui::Range range; | 4557 ui::Range range; |
| 4557 | 4558 |
| 4558 if (pepper_delegate_.IsPluginFocused()) { | 4559 if (pepper_delegate_->IsPluginFocused()) { |
| 4559 pepper_delegate_.GetSurroundingText(&text, &range); | 4560 pepper_delegate_->GetSurroundingText(&text, &range); |
| 4560 offset = 0; // Pepper API does not support offset reporting. | 4561 offset = 0; // Pepper API does not support offset reporting. |
| 4561 // TODO(kinaba): cut as needed. | 4562 // TODO(kinaba): cut as needed. |
| 4562 } else { | 4563 } else { |
| 4563 size_t location, length; | 4564 size_t location, length; |
| 4564 if (!webview()->caretOrSelectionRange(&location, &length)) | 4565 if (!webview()->caretOrSelectionRange(&location, &length)) |
| 4565 return; | 4566 return; |
| 4566 | 4567 |
| 4567 range = ui::Range(location, location + length); | 4568 range = ui::Range(location, location + length); |
| 4568 | 4569 |
| 4569 if (webview()->textInputType() != WebKit::WebTextInputTypeNone) { | 4570 if (webview()->textInputType() != WebKit::WebTextInputTypeNone) { |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5518 ShouldDisplayScrollbars(new_size.width(), new_size.height())); | 5519 ShouldDisplayScrollbars(new_size.width(), new_size.height())); |
| 5519 } | 5520 } |
| 5520 UpdateScrollState(webview()->mainFrame()); | 5521 UpdateScrollState(webview()->mainFrame()); |
| 5521 } | 5522 } |
| 5522 | 5523 |
| 5523 RenderWidget::OnResize(new_size, resizer_rect, is_fullscreen); | 5524 RenderWidget::OnResize(new_size, resizer_rect, is_fullscreen); |
| 5524 } | 5525 } |
| 5525 | 5526 |
| 5526 void RenderViewImpl::WillInitiatePaint() { | 5527 void RenderViewImpl::WillInitiatePaint() { |
| 5527 // Notify the pepper plugins that we're about to paint. | 5528 // Notify the pepper plugins that we're about to paint. |
| 5528 pepper_delegate_.ViewWillInitiatePaint(); | 5529 pepper_delegate_->ViewWillInitiatePaint(); |
| 5529 } | 5530 } |
| 5530 | 5531 |
| 5531 void RenderViewImpl::DidInitiatePaint() { | 5532 void RenderViewImpl::DidInitiatePaint() { |
| 5532 // Notify the pepper plugins that we've painted, and are waiting to flush. | 5533 // Notify the pepper plugins that we've painted, and are waiting to flush. |
| 5533 pepper_delegate_.ViewInitiatedPaint(); | 5534 pepper_delegate_->ViewInitiatedPaint(); |
| 5534 } | 5535 } |
| 5535 | 5536 |
| 5536 void RenderViewImpl::DidFlushPaint() { | 5537 void RenderViewImpl::DidFlushPaint() { |
| 5537 // Notify any pepper plugins that we painted. This will call into the plugin, | 5538 // Notify any pepper plugins that we painted. This will call into the plugin, |
| 5538 // and we it may ask to close itself as a result. This will, in turn, modify | 5539 // and we it may ask to close itself as a result. This will, in turn, modify |
| 5539 // our set, possibly invalidating the iterator. So we iterate on a copy that | 5540 // our set, possibly invalidating the iterator. So we iterate on a copy that |
| 5540 // won't change out from under us. | 5541 // won't change out from under us. |
| 5541 pepper_delegate_.ViewFlushedPaint(); | 5542 pepper_delegate_->ViewFlushedPaint(); |
| 5542 | 5543 |
| 5543 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. | 5544 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. |
| 5544 // See crbug.com/112921. | 5545 // See crbug.com/112921. |
| 5545 if (!webview()) | 5546 if (!webview()) |
| 5546 return; | 5547 return; |
| 5547 | 5548 |
| 5548 WebFrame* main_frame = webview()->mainFrame(); | 5549 WebFrame* main_frame = webview()->mainFrame(); |
| 5549 | 5550 |
| 5550 // If we have a provisional frame we are between the start and commit stages | 5551 // If we have a provisional frame we are between the start and commit stages |
| 5551 // of loading and we don't want to save stats. | 5552 // of loading and we don't want to save stats. |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 5577 void RenderViewImpl::OnViewContextSwapBuffersAborted() { | 5578 void RenderViewImpl::OnViewContextSwapBuffersAborted() { |
| 5578 RenderWidget::OnSwapBuffersAborted(); | 5579 RenderWidget::OnSwapBuffersAborted(); |
| 5579 } | 5580 } |
| 5580 | 5581 |
| 5581 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( | 5582 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( |
| 5582 const gfx::Rect& paint_bounds, | 5583 const gfx::Rect& paint_bounds, |
| 5583 TransportDIB** dib, | 5584 TransportDIB** dib, |
| 5584 gfx::Rect* location, | 5585 gfx::Rect* location, |
| 5585 gfx::Rect* clip, | 5586 gfx::Rect* clip, |
| 5586 float* scale_factor) { | 5587 float* scale_factor) { |
| 5587 return pepper_delegate_.GetBitmapForOptimizedPluginPaint( | 5588 return pepper_delegate_->GetBitmapForOptimizedPluginPaint( |
| 5588 paint_bounds, dib, location, clip, scale_factor); | 5589 paint_bounds, dib, location, clip, scale_factor); |
| 5589 } | 5590 } |
| 5590 | 5591 |
| 5591 gfx::Vector2d RenderViewImpl::GetScrollOffset() { | 5592 gfx::Vector2d RenderViewImpl::GetScrollOffset() { |
| 5592 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); | 5593 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); |
| 5593 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); | 5594 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); |
| 5594 } | 5595 } |
| 5595 | 5596 |
| 5596 void RenderViewImpl::OnClearFocusedNode() { | 5597 void RenderViewImpl::OnClearFocusedNode() { |
| 5597 if (webview()) | 5598 if (webview()) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5697 | 5698 |
| 5698 void RenderViewImpl::DidHandleKeyEvent() { | 5699 void RenderViewImpl::DidHandleKeyEvent() { |
| 5699 ClearEditCommands(); | 5700 ClearEditCommands(); |
| 5700 } | 5701 } |
| 5701 | 5702 |
| 5702 bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 5703 bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
| 5703 possible_drag_event_info_.event_source = | 5704 possible_drag_event_info_.event_source = |
| 5704 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; | 5705 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; |
| 5705 possible_drag_event_info_.event_location = | 5706 possible_drag_event_info_.event_location = |
| 5706 gfx::Point(event.globalX, event.globalY); | 5707 gfx::Point(event.globalX, event.globalY); |
| 5707 pepper_delegate_.WillHandleMouseEvent(); | 5708 pepper_delegate_->WillHandleMouseEvent(); |
| 5708 | 5709 |
| 5709 // If the mouse is locked, only the current owner of the mouse lock can | 5710 // If the mouse is locked, only the current owner of the mouse lock can |
| 5710 // process mouse events. | 5711 // process mouse events. |
| 5711 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); | 5712 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); |
| 5712 } | 5713 } |
| 5713 | 5714 |
| 5714 bool RenderViewImpl::WillHandleGestureEvent( | 5715 bool RenderViewImpl::WillHandleGestureEvent( |
| 5715 const WebKit::WebGestureEvent& event) { | 5716 const WebKit::WebGestureEvent& event) { |
| 5716 possible_drag_event_info_.event_source = | 5717 possible_drag_event_info_.event_source = |
| 5717 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; | 5718 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 5740 media_player_manager_->ReleaseMediaResources(); | 5741 media_player_manager_->ReleaseMediaResources(); |
| 5741 #endif | 5742 #endif |
| 5742 | 5743 |
| 5743 if (webview()) { | 5744 if (webview()) { |
| 5744 webview()->settings()->setMinimumTimerInterval( | 5745 webview()->settings()->setMinimumTimerInterval( |
| 5745 webkit_glue::kBackgroundTabTimerInterval); | 5746 webkit_glue::kBackgroundTabTimerInterval); |
| 5746 webview()->setVisibilityState(visibilityState(), false); | 5747 webview()->setVisibilityState(visibilityState(), false); |
| 5747 } | 5748 } |
| 5748 | 5749 |
| 5749 // Inform PPAPI plugins that their page is no longer visible. | 5750 // Inform PPAPI plugins that their page is no longer visible. |
| 5750 pepper_delegate_.PageVisibilityChanged(false); | 5751 pepper_delegate_->PageVisibilityChanged(false); |
| 5751 | 5752 |
| 5752 #if defined(OS_MACOSX) | 5753 #if defined(OS_MACOSX) |
| 5753 // Inform NPAPI plugins that their container is no longer visible. | 5754 // Inform NPAPI plugins that their container is no longer visible. |
| 5754 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 5755 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
| 5755 for (plugin_it = plugin_delegates_.begin(); | 5756 for (plugin_it = plugin_delegates_.begin(); |
| 5756 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 5757 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
| 5757 (*plugin_it)->SetContainerVisibility(false); | 5758 (*plugin_it)->SetContainerVisibility(false); |
| 5758 } | 5759 } |
| 5759 #endif // OS_MACOSX | 5760 #endif // OS_MACOSX |
| 5760 } | 5761 } |
| 5761 | 5762 |
| 5762 void RenderViewImpl::OnWasShown(bool needs_repainting) { | 5763 void RenderViewImpl::OnWasShown(bool needs_repainting) { |
| 5763 RenderWidget::OnWasShown(needs_repainting); | 5764 RenderWidget::OnWasShown(needs_repainting); |
| 5764 | 5765 |
| 5765 if (webview()) { | 5766 if (webview()) { |
| 5766 webview()->settings()->setMinimumTimerInterval( | 5767 webview()->settings()->setMinimumTimerInterval( |
| 5767 webkit_glue::kForegroundTabTimerInterval); | 5768 webkit_glue::kForegroundTabTimerInterval); |
| 5768 webview()->setVisibilityState(visibilityState(), false); | 5769 webview()->setVisibilityState(visibilityState(), false); |
| 5769 } | 5770 } |
| 5770 | 5771 |
| 5771 // Inform PPAPI plugins that their page is visible. | 5772 // Inform PPAPI plugins that their page is visible. |
| 5772 pepper_delegate_.PageVisibilityChanged(true); | 5773 pepper_delegate_->PageVisibilityChanged(true); |
| 5773 | 5774 |
| 5774 #if defined(OS_MACOSX) | 5775 #if defined(OS_MACOSX) |
| 5775 // Inform NPAPI plugins that their container is now visible. | 5776 // Inform NPAPI plugins that their container is now visible. |
| 5776 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 5777 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
| 5777 for (plugin_it = plugin_delegates_.begin(); | 5778 for (plugin_it = plugin_delegates_.begin(); |
| 5778 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 5779 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
| 5779 (*plugin_it)->SetContainerVisibility(true); | 5780 (*plugin_it)->SetContainerVisibility(true); |
| 5780 } | 5781 } |
| 5781 #endif // OS_MACOSX | 5782 #endif // OS_MACOSX |
| 5782 } | 5783 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 5806 #if defined(OS_MACOSX) | 5807 #if defined(OS_MACOSX) |
| 5807 // RenderWidget's call to setFocus can cause the underlying webview's | 5808 // RenderWidget's call to setFocus can cause the underlying webview's |
| 5808 // activation state to change just like a call to setIsActive. | 5809 // activation state to change just like a call to setIsActive. |
| 5809 if (enable) | 5810 if (enable) |
| 5810 (*plugin_it)->SetWindowFocus(true); | 5811 (*plugin_it)->SetWindowFocus(true); |
| 5811 #endif | 5812 #endif |
| 5812 (*plugin_it)->SetContentAreaFocus(enable); | 5813 (*plugin_it)->SetContentAreaFocus(enable); |
| 5813 } | 5814 } |
| 5814 } | 5815 } |
| 5815 // Notify all Pepper plugins. | 5816 // Notify all Pepper plugins. |
| 5816 pepper_delegate_.OnSetFocus(enable); | 5817 pepper_delegate_->OnSetFocus(enable); |
| 5817 // Notify all BrowserPlugins of the RenderView's focus state. | 5818 // Notify all BrowserPlugins of the RenderView's focus state. |
| 5818 if (browser_plugin_manager_) | 5819 if (browser_plugin_manager_) |
| 5819 browser_plugin_manager()->SetEmbedderFocus(this, enable); | 5820 browser_plugin_manager()->SetEmbedderFocus(this, enable); |
| 5820 } | 5821 } |
| 5821 | 5822 |
| 5822 void RenderViewImpl::PpapiPluginFocusChanged() { | 5823 void RenderViewImpl::PpapiPluginFocusChanged() { |
| 5823 UpdateTextInputState(DO_NOT_SHOW_IME); | 5824 UpdateTextInputState(DO_NOT_SHOW_IME); |
| 5824 UpdateSelectionBounds(); | 5825 UpdateSelectionBounds(); |
| 5825 } | 5826 } |
| 5826 | 5827 |
| 5827 void RenderViewImpl::PpapiPluginTextInputTypeChanged() { | 5828 void RenderViewImpl::PpapiPluginTextInputTypeChanged() { |
| 5828 UpdateTextInputState(DO_NOT_SHOW_IME); | 5829 UpdateTextInputState(DO_NOT_SHOW_IME); |
| 5829 if (renderer_accessibility_) | 5830 if (renderer_accessibility_) |
| 5830 renderer_accessibility_->FocusedNodeChanged(WebNode()); | 5831 renderer_accessibility_->FocusedNodeChanged(WebNode()); |
| 5831 } | 5832 } |
| 5832 | 5833 |
| 5833 void RenderViewImpl::PpapiPluginCaretPositionChanged() { | 5834 void RenderViewImpl::PpapiPluginCaretPositionChanged() { |
| 5834 UpdateSelectionBounds(); | 5835 UpdateSelectionBounds(); |
| 5835 } | 5836 } |
| 5836 | 5837 |
| 5837 bool RenderViewImpl::GetPpapiPluginCaretBounds(gfx::Rect* rect) { | 5838 bool RenderViewImpl::GetPpapiPluginCaretBounds(gfx::Rect* rect) { |
| 5838 if (!pepper_delegate_.IsPluginFocused()) | 5839 if (!pepper_delegate_->IsPluginFocused()) |
| 5839 return false; | 5840 return false; |
| 5840 *rect = pepper_delegate_.GetCaretBounds(); | 5841 *rect = pepper_delegate_->GetCaretBounds(); |
| 5841 return true; | 5842 return true; |
| 5842 } | 5843 } |
| 5843 | 5844 |
| 5844 void RenderViewImpl::SimulateImeSetComposition( | 5845 void RenderViewImpl::SimulateImeSetComposition( |
| 5845 const string16& text, | 5846 const string16& text, |
| 5846 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 5847 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 5847 int selection_start, | 5848 int selection_start, |
| 5848 int selection_end) { | 5849 int selection_end) { |
| 5849 OnImeSetComposition(text, underlines, selection_start, selection_end); | 5850 OnImeSetComposition(text, underlines, selection_start, selection_end); |
| 5850 } | 5851 } |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 5869 void RenderViewImpl::PpapiPluginCreated(RendererPpapiHost* host) { | 5870 void RenderViewImpl::PpapiPluginCreated(RendererPpapiHost* host) { |
| 5870 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 5871 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 5871 DidCreatePepperPlugin(host)); | 5872 DidCreatePepperPlugin(host)); |
| 5872 } | 5873 } |
| 5873 | 5874 |
| 5874 void RenderViewImpl::OnImeSetComposition( | 5875 void RenderViewImpl::OnImeSetComposition( |
| 5875 const string16& text, | 5876 const string16& text, |
| 5876 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 5877 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 5877 int selection_start, | 5878 int selection_start, |
| 5878 int selection_end) { | 5879 int selection_end) { |
| 5879 if (pepper_delegate_.IsPluginFocused()) { | 5880 if (pepper_delegate_->IsPluginFocused()) { |
| 5880 // When a PPAPI plugin has focus, we bypass WebKit. | 5881 // When a PPAPI plugin has focus, we bypass WebKit. |
| 5881 pepper_delegate_.OnImeSetComposition(text, | 5882 pepper_delegate_->OnImeSetComposition(text, |
| 5882 underlines, | 5883 underlines, |
| 5883 selection_start, | 5884 selection_start, |
| 5884 selection_end); | 5885 selection_end); |
| 5885 } else { | 5886 } else { |
| 5886 #if defined(OS_WIN) | 5887 #if defined(OS_WIN) |
| 5887 // When a plug-in has focus, we create platform-specific IME data used by | 5888 // When a plug-in has focus, we create platform-specific IME data used by |
| 5888 // our IME emulator and send it directly to the focused plug-in, i.e. we | 5889 // our IME emulator and send it directly to the focused plug-in, i.e. we |
| 5889 // bypass WebKit. (WebPluginDelegate dispatches this IME data only when its | 5890 // bypass WebKit. (WebPluginDelegate dispatches this IME data only when its |
| 5890 // instance ID is the same one as the specified ID.) | 5891 // instance ID is the same one as the specified ID.) |
| 5891 if (focused_plugin_id_ >= 0) { | 5892 if (focused_plugin_id_ >= 0) { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 5911 #endif | 5912 #endif |
| 5912 RenderWidget::OnImeSetComposition(text, | 5913 RenderWidget::OnImeSetComposition(text, |
| 5913 underlines, | 5914 underlines, |
| 5914 selection_start, | 5915 selection_start, |
| 5915 selection_end); | 5916 selection_end); |
| 5916 } | 5917 } |
| 5917 } | 5918 } |
| 5918 | 5919 |
| 5919 void RenderViewImpl::OnImeConfirmComposition( | 5920 void RenderViewImpl::OnImeConfirmComposition( |
| 5920 const string16& text, const ui::Range& replacement_range) { | 5921 const string16& text, const ui::Range& replacement_range) { |
| 5921 if (pepper_delegate_.IsPluginFocused()) { | 5922 if (pepper_delegate_->IsPluginFocused()) { |
| 5922 // When a PPAPI plugin has focus, we bypass WebKit. | 5923 // When a PPAPI plugin has focus, we bypass WebKit. |
| 5923 pepper_delegate_.OnImeConfirmComposition(text); | 5924 pepper_delegate_->OnImeConfirmComposition(text); |
| 5924 } else { | 5925 } else { |
| 5925 #if defined(OS_WIN) | 5926 #if defined(OS_WIN) |
| 5926 // Same as OnImeSetComposition(), we send the text from IMEs directly to | 5927 // Same as OnImeSetComposition(), we send the text from IMEs directly to |
| 5927 // plug-ins. When we send IME text directly to plug-ins, we should not send | 5928 // plug-ins. When we send IME text directly to plug-ins, we should not send |
| 5928 // it to WebKit to prevent WebKit from controlling IMEs. | 5929 // it to WebKit to prevent WebKit from controlling IMEs. |
| 5929 // TODO(thakis): Honor |replacement_range| for plugins? | 5930 // TODO(thakis): Honor |replacement_range| for plugins? |
| 5930 if (focused_plugin_id_ >= 0) { | 5931 if (focused_plugin_id_ >= 0) { |
| 5931 std::set<WebPluginDelegateProxy*>::iterator it; | 5932 std::set<WebPluginDelegateProxy*>::iterator it; |
| 5932 for (it = plugin_delegates_.begin(); | 5933 for (it = plugin_delegates_.begin(); |
| 5933 it != plugin_delegates_.end(); ++it) { | 5934 it != plugin_delegates_.end(); ++it) { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 5950 } | 5951 } |
| 5951 } | 5952 } |
| 5952 | 5953 |
| 5953 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { | 5954 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { |
| 5954 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 5955 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
| 5955 if (webview()) | 5956 if (webview()) |
| 5956 webview()->setDeviceScaleFactor(device_scale_factor); | 5957 webview()->setDeviceScaleFactor(device_scale_factor); |
| 5957 } | 5958 } |
| 5958 | 5959 |
| 5959 ui::TextInputType RenderViewImpl::GetTextInputType() { | 5960 ui::TextInputType RenderViewImpl::GetTextInputType() { |
| 5960 return pepper_delegate_.IsPluginFocused() ? | 5961 return pepper_delegate_->IsPluginFocused() ? |
| 5961 pepper_delegate_.GetTextInputType() : RenderWidget::GetTextInputType(); | 5962 pepper_delegate_->GetTextInputType() : RenderWidget::GetTextInputType(); |
| 5962 } | 5963 } |
| 5963 | 5964 |
| 5964 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) { | 5965 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) { |
| 5965 if (pepper_delegate_.IsPluginFocused()) { | 5966 if (pepper_delegate_->IsPluginFocused()) { |
| 5966 // TODO(kinaba) http://crbug.com/101101 | 5967 // TODO(kinaba) http://crbug.com/101101 |
| 5967 // Current Pepper IME API does not handle selection bounds. So we simply | 5968 // Current Pepper IME API does not handle selection bounds. So we simply |
| 5968 // use the caret position as an empty range for now. It will be updated | 5969 // use the caret position as an empty range for now. It will be updated |
| 5969 // after Pepper API equips features related to surrounding text retrieval. | 5970 // after Pepper API equips features related to surrounding text retrieval. |
| 5970 gfx::Rect caret = pepper_delegate_.GetCaretBounds(); | 5971 gfx::Rect caret = pepper_delegate_->GetCaretBounds(); |
| 5971 *start = caret; | 5972 *start = caret; |
| 5972 *end = caret; | 5973 *end = caret; |
| 5973 return; | 5974 return; |
| 5974 } | 5975 } |
| 5975 RenderWidget::GetSelectionBounds(start, end); | 5976 RenderWidget::GetSelectionBounds(start, end); |
| 5976 } | 5977 } |
| 5977 | 5978 |
| 5978 void RenderViewImpl::GetCompositionCharacterBounds( | 5979 void RenderViewImpl::GetCompositionCharacterBounds( |
| 5979 std::vector<gfx::Rect>* bounds) { | 5980 std::vector<gfx::Rect>* bounds) { |
| 5980 DCHECK(bounds); | 5981 DCHECK(bounds); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 5999 if (!frame->firstRectForCharacterRange(start_offset + i, 1, webrect)) { | 6000 if (!frame->firstRectForCharacterRange(start_offset + i, 1, webrect)) { |
| 6000 DLOG(ERROR) << "Could not retrieve character rectangle at " << i; | 6001 DLOG(ERROR) << "Could not retrieve character rectangle at " << i; |
| 6001 bounds->clear(); | 6002 bounds->clear(); |
| 6002 return; | 6003 return; |
| 6003 } | 6004 } |
| 6004 bounds->push_back(webrect); | 6005 bounds->push_back(webrect); |
| 6005 } | 6006 } |
| 6006 } | 6007 } |
| 6007 | 6008 |
| 6008 bool RenderViewImpl::CanComposeInline() { | 6009 bool RenderViewImpl::CanComposeInline() { |
| 6009 return pepper_delegate_.IsPluginFocused() ? | 6010 return pepper_delegate_->IsPluginFocused() ? |
| 6010 pepper_delegate_.CanComposeInline() : true; | 6011 pepper_delegate_->CanComposeInline() : true; |
| 6011 } | 6012 } |
| 6012 | 6013 |
| 6013 #if defined(OS_WIN) | 6014 #if defined(OS_WIN) |
| 6014 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { | 6015 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { |
| 6015 if (focused) | 6016 if (focused) |
| 6016 focused_plugin_id_ = plugin_id; | 6017 focused_plugin_id_ = plugin_id; |
| 6017 else | 6018 else |
| 6018 focused_plugin_id_ = -1; | 6019 focused_plugin_id_ = -1; |
| 6019 } | 6020 } |
| 6020 #endif | 6021 #endif |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6255 size_t request_id) { | 6256 size_t request_id) { |
| 6256 if (request_id != expected_content_intent_id_) | 6257 if (request_id != expected_content_intent_id_) |
| 6257 return; | 6258 return; |
| 6258 | 6259 |
| 6259 // Remove the content highlighting if any. | 6260 // Remove the content highlighting if any. |
| 6260 scheduleComposite(); | 6261 scheduleComposite(); |
| 6261 | 6262 |
| 6262 if (!intent.is_empty()) | 6263 if (!intent.is_empty()) |
| 6263 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent)); | 6264 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent)); |
| 6264 } | 6265 } |
| 6265 #endif | 6266 #endif // defined(OS_ANDROID) |
| 6266 | 6267 |
| 6267 void RenderViewImpl::OnAsyncFileOpened( | 6268 void RenderViewImpl::OnAsyncFileOpened( |
| 6268 base::PlatformFileError error_code, | 6269 base::PlatformFileError error_code, |
| 6269 IPC::PlatformFileForTransit file_for_transit, | 6270 IPC::PlatformFileForTransit file_for_transit, |
| 6270 int message_id) { | 6271 int message_id) { |
| 6271 pepper_delegate_.OnAsyncFileOpened( | 6272 pepper_delegate_->OnAsyncFileOpened( |
| 6272 error_code, | 6273 error_code, |
| 6273 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), | 6274 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), |
| 6274 message_id); | 6275 message_id); |
| 6275 } | 6276 } |
| 6276 | 6277 |
| 6277 void RenderViewImpl::OnPpapiBrokerChannelCreated( | 6278 void RenderViewImpl::OnPpapiBrokerChannelCreated( |
| 6278 int request_id, | 6279 int request_id, |
| 6279 const IPC::ChannelHandle& handle) { | 6280 const IPC::ChannelHandle& handle) { |
| 6280 pepper_delegate_.OnPpapiBrokerChannelCreated(request_id, | 6281 pepper_delegate_->OnPpapiBrokerChannelCreated(request_id, |
| 6281 handle); | 6282 handle); |
| 6282 } | 6283 } |
| 6283 | 6284 |
| 6284 void RenderViewImpl::OnPpapiBrokerPermissionResult( | 6285 void RenderViewImpl::OnPpapiBrokerPermissionResult( |
| 6285 int request_id, | 6286 int request_id, |
| 6286 bool result) { | 6287 bool result) { |
| 6287 pepper_delegate_.OnPpapiBrokerPermissionResult(request_id, result); | 6288 pepper_delegate_->OnPpapiBrokerPermissionResult(request_id, result); |
| 6288 } | 6289 } |
| 6289 | 6290 |
| 6290 #if defined(OS_MACOSX) | 6291 #if defined(OS_MACOSX) |
| 6291 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) { | 6292 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) { |
| 6292 if (external_popup_menu_ == NULL) { | 6293 if (external_popup_menu_ == NULL) { |
| 6293 // Crash reports from the field indicate that we can be notified with a | 6294 // Crash reports from the field indicate that we can be notified with a |
| 6294 // NULL external popup menu (we probably get notified twice). | 6295 // NULL external popup menu (we probably get notified twice). |
| 6295 // If you hit this please file a bug against jcivelli and include the page | 6296 // If you hit this please file a bug against jcivelli and include the page |
| 6296 // and steps to repro. | 6297 // and steps to repro. |
| 6297 NOTREACHED(); | 6298 NOTREACHED(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6418 } | 6419 } |
| 6419 #endif | 6420 #endif |
| 6420 | 6421 |
| 6421 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6422 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
| 6422 TransportDIB::Handle dib_handle) { | 6423 TransportDIB::Handle dib_handle) { |
| 6423 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6424 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
| 6424 RenderProcess::current()->ReleaseTransportDIB(dib); | 6425 RenderProcess::current()->ReleaseTransportDIB(dib); |
| 6425 } | 6426 } |
| 6426 | 6427 |
| 6427 } // namespace content | 6428 } // namespace content |
| OLD | NEW |