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

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

Issue 11414180: Add a gyp flag to allow removing dependency on ppapi. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
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 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 #include "webkit/glue/webkit_constants.h" 191 #include "webkit/glue/webkit_constants.h"
191 #include "webkit/glue/webkit_glue.h" 192 #include "webkit/glue/webkit_glue.h"
192 #include "webkit/glue/weburlresponse_extradata_impl.h" 193 #include "webkit/glue/weburlresponse_extradata_impl.h"
193 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" 194 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
194 #include "webkit/media/webmediaplayer_impl.h" 195 #include "webkit/media/webmediaplayer_impl.h"
195 #include "webkit/media/webmediaplayer_ms.h" 196 #include "webkit/media/webmediaplayer_ms.h"
196 #include "webkit/plugins/npapi/plugin_list.h" 197 #include "webkit/plugins/npapi/plugin_list.h"
197 #include "webkit/plugins/npapi/webplugin_delegate.h" 198 #include "webkit/plugins/npapi/webplugin_delegate.h"
198 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 199 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
199 #include "webkit/plugins/npapi/webplugin_impl.h" 200 #include "webkit/plugins/npapi/webplugin_impl.h"
200 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
201 201
202 #if defined(OS_ANDROID) 202 #if defined(OS_ANDROID)
203 #include "content/common/android/device_info.h" 203 #include "content/common/android/device_info.h"
204 #include "content/renderer/android/address_detector.h" 204 #include "content/renderer/android/address_detector.h"
205 #include "content/renderer/android/content_detector.h" 205 #include "content/renderer/android/content_detector.h"
206 #include "content/renderer/android/email_detector.h" 206 #include "content/renderer/android/email_detector.h"
207 #include "content/renderer/android/phone_number_detector.h" 207 #include "content/renderer/android/phone_number_detector.h"
208 #include "content/renderer/media/stream_texture_factory_impl_android.h" 208 #include "content/renderer/media/stream_texture_factory_impl_android.h"
209 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" 209 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h"
210 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" 210 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 #endif 596 #endif
597 session_storage_namespace_id_(params->session_storage_namespace_id), 597 session_storage_namespace_id_(params->session_storage_namespace_id),
598 handling_select_range_(false), 598 handling_select_range_(false),
599 #if defined(OS_WIN) 599 #if defined(OS_WIN)
600 focused_plugin_id_(-1), 600 focused_plugin_id_(-1),
601 #endif 601 #endif
602 updating_frame_tree_(false), 602 updating_frame_tree_(false),
603 pending_frame_tree_update_(false), 603 pending_frame_tree_update_(false),
604 target_process_id_(0), 604 target_process_id_(0),
605 target_routing_id_(0), 605 target_routing_id_(0),
606 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { 606 #if defined(ENABLE_PPAPI)
607 ALLOW_THIS_IN_INITIALIZER_LIST(
608 pepper_delegate_(new PepperPluginDelegateImpl(this)))
609 #else
610 pepper_delegate_(new PluginDelegateHelper())
611 #endif
612 {
607 set_throttle_input_events(params->renderer_prefs.throttle_input_events); 613 set_throttle_input_events(params->renderer_prefs.throttle_input_events);
608 routing_id_ = params->routing_id; 614 routing_id_ = params->routing_id;
609 surface_id_ = params->surface_id; 615 surface_id_ = params->surface_id;
610 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) 616 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created)
611 opener_id_ = params->opener_id; 617 opener_id_ = params->opener_id;
612 618
613 // Ensure we start with a valid next_page_id_ from the browser. 619 // Ensure we start with a valid next_page_id_ from the browser.
614 DCHECK_GE(next_page_id_, 0); 620 DCHECK_GE(next_page_id_, 0);
615 621
616 #if defined(ENABLE_NOTIFICATIONS) 622 #if defined(ENABLE_NOTIFICATIONS)
(...skipping 3747 matching lines...) Expand 10 before | Expand all | Expand 10 after
4364 } 4370 }
4365 } 4371 }
4366 4372
4367 return false; 4373 return false;
4368 } 4374 }
4369 4375
4370 WebKit::WebPlugin* RenderViewImpl::CreatePlugin( 4376 WebKit::WebPlugin* RenderViewImpl::CreatePlugin(
4371 WebKit::WebFrame* frame, 4377 WebKit::WebFrame* frame,
4372 const webkit::WebPluginInfo& info, 4378 const webkit::WebPluginInfo& info,
4373 const WebKit::WebPluginParams& params) { 4379 const WebKit::WebPluginParams& params) {
4374 bool pepper_plugin_was_registered = false; 4380 WebKit::WebPlugin* pepper_webplugin =
4375 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( 4381 pepper_delegate_->CreatePepperWebPlugin(info, params);
4376 pepper_delegate_.CreatePepperPluginModule(info, 4382
4377 &pepper_plugin_was_registered)); 4383 if (pepper_webplugin) return pepper_webplugin;
Jay Civelli 2012/11/29 18:57:43 Return statement should be on its own line in C++.
nilesh 2012/11/29 22:54:04 Done.
4378 if (pepper_plugin_was_registered) {
4379 if (!pepper_module)
4380 return NULL;
4381 return new webkit::ppapi::WebPluginImpl(
4382 pepper_module.get(), params, pepper_delegate_.AsWeakPtr());
4383 }
4384 4384
4385 #if defined(USE_AURA) && !defined(OS_WIN) 4385 #if defined(USE_AURA) && !defined(OS_WIN)
4386 return NULL; 4386 return NULL;
4387 #else 4387 #else
4388 return new webkit::npapi::WebPluginImpl( 4388 return new webkit::npapi::WebPluginImpl(
4389 frame, params, info.path, AsWeakPtr()); 4389 frame, params, info.path, AsWeakPtr());
4390 #endif 4390 #endif
4391 } 4391 }
4392 4392
4393 void RenderViewImpl::EvaluateScript(const string16& frame_xpath, 4393 void RenderViewImpl::EvaluateScript(const string16& frame_xpath,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
4557 4557
4558 void RenderViewImpl::SyncSelectionIfRequired() { 4558 void RenderViewImpl::SyncSelectionIfRequired() {
4559 WebFrame* frame = webview()->focusedFrame(); 4559 WebFrame* frame = webview()->focusedFrame();
4560 if (!frame) 4560 if (!frame)
4561 return; 4561 return;
4562 4562
4563 string16 text; 4563 string16 text;
4564 size_t offset; 4564 size_t offset;
4565 ui::Range range; 4565 ui::Range range;
4566 4566
4567 if (pepper_delegate_.IsPluginFocused()) { 4567 if (pepper_delegate_->IsPluginFocused()) {
4568 pepper_delegate_.GetSurroundingText(&text, &range); 4568 pepper_delegate_->GetSurroundingText(&text, &range);
4569 offset = 0; // Pepper API does not support offset reporting. 4569 offset = 0; // Pepper API does not support offset reporting.
4570 // TODO(kinaba): cut as needed. 4570 // TODO(kinaba): cut as needed.
4571 } else { 4571 } else {
4572 size_t location, length; 4572 size_t location, length;
4573 if (!webview()->caretOrSelectionRange(&location, &length)) 4573 if (!webview()->caretOrSelectionRange(&location, &length))
4574 return; 4574 return;
4575 4575
4576 range = ui::Range(location, location + length); 4576 range = ui::Range(location, location + length);
4577 4577
4578 if (webview()->textInputType() != WebKit::WebTextInputTypeNone) { 4578 if (webview()->textInputType() != WebKit::WebTextInputTypeNone) {
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
5544 ShouldDisplayScrollbars(new_size.width(), new_size.height())); 5544 ShouldDisplayScrollbars(new_size.width(), new_size.height()));
5545 } 5545 }
5546 UpdateScrollState(webview()->mainFrame()); 5546 UpdateScrollState(webview()->mainFrame());
5547 } 5547 }
5548 5548
5549 RenderWidget::OnResize(new_size, resizer_rect, is_fullscreen); 5549 RenderWidget::OnResize(new_size, resizer_rect, is_fullscreen);
5550 } 5550 }
5551 5551
5552 void RenderViewImpl::WillInitiatePaint() { 5552 void RenderViewImpl::WillInitiatePaint() {
5553 // Notify the pepper plugins that we're about to paint. 5553 // Notify the pepper plugins that we're about to paint.
5554 pepper_delegate_.ViewWillInitiatePaint(); 5554 pepper_delegate_->ViewWillInitiatePaint();
5555 } 5555 }
5556 5556
5557 void RenderViewImpl::DidInitiatePaint() { 5557 void RenderViewImpl::DidInitiatePaint() {
5558 // Notify the pepper plugins that we've painted, and are waiting to flush. 5558 // Notify the pepper plugins that we've painted, and are waiting to flush.
5559 pepper_delegate_.ViewInitiatedPaint(); 5559 pepper_delegate_->ViewInitiatedPaint();
5560 } 5560 }
5561 5561
5562 void RenderViewImpl::DidFlushPaint() { 5562 void RenderViewImpl::DidFlushPaint() {
5563 // Notify any pepper plugins that we painted. This will call into the plugin, 5563 // Notify any pepper plugins that we painted. This will call into the plugin,
5564 // and we it may ask to close itself as a result. This will, in turn, modify 5564 // and we it may ask to close itself as a result. This will, in turn, modify
5565 // our set, possibly invalidating the iterator. So we iterate on a copy that 5565 // our set, possibly invalidating the iterator. So we iterate on a copy that
5566 // won't change out from under us. 5566 // won't change out from under us.
5567 pepper_delegate_.ViewFlushedPaint(); 5567 pepper_delegate_->ViewFlushedPaint();
5568 5568
5569 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. 5569 // If the RenderWidget is closing down then early-exit, otherwise we'll crash.
5570 // See crbug.com/112921. 5570 // See crbug.com/112921.
5571 if (!webview()) 5571 if (!webview())
5572 return; 5572 return;
5573 5573
5574 WebFrame* main_frame = webview()->mainFrame(); 5574 WebFrame* main_frame = webview()->mainFrame();
5575 5575
5576 // If we have a provisional frame we are between the start and commit stages 5576 // If we have a provisional frame we are between the start and commit stages
5577 // of loading and we don't want to save stats. 5577 // of loading and we don't want to save stats.
(...skipping 25 matching lines...) Expand all
5603 void RenderViewImpl::OnViewContextSwapBuffersAborted() { 5603 void RenderViewImpl::OnViewContextSwapBuffersAborted() {
5604 RenderWidget::OnSwapBuffersAborted(); 5604 RenderWidget::OnSwapBuffersAborted();
5605 } 5605 }
5606 5606
5607 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( 5607 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint(
5608 const gfx::Rect& paint_bounds, 5608 const gfx::Rect& paint_bounds,
5609 TransportDIB** dib, 5609 TransportDIB** dib,
5610 gfx::Rect* location, 5610 gfx::Rect* location,
5611 gfx::Rect* clip, 5611 gfx::Rect* clip,
5612 float* scale_factor) { 5612 float* scale_factor) {
5613 return pepper_delegate_.GetBitmapForOptimizedPluginPaint( 5613 return pepper_delegate_->GetBitmapForOptimizedPluginPaint(
5614 paint_bounds, dib, location, clip, scale_factor); 5614 paint_bounds, dib, location, clip, scale_factor);
5615 } 5615 }
5616 5616
5617 gfx::Vector2d RenderViewImpl::GetScrollOffset() { 5617 gfx::Vector2d RenderViewImpl::GetScrollOffset() {
5618 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); 5618 WebSize scroll_offset = webview()->mainFrame()->scrollOffset();
5619 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); 5619 return gfx::Vector2d(scroll_offset.width, scroll_offset.height);
5620 } 5620 }
5621 5621
5622 void RenderViewImpl::OnClearFocusedNode() { 5622 void RenderViewImpl::OnClearFocusedNode() {
5623 if (webview()) 5623 if (webview())
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
5723 5723
5724 void RenderViewImpl::DidHandleKeyEvent() { 5724 void RenderViewImpl::DidHandleKeyEvent() {
5725 ClearEditCommands(); 5725 ClearEditCommands();
5726 } 5726 }
5727 5727
5728 bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 5728 bool RenderViewImpl::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
5729 possible_drag_event_info_.event_source = 5729 possible_drag_event_info_.event_source =
5730 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; 5730 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE;
5731 possible_drag_event_info_.event_location = 5731 possible_drag_event_info_.event_location =
5732 gfx::Point(event.globalX, event.globalY); 5732 gfx::Point(event.globalX, event.globalY);
5733 pepper_delegate_.WillHandleMouseEvent(); 5733 pepper_delegate_->WillHandleMouseEvent();
5734 5734
5735 // If the mouse is locked, only the current owner of the mouse lock can 5735 // If the mouse is locked, only the current owner of the mouse lock can
5736 // process mouse events. 5736 // process mouse events.
5737 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); 5737 return mouse_lock_dispatcher_->WillHandleMouseEvent(event);
5738 } 5738 }
5739 5739
5740 bool RenderViewImpl::WillHandleGestureEvent( 5740 bool RenderViewImpl::WillHandleGestureEvent(
5741 const WebKit::WebGestureEvent& event) { 5741 const WebKit::WebGestureEvent& event) {
5742 possible_drag_event_info_.event_source = 5742 possible_drag_event_info_.event_source =
5743 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; 5743 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH;
(...skipping 22 matching lines...) Expand all
5766 media_player_manager_->ReleaseMediaResources(); 5766 media_player_manager_->ReleaseMediaResources();
5767 #endif 5767 #endif
5768 5768
5769 if (webview()) { 5769 if (webview()) {
5770 webview()->settings()->setMinimumTimerInterval( 5770 webview()->settings()->setMinimumTimerInterval(
5771 webkit_glue::kBackgroundTabTimerInterval); 5771 webkit_glue::kBackgroundTabTimerInterval);
5772 webview()->setVisibilityState(visibilityState(), false); 5772 webview()->setVisibilityState(visibilityState(), false);
5773 } 5773 }
5774 5774
5775 // Inform PPAPI plugins that their page is no longer visible. 5775 // Inform PPAPI plugins that their page is no longer visible.
5776 pepper_delegate_.PageVisibilityChanged(false); 5776 pepper_delegate_->PageVisibilityChanged(false);
5777 5777
5778 #if defined(OS_MACOSX) 5778 #if defined(OS_MACOSX)
5779 // Inform NPAPI plugins that their container is no longer visible. 5779 // Inform NPAPI plugins that their container is no longer visible.
5780 std::set<WebPluginDelegateProxy*>::iterator plugin_it; 5780 std::set<WebPluginDelegateProxy*>::iterator plugin_it;
5781 for (plugin_it = plugin_delegates_.begin(); 5781 for (plugin_it = plugin_delegates_.begin();
5782 plugin_it != plugin_delegates_.end(); ++plugin_it) { 5782 plugin_it != plugin_delegates_.end(); ++plugin_it) {
5783 (*plugin_it)->SetContainerVisibility(false); 5783 (*plugin_it)->SetContainerVisibility(false);
5784 } 5784 }
5785 #endif // OS_MACOSX 5785 #endif // OS_MACOSX
5786 } 5786 }
5787 5787
5788 void RenderViewImpl::OnWasShown(bool needs_repainting) { 5788 void RenderViewImpl::OnWasShown(bool needs_repainting) {
5789 RenderWidget::OnWasShown(needs_repainting); 5789 RenderWidget::OnWasShown(needs_repainting);
5790 5790
5791 if (webview()) { 5791 if (webview()) {
5792 webview()->settings()->setMinimumTimerInterval( 5792 webview()->settings()->setMinimumTimerInterval(
5793 webkit_glue::kForegroundTabTimerInterval); 5793 webkit_glue::kForegroundTabTimerInterval);
5794 webview()->setVisibilityState(visibilityState(), false); 5794 webview()->setVisibilityState(visibilityState(), false);
5795 } 5795 }
5796 5796
5797 // Inform PPAPI plugins that their page is visible. 5797 // Inform PPAPI plugins that their page is visible.
5798 pepper_delegate_.PageVisibilityChanged(true); 5798 pepper_delegate_->PageVisibilityChanged(true);
5799 5799
5800 #if defined(OS_MACOSX) 5800 #if defined(OS_MACOSX)
5801 // Inform NPAPI plugins that their container is now visible. 5801 // Inform NPAPI plugins that their container is now visible.
5802 std::set<WebPluginDelegateProxy*>::iterator plugin_it; 5802 std::set<WebPluginDelegateProxy*>::iterator plugin_it;
5803 for (plugin_it = plugin_delegates_.begin(); 5803 for (plugin_it = plugin_delegates_.begin();
5804 plugin_it != plugin_delegates_.end(); ++plugin_it) { 5804 plugin_it != plugin_delegates_.end(); ++plugin_it) {
5805 (*plugin_it)->SetContainerVisibility(true); 5805 (*plugin_it)->SetContainerVisibility(true);
5806 } 5806 }
5807 #endif // OS_MACOSX 5807 #endif // OS_MACOSX
5808 } 5808 }
(...skipping 23 matching lines...) Expand all
5832 #if defined(OS_MACOSX) 5832 #if defined(OS_MACOSX)
5833 // RenderWidget's call to setFocus can cause the underlying webview's 5833 // RenderWidget's call to setFocus can cause the underlying webview's
5834 // activation state to change just like a call to setIsActive. 5834 // activation state to change just like a call to setIsActive.
5835 if (enable) 5835 if (enable)
5836 (*plugin_it)->SetWindowFocus(true); 5836 (*plugin_it)->SetWindowFocus(true);
5837 #endif 5837 #endif
5838 (*plugin_it)->SetContentAreaFocus(enable); 5838 (*plugin_it)->SetContentAreaFocus(enable);
5839 } 5839 }
5840 } 5840 }
5841 // Notify all Pepper plugins. 5841 // Notify all Pepper plugins.
5842 pepper_delegate_.OnSetFocus(enable); 5842 pepper_delegate_->OnSetFocus(enable);
5843 // Notify all BrowserPlugins of the RenderView's focus state. 5843 // Notify all BrowserPlugins of the RenderView's focus state.
5844 if (browser_plugin_manager_) 5844 if (browser_plugin_manager_)
5845 browser_plugin_manager()->SetEmbedderFocus(this, enable); 5845 browser_plugin_manager()->SetEmbedderFocus(this, enable);
5846 } 5846 }
5847 5847
5848 void RenderViewImpl::PpapiPluginFocusChanged() { 5848 void RenderViewImpl::PpapiPluginFocusChanged() {
5849 UpdateTextInputState(DO_NOT_SHOW_IME); 5849 UpdateTextInputState(DO_NOT_SHOW_IME);
5850 UpdateSelectionBounds(); 5850 UpdateSelectionBounds();
5851 } 5851 }
5852 5852
5853 void RenderViewImpl::PpapiPluginTextInputTypeChanged() { 5853 void RenderViewImpl::PpapiPluginTextInputTypeChanged() {
5854 UpdateTextInputState(DO_NOT_SHOW_IME); 5854 UpdateTextInputState(DO_NOT_SHOW_IME);
5855 if (renderer_accessibility_) 5855 if (renderer_accessibility_)
5856 renderer_accessibility_->FocusedNodeChanged(WebNode()); 5856 renderer_accessibility_->FocusedNodeChanged(WebNode());
5857 } 5857 }
5858 5858
5859 void RenderViewImpl::PpapiPluginCaretPositionChanged() { 5859 void RenderViewImpl::PpapiPluginCaretPositionChanged() {
5860 UpdateSelectionBounds(); 5860 UpdateSelectionBounds();
5861 } 5861 }
5862 5862
5863 bool RenderViewImpl::GetPpapiPluginCaretBounds(gfx::Rect* rect) { 5863 bool RenderViewImpl::GetPpapiPluginCaretBounds(gfx::Rect* rect) {
5864 if (!pepper_delegate_.IsPluginFocused()) 5864 if (!pepper_delegate_->IsPluginFocused())
5865 return false; 5865 return false;
5866 *rect = pepper_delegate_.GetCaretBounds(); 5866 *rect = pepper_delegate_->GetCaretBounds();
5867 return true; 5867 return true;
5868 } 5868 }
5869 5869
5870 void RenderViewImpl::SimulateImeSetComposition( 5870 void RenderViewImpl::SimulateImeSetComposition(
5871 const string16& text, 5871 const string16& text,
5872 const std::vector<WebKit::WebCompositionUnderline>& underlines, 5872 const std::vector<WebKit::WebCompositionUnderline>& underlines,
5873 int selection_start, 5873 int selection_start,
5874 int selection_end) { 5874 int selection_end) {
5875 OnImeSetComposition(text, underlines, selection_start, selection_end); 5875 OnImeSetComposition(text, underlines, selection_start, selection_end);
5876 } 5876 }
(...skipping 18 matching lines...) Expand all
5895 void RenderViewImpl::PpapiPluginCreated(RendererPpapiHost* host) { 5895 void RenderViewImpl::PpapiPluginCreated(RendererPpapiHost* host) {
5896 FOR_EACH_OBSERVER(RenderViewObserver, observers_, 5896 FOR_EACH_OBSERVER(RenderViewObserver, observers_,
5897 DidCreatePepperPlugin(host)); 5897 DidCreatePepperPlugin(host));
5898 } 5898 }
5899 5899
5900 void RenderViewImpl::OnImeSetComposition( 5900 void RenderViewImpl::OnImeSetComposition(
5901 const string16& text, 5901 const string16& text,
5902 const std::vector<WebKit::WebCompositionUnderline>& underlines, 5902 const std::vector<WebKit::WebCompositionUnderline>& underlines,
5903 int selection_start, 5903 int selection_start,
5904 int selection_end) { 5904 int selection_end) {
5905 if (pepper_delegate_.IsPluginFocused()) { 5905 if (pepper_delegate_->IsPluginFocused()) {
5906 // When a PPAPI plugin has focus, we bypass WebKit. 5906 // When a PPAPI plugin has focus, we bypass WebKit.
5907 pepper_delegate_.OnImeSetComposition(text, 5907 pepper_delegate_->OnImeSetComposition(text,
5908 underlines, 5908 underlines,
5909 selection_start, 5909 selection_start,
5910 selection_end); 5910 selection_end);
5911 } else { 5911 } else {
5912 #if defined(OS_WIN) 5912 #if defined(OS_WIN)
5913 // When a plug-in has focus, we create platform-specific IME data used by 5913 // When a plug-in has focus, we create platform-specific IME data used by
5914 // our IME emulator and send it directly to the focused plug-in, i.e. we 5914 // our IME emulator and send it directly to the focused plug-in, i.e. we
5915 // bypass WebKit. (WebPluginDelegate dispatches this IME data only when its 5915 // bypass WebKit. (WebPluginDelegate dispatches this IME data only when its
5916 // instance ID is the same one as the specified ID.) 5916 // instance ID is the same one as the specified ID.)
5917 if (focused_plugin_id_ >= 0) { 5917 if (focused_plugin_id_ >= 0) {
(...skipping 19 matching lines...) Expand all
5937 #endif 5937 #endif
5938 RenderWidget::OnImeSetComposition(text, 5938 RenderWidget::OnImeSetComposition(text,
5939 underlines, 5939 underlines,
5940 selection_start, 5940 selection_start,
5941 selection_end); 5941 selection_end);
5942 } 5942 }
5943 } 5943 }
5944 5944
5945 void RenderViewImpl::OnImeConfirmComposition( 5945 void RenderViewImpl::OnImeConfirmComposition(
5946 const string16& text, const ui::Range& replacement_range) { 5946 const string16& text, const ui::Range& replacement_range) {
5947 if (pepper_delegate_.IsPluginFocused()) { 5947 if (pepper_delegate_->IsPluginFocused()) {
5948 // When a PPAPI plugin has focus, we bypass WebKit. 5948 // When a PPAPI plugin has focus, we bypass WebKit.
5949 pepper_delegate_.OnImeConfirmComposition(text); 5949 pepper_delegate_->OnImeConfirmComposition(text);
5950 } else { 5950 } else {
5951 #if defined(OS_WIN) 5951 #if defined(OS_WIN)
5952 // Same as OnImeSetComposition(), we send the text from IMEs directly to 5952 // Same as OnImeSetComposition(), we send the text from IMEs directly to
5953 // plug-ins. When we send IME text directly to plug-ins, we should not send 5953 // plug-ins. When we send IME text directly to plug-ins, we should not send
5954 // it to WebKit to prevent WebKit from controlling IMEs. 5954 // it to WebKit to prevent WebKit from controlling IMEs.
5955 // TODO(thakis): Honor |replacement_range| for plugins? 5955 // TODO(thakis): Honor |replacement_range| for plugins?
5956 if (focused_plugin_id_ >= 0) { 5956 if (focused_plugin_id_ >= 0) {
5957 std::set<WebPluginDelegateProxy*>::iterator it; 5957 std::set<WebPluginDelegateProxy*>::iterator it;
5958 for (it = plugin_delegates_.begin(); 5958 for (it = plugin_delegates_.begin();
5959 it != plugin_delegates_.end(); ++it) { 5959 it != plugin_delegates_.end(); ++it) {
(...skipping 16 matching lines...) Expand all
5976 } 5976 }
5977 } 5977 }
5978 5978
5979 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { 5979 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) {
5980 RenderWidget::SetDeviceScaleFactor(device_scale_factor); 5980 RenderWidget::SetDeviceScaleFactor(device_scale_factor);
5981 if (webview()) 5981 if (webview())
5982 webview()->setDeviceScaleFactor(device_scale_factor); 5982 webview()->setDeviceScaleFactor(device_scale_factor);
5983 } 5983 }
5984 5984
5985 ui::TextInputType RenderViewImpl::GetTextInputType() { 5985 ui::TextInputType RenderViewImpl::GetTextInputType() {
5986 return pepper_delegate_.IsPluginFocused() ? 5986 return pepper_delegate_->IsPluginFocused() ?
5987 pepper_delegate_.GetTextInputType() : RenderWidget::GetTextInputType(); 5987 pepper_delegate_->GetTextInputType() : RenderWidget::GetTextInputType();
5988 } 5988 }
5989 5989
5990 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) { 5990 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) {
5991 if (pepper_delegate_.IsPluginFocused()) { 5991 if (pepper_delegate_->IsPluginFocused()) {
5992 // TODO(kinaba) http://crbug.com/101101 5992 // TODO(kinaba) http://crbug.com/101101
5993 // Current Pepper IME API does not handle selection bounds. So we simply 5993 // Current Pepper IME API does not handle selection bounds. So we simply
5994 // use the caret position as an empty range for now. It will be updated 5994 // use the caret position as an empty range for now. It will be updated
5995 // after Pepper API equips features related to surrounding text retrieval. 5995 // after Pepper API equips features related to surrounding text retrieval.
5996 gfx::Rect caret = pepper_delegate_.GetCaretBounds(); 5996 gfx::Rect caret = pepper_delegate_->GetCaretBounds();
5997 *start = caret; 5997 *start = caret;
5998 *end = caret; 5998 *end = caret;
5999 return; 5999 return;
6000 } 6000 }
6001 RenderWidget::GetSelectionBounds(start, end); 6001 RenderWidget::GetSelectionBounds(start, end);
6002 } 6002 }
6003 6003
6004 void RenderViewImpl::GetCompositionCharacterBounds( 6004 void RenderViewImpl::GetCompositionCharacterBounds(
6005 std::vector<gfx::Rect>* bounds) { 6005 std::vector<gfx::Rect>* bounds) {
6006 DCHECK(bounds); 6006 DCHECK(bounds);
(...skipping 18 matching lines...) Expand all
6025 if (!frame->firstRectForCharacterRange(start_offset + i, 1, webrect)) { 6025 if (!frame->firstRectForCharacterRange(start_offset + i, 1, webrect)) {
6026 DLOG(ERROR) << "Could not retrieve character rectangle at " << i; 6026 DLOG(ERROR) << "Could not retrieve character rectangle at " << i;
6027 bounds->clear(); 6027 bounds->clear();
6028 return; 6028 return;
6029 } 6029 }
6030 bounds->push_back(webrect); 6030 bounds->push_back(webrect);
6031 } 6031 }
6032 } 6032 }
6033 6033
6034 bool RenderViewImpl::CanComposeInline() { 6034 bool RenderViewImpl::CanComposeInline() {
6035 return pepper_delegate_.IsPluginFocused() ? 6035 return pepper_delegate_->IsPluginFocused() ?
6036 pepper_delegate_.CanComposeInline() : true; 6036 pepper_delegate_->CanComposeInline() : true;
6037 } 6037 }
6038 6038
6039 #if defined(OS_WIN) 6039 #if defined(OS_WIN)
6040 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { 6040 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) {
6041 if (focused) 6041 if (focused)
6042 focused_plugin_id_ = plugin_id; 6042 focused_plugin_id_ = plugin_id;
6043 else 6043 else
6044 focused_plugin_id_ = -1; 6044 focused_plugin_id_ = -1;
6045 } 6045 }
6046 #endif 6046 #endif
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
6281 size_t request_id) { 6281 size_t request_id) {
6282 if (request_id != expected_content_intent_id_) 6282 if (request_id != expected_content_intent_id_)
6283 return; 6283 return;
6284 6284
6285 // Remove the content highlighting if any. 6285 // Remove the content highlighting if any.
6286 scheduleComposite(); 6286 scheduleComposite();
6287 6287
6288 if (!intent.is_empty()) 6288 if (!intent.is_empty())
6289 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent)); 6289 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent));
6290 } 6290 }
6291 #endif 6291 #endif // defined(OS_ANDROID)
6292 6292
6293 void RenderViewImpl::OnAsyncFileOpened( 6293 void RenderViewImpl::OnAsyncFileOpened(
6294 base::PlatformFileError error_code, 6294 base::PlatformFileError error_code,
6295 IPC::PlatformFileForTransit file_for_transit, 6295 IPC::PlatformFileForTransit file_for_transit,
6296 int message_id) { 6296 int message_id) {
6297 pepper_delegate_.OnAsyncFileOpened( 6297 pepper_delegate_->OnAsyncFileOpened(
6298 error_code, 6298 error_code,
6299 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), 6299 IPC::PlatformFileForTransitToPlatformFile(file_for_transit),
6300 message_id); 6300 message_id);
6301 } 6301 }
6302 6302
6303 void RenderViewImpl::OnPpapiBrokerChannelCreated( 6303 void RenderViewImpl::OnPpapiBrokerChannelCreated(
6304 int request_id, 6304 int request_id,
6305 const IPC::ChannelHandle& handle) { 6305 const IPC::ChannelHandle& handle) {
6306 pepper_delegate_.OnPpapiBrokerChannelCreated(request_id, 6306 pepper_delegate_->OnPpapiBrokerChannelCreated(request_id,
6307 handle); 6307 handle);
6308 } 6308 }
6309 6309
6310 void RenderViewImpl::OnPpapiBrokerPermissionResult( 6310 void RenderViewImpl::OnPpapiBrokerPermissionResult(
6311 int request_id, 6311 int request_id,
6312 bool result) { 6312 bool result) {
6313 pepper_delegate_.OnPpapiBrokerPermissionResult(request_id, result); 6313 pepper_delegate_->OnPpapiBrokerPermissionResult(request_id, result);
6314 } 6314 }
6315 6315
6316 #if defined(OS_MACOSX) 6316 #if defined(OS_MACOSX)
6317 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) { 6317 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) {
6318 if (external_popup_menu_ == NULL) { 6318 if (external_popup_menu_ == NULL) {
6319 // Crash reports from the field indicate that we can be notified with a 6319 // Crash reports from the field indicate that we can be notified with a
6320 // NULL external popup menu (we probably get notified twice). 6320 // NULL external popup menu (we probably get notified twice).
6321 // If you hit this please file a bug against jcivelli and include the page 6321 // If you hit this please file a bug against jcivelli and include the page
6322 // and steps to repro. 6322 // and steps to repro.
6323 NOTREACHED(); 6323 NOTREACHED();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
6444 } 6444 }
6445 #endif 6445 #endif
6446 6446
6447 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( 6447 void RenderViewImpl::OnReleaseDisambiguationPopupDIB(
6448 TransportDIB::Handle dib_handle) { 6448 TransportDIB::Handle dib_handle) {
6449 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); 6449 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle);
6450 RenderProcess::current()->ReleaseTransportDIB(dib); 6450 RenderProcess::current()->ReleaseTransportDIB(dib);
6451 } 6451 }
6452 6452
6453 } // namespace content 6453 } // namespace content
OLDNEW
« content/renderer/plugin_delegate_helper.h ('K') | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698