| 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_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/debug/trace_event_synthetic_delay.h" | 10 #include "base/debug/trace_event_synthetic_delay.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "content/child/npapi/webplugin.h" | 23 #include "content/child/npapi/webplugin.h" |
| 24 #include "content/common/gpu/client/context_provider_command_buffer.h" | 24 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 25 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 25 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 26 #include "content/common/gpu/gpu_process_launch_causes.h" | 26 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 27 #include "content/common/input/synthetic_gesture_packet.h" | 27 #include "content/common/input/synthetic_gesture_packet.h" |
| 28 #include "content/common/input/web_input_event_traits.h" | 28 #include "content/common/input/web_input_event_traits.h" |
| 29 #include "content/common/input_messages.h" | 29 #include "content/common/input_messages.h" |
| 30 #include "content/common/swapped_out_messages.h" | 30 #include "content/common/swapped_out_messages.h" |
| 31 #include "content/common/view_messages.h" | 31 #include "content/common/view_messages.h" |
| 32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
| 33 #include "content/public/common/context_menu_params.h" |
| 33 #include "content/renderer/cursor_utils.h" | 34 #include "content/renderer/cursor_utils.h" |
| 34 #include "content/renderer/external_popup_menu.h" | 35 #include "content/renderer/external_popup_menu.h" |
| 35 #include "content/renderer/gpu/compositor_output_surface.h" | 36 #include "content/renderer/gpu/compositor_output_surface.h" |
| 36 #include "content/renderer/gpu/compositor_software_output_device.h" | 37 #include "content/renderer/gpu/compositor_software_output_device.h" |
| 37 #include "content/renderer/gpu/delegated_compositor_output_surface.h" | 38 #include "content/renderer/gpu/delegated_compositor_output_surface.h" |
| 38 #include "content/renderer/gpu/mailbox_output_surface.h" | 39 #include "content/renderer/gpu/mailbox_output_surface.h" |
| 39 #include "content/renderer/gpu/render_widget_compositor.h" | 40 #include "content/renderer/gpu/render_widget_compositor.h" |
| 40 #include "content/renderer/ime_event_guard.h" | 41 #include "content/renderer/ime_event_guard.h" |
| 41 #include "content/renderer/input/input_handler_manager.h" | 42 #include "content/renderer/input/input_handler_manager.h" |
| 42 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 43 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 animation_update_pending_(false), | 374 animation_update_pending_(false), |
| 374 invalidation_task_posted_(false), | 375 invalidation_task_posted_(false), |
| 375 screen_info_(screen_info), | 376 screen_info_(screen_info), |
| 376 device_scale_factor_(screen_info_.deviceScaleFactor), | 377 device_scale_factor_(screen_info_.deviceScaleFactor), |
| 377 is_threaded_compositing_enabled_(false), | 378 is_threaded_compositing_enabled_(false), |
| 378 next_output_surface_id_(0), | 379 next_output_surface_id_(0), |
| 379 #if defined(OS_ANDROID) | 380 #if defined(OS_ANDROID) |
| 380 outstanding_ime_acks_(0), | 381 outstanding_ime_acks_(0), |
| 381 #endif | 382 #endif |
| 382 popup_origin_scale_for_emulation_(0.f), | 383 popup_origin_scale_for_emulation_(0.f), |
| 383 resizing_mode_selector_(new ResizingModeSelector()) { | 384 resizing_mode_selector_(new ResizingModeSelector()), |
| 385 context_menu_source_type_(ui::MENU_SOURCE_MOUSE) { |
| 384 if (!swapped_out) | 386 if (!swapped_out) |
| 385 RenderProcess::current()->AddRefProcess(); | 387 RenderProcess::current()->AddRefProcess(); |
| 386 DCHECK(RenderThread::Get()); | 388 DCHECK(RenderThread::Get()); |
| 387 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( | 389 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( |
| 388 switches::kDisableGpuVsync); | 390 switches::kDisableGpuVsync); |
| 389 is_threaded_compositing_enabled_ = | 391 is_threaded_compositing_enabled_ = |
| 390 CommandLine::ForCurrentProcess()->HasSwitch( | 392 CommandLine::ForCurrentProcess()->HasSwitch( |
| 391 switches::kEnableThreadedCompositing); | 393 switches::kEnableThreadedCompositing); |
| 392 | 394 |
| 393 legacy_software_mode_stats_ = cc::RenderingStatsInstrumentation::Create(); | 395 legacy_software_mode_stats_ = cc::RenderingStatsInstrumentation::Create(); |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 100, | 1091 100, |
| 1090 base::HistogramBase::kUmaTargetedHistogramFlag); | 1092 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 1091 counter_for_type->Add(delta); | 1093 counter_for_type->Add(delta); |
| 1092 | 1094 |
| 1093 bool prevent_default = false; | 1095 bool prevent_default = false; |
| 1094 if (WebInputEvent::isMouseEventType(input_event->type)) { | 1096 if (WebInputEvent::isMouseEventType(input_event->type)) { |
| 1095 const WebMouseEvent& mouse_event = | 1097 const WebMouseEvent& mouse_event = |
| 1096 *static_cast<const WebMouseEvent*>(input_event); | 1098 *static_cast<const WebMouseEvent*>(input_event); |
| 1097 TRACE_EVENT2("renderer", "HandleMouseMove", | 1099 TRACE_EVENT2("renderer", "HandleMouseMove", |
| 1098 "x", mouse_event.x, "y", mouse_event.y); | 1100 "x", mouse_event.x, "y", mouse_event.y); |
| 1101 context_menu_source_type_ = ui::MENU_SOURCE_MOUSE; |
| 1099 prevent_default = WillHandleMouseEvent(mouse_event); | 1102 prevent_default = WillHandleMouseEvent(mouse_event); |
| 1100 } | 1103 } |
| 1101 | 1104 |
| 1102 if (WebInputEvent::isKeyboardEventType(input_event->type)) { | 1105 if (WebInputEvent::isKeyboardEventType(input_event->type)) |
| 1103 const WebKeyboardEvent& key_event = | 1106 context_menu_source_type_ = ui::MENU_SOURCE_KEYBOARD; |
| 1104 *static_cast<const WebKeyboardEvent*>(input_event); | |
| 1105 prevent_default = WillHandleKeyEvent(key_event); | |
| 1106 } | |
| 1107 | 1107 |
| 1108 if (WebInputEvent::isGestureEventType(input_event->type)) { | 1108 if (WebInputEvent::isGestureEventType(input_event->type)) { |
| 1109 const WebGestureEvent& gesture_event = | 1109 const WebGestureEvent& gesture_event = |
| 1110 *static_cast<const WebGestureEvent*>(input_event); | 1110 *static_cast<const WebGestureEvent*>(input_event); |
| 1111 context_menu_source_type_ = ui::MENU_SOURCE_TOUCH; |
| 1111 prevent_default = prevent_default || WillHandleGestureEvent(gesture_event); | 1112 prevent_default = prevent_default || WillHandleGestureEvent(gesture_event); |
| 1112 } | 1113 } |
| 1113 | 1114 |
| 1114 if (input_event->type == WebInputEvent::TouchStart) | 1115 if (input_event->type == WebInputEvent::TouchStart) |
| 1115 handling_touchstart_event_ = true; | 1116 handling_touchstart_event_ = true; |
| 1116 | 1117 |
| 1117 bool processed = prevent_default; | 1118 bool processed = prevent_default; |
| 1118 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) { | 1119 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) { |
| 1119 suppress_next_char_events_ = false; | 1120 suppress_next_char_events_ = false; |
| 1120 if (!processed && webwidget_) | 1121 if (!processed && webwidget_) |
| (...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2794 } | 2795 } |
| 2795 | 2796 |
| 2796 void RenderWidget::GetBrowserRenderingStats(BrowserRenderingStats* stats) { | 2797 void RenderWidget::GetBrowserRenderingStats(BrowserRenderingStats* stats) { |
| 2797 *stats = browser_rendering_stats_; | 2798 *stats = browser_rendering_stats_; |
| 2798 } | 2799 } |
| 2799 | 2800 |
| 2800 bool RenderWidget::WillHandleMouseEvent(const blink::WebMouseEvent& event) { | 2801 bool RenderWidget::WillHandleMouseEvent(const blink::WebMouseEvent& event) { |
| 2801 return false; | 2802 return false; |
| 2802 } | 2803 } |
| 2803 | 2804 |
| 2804 bool RenderWidget::WillHandleKeyEvent(const blink::WebKeyboardEvent& event) { | |
| 2805 return false; | |
| 2806 } | |
| 2807 | |
| 2808 bool RenderWidget::WillHandleGestureEvent( | 2805 bool RenderWidget::WillHandleGestureEvent( |
| 2809 const blink::WebGestureEvent& event) { | 2806 const blink::WebGestureEvent& event) { |
| 2810 return false; | 2807 return false; |
| 2811 } | 2808 } |
| 2812 | 2809 |
| 2813 void RenderWidget::hasTouchEventHandlers(bool has_handlers) { | 2810 void RenderWidget::hasTouchEventHandlers(bool has_handlers) { |
| 2814 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); | 2811 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); |
| 2815 } | 2812 } |
| 2816 | 2813 |
| 2817 void RenderWidget::setTouchAction( | 2814 void RenderWidget::setTouchAction( |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2899 | 2896 |
| 2900 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2897 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
| 2901 swapped_out_frames_.AddObserver(frame); | 2898 swapped_out_frames_.AddObserver(frame); |
| 2902 } | 2899 } |
| 2903 | 2900 |
| 2904 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2901 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
| 2905 swapped_out_frames_.RemoveObserver(frame); | 2902 swapped_out_frames_.RemoveObserver(frame); |
| 2906 } | 2903 } |
| 2907 | 2904 |
| 2908 } // namespace content | 2905 } // namespace content |
| OLD | NEW |