| 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/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
| 16 #include "base/i18n/rtl.h" | 16 #include "base/i18n/rtl.h" |
| 17 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
| 18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 19 #include "base/metrics/field_trial.h" | 19 #include "base/metrics/field_trial.h" |
| 20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
| 21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/thread_task_runner_handle.h" | 23 #include "base/thread_task_runner_handle.h" |
| 24 #include "cc/output/compositor_frame.h" | 24 #include "cc/output/compositor_frame.h" |
| 25 #include "cc/output/compositor_frame_ack.h" | 25 #include "cc/output/compositor_frame_ack.h" |
| 26 #include "content/browser/accessibility/accessibility_mode_helper.h" |
| 26 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 27 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 27 #include "content/browser/gpu/compositor_util.h" | 28 #include "content/browser/gpu/compositor_util.h" |
| 28 #include "content/browser/gpu/gpu_process_host.h" | 29 #include "content/browser/gpu/gpu_process_host.h" |
| 29 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 30 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 30 #include "content/browser/gpu/gpu_surface_tracker.h" | 31 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 31 #include "content/browser/renderer_host/backing_store.h" | 32 #include "content/browser/renderer_host/backing_store.h" |
| 32 #include "content/browser/renderer_host/backing_store_manager.h" | 33 #include "content/browser/renderer_host/backing_store_manager.h" |
| 33 #include "content/browser/renderer_host/dip_util.h" | 34 #include "content/browser/renderer_host/dip_util.h" |
| 34 #include "content/browser/renderer_host/input/input_router_impl.h" | 35 #include "content/browser/renderer_host/input/input_router_impl.h" |
| 35 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 36 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 base::TimeDelta::FromMilliseconds(hung_renderer_delay_ms_)); | 929 base::TimeDelta::FromMilliseconds(hung_renderer_delay_ms_)); |
| 929 } | 930 } |
| 930 | 931 |
| 931 void RenderWidgetHostImpl::StopHangMonitorTimeout() { | 932 void RenderWidgetHostImpl::StopHangMonitorTimeout() { |
| 932 if (hang_monitor_timeout_) | 933 if (hang_monitor_timeout_) |
| 933 hang_monitor_timeout_->Stop(); | 934 hang_monitor_timeout_->Stop(); |
| 934 RendererIsResponsive(); | 935 RendererIsResponsive(); |
| 935 } | 936 } |
| 936 | 937 |
| 937 void RenderWidgetHostImpl::EnableFullAccessibilityMode() { | 938 void RenderWidgetHostImpl::EnableFullAccessibilityMode() { |
| 938 SetAccessibilityMode(AccessibilityModeComplete); | 939 AddAccessibilityMode(AccessibilityModeComplete); |
| 939 } | 940 } |
| 940 | 941 |
| 941 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { | 942 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { |
| 942 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); | 943 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); |
| 943 } | 944 } |
| 944 | 945 |
| 945 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( | 946 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( |
| 946 const blink::WebMouseEvent& mouse_event, | 947 const blink::WebMouseEvent& mouse_event, |
| 947 const ui::LatencyInfo& ui_latency) { | 948 const ui::LatencyInfo& ui_latency) { |
| 948 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", | 949 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", |
| (...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2141 | 2142 |
| 2142 void RenderWidgetHostImpl::SetBackground(const SkBitmap& background) { | 2143 void RenderWidgetHostImpl::SetBackground(const SkBitmap& background) { |
| 2143 Send(new ViewMsg_SetBackground(GetRoutingID(), background)); | 2144 Send(new ViewMsg_SetBackground(GetRoutingID(), background)); |
| 2144 } | 2145 } |
| 2145 | 2146 |
| 2146 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( | 2147 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( |
| 2147 const std::vector<EditCommand>& commands) { | 2148 const std::vector<EditCommand>& commands) { |
| 2148 Send(new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), commands)); | 2149 Send(new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), commands)); |
| 2149 } | 2150 } |
| 2150 | 2151 |
| 2152 void RenderWidgetHostImpl::AddAccessibilityMode(AccessibilityMode mode) { |
| 2153 SetAccessibilityMode( |
| 2154 content::AddAccessibilityModeTo(accessibility_mode_, mode)); |
| 2155 } |
| 2156 |
| 2157 void RenderWidgetHostImpl::RemoveAccessibilityMode(AccessibilityMode mode) { |
| 2158 SetAccessibilityMode( |
| 2159 content::RemoveAccessibilityModeFrom(accessibility_mode_, mode)); |
| 2160 } |
| 2161 |
| 2162 void RenderWidgetHostImpl::ResetAccessibilityMode() { |
| 2163 SetAccessibilityMode( |
| 2164 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()); |
| 2165 } |
| 2166 |
| 2151 void RenderWidgetHostImpl::SetAccessibilityMode(AccessibilityMode mode) { | 2167 void RenderWidgetHostImpl::SetAccessibilityMode(AccessibilityMode mode) { |
| 2152 accessibility_mode_ = mode; | 2168 accessibility_mode_ = mode; |
| 2153 Send(new ViewMsg_SetAccessibilityMode(GetRoutingID(), mode)); | 2169 Send(new ViewMsg_SetAccessibilityMode(GetRoutingID(), mode)); |
| 2154 } | 2170 } |
| 2155 | 2171 |
| 2156 void RenderWidgetHostImpl::AccessibilityDoDefaultAction(int object_id) { | 2172 void RenderWidgetHostImpl::AccessibilityDoDefaultAction(int object_id) { |
| 2157 Send(new AccessibilityMsg_DoDefaultAction(GetRoutingID(), object_id)); | 2173 Send(new AccessibilityMsg_DoDefaultAction(GetRoutingID(), object_id)); |
| 2158 } | 2174 } |
| 2159 | 2175 |
| 2160 void RenderWidgetHostImpl::AccessibilitySetFocus(int object_id) { | 2176 void RenderWidgetHostImpl::AccessibilitySetFocus(int object_id) { |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2551 } | 2567 } |
| 2552 } | 2568 } |
| 2553 | 2569 |
| 2554 // Add newly generated components into the latency info | 2570 // Add newly generated components into the latency info |
| 2555 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { | 2571 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { |
| 2556 latency_info->latency_components[lc->first] = lc->second; | 2572 latency_info->latency_components[lc->first] = lc->second; |
| 2557 } | 2573 } |
| 2558 } | 2574 } |
| 2559 | 2575 |
| 2560 } // namespace content | 2576 } // namespace content |
| OLD | NEW |