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 |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 37 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
38 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" | 38 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" |
39 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 39 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
40 #include "content/browser/renderer_host/input/timeout_monitor.h" | 40 #include "content/browser/renderer_host/input/timeout_monitor.h" |
41 #include "content/browser/renderer_host/input/touch_emulator.h" | 41 #include "content/browser/renderer_host/input/touch_emulator.h" |
42 #include "content/browser/renderer_host/render_process_host_impl.h" | 42 #include "content/browser/renderer_host/render_process_host_impl.h" |
43 #include "content/browser/renderer_host/render_view_host_impl.h" | 43 #include "content/browser/renderer_host/render_view_host_impl.h" |
44 #include "content/browser/renderer_host/render_widget_helper.h" | 44 #include "content/browser/renderer_host/render_widget_helper.h" |
45 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 45 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
46 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 46 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
47 #include "content/common/accessibility_messages.h" | |
48 #include "content/common/content_constants_internal.h" | 47 #include "content/common/content_constants_internal.h" |
49 #include "content/common/cursors/webcursor.h" | 48 #include "content/common/cursors/webcursor.h" |
50 #include "content/common/gpu/gpu_messages.h" | 49 #include "content/common/gpu/gpu_messages.h" |
51 #include "content/common/host_shared_bitmap_manager.h" | 50 #include "content/common/host_shared_bitmap_manager.h" |
52 #include "content/common/input_messages.h" | 51 #include "content/common/input_messages.h" |
53 #include "content/common/view_messages.h" | 52 #include "content/common/view_messages.h" |
54 #include "content/public/browser/native_web_keyboard_event.h" | 53 #include "content/public/browser/native_web_keyboard_event.h" |
55 #include "content/public/browser/notification_service.h" | 54 #include "content/public/browser/notification_service.h" |
56 #include "content/public/browser/notification_types.h" | 55 #include "content/public/browser/notification_types.h" |
57 #include "content/public/browser/render_widget_host_iterator.h" | 56 #include "content/public/browser/render_widget_host_iterator.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 surface_id_(0), | 169 surface_id_(0), |
171 is_loading_(false), | 170 is_loading_(false), |
172 is_hidden_(hidden), | 171 is_hidden_(hidden), |
173 is_fullscreen_(false), | 172 is_fullscreen_(false), |
174 repaint_ack_pending_(false), | 173 repaint_ack_pending_(false), |
175 resize_ack_pending_(false), | 174 resize_ack_pending_(false), |
176 screen_info_out_of_date_(false), | 175 screen_info_out_of_date_(false), |
177 overdraw_bottom_height_(0.f), | 176 overdraw_bottom_height_(0.f), |
178 should_auto_resize_(false), | 177 should_auto_resize_(false), |
179 waiting_for_screen_rects_ack_(false), | 178 waiting_for_screen_rects_ack_(false), |
180 accessibility_mode_(AccessibilityModeOff), | |
181 needs_repainting_on_restore_(false), | 179 needs_repainting_on_restore_(false), |
182 is_unresponsive_(false), | 180 is_unresponsive_(false), |
183 in_flight_event_count_(0), | 181 in_flight_event_count_(0), |
184 in_get_backing_store_(false), | 182 in_get_backing_store_(false), |
185 ignore_input_events_(false), | 183 ignore_input_events_(false), |
186 input_method_active_(false), | 184 input_method_active_(false), |
187 text_direction_updated_(false), | 185 text_direction_updated_(false), |
188 text_direction_(blink::WebTextDirectionLeftToRight), | 186 text_direction_(blink::WebTextDirectionLeftToRight), |
189 text_direction_canceled_(false), | 187 text_direction_canceled_(false), |
190 suppress_next_char_events_(false), | 188 suppress_next_char_events_(false), |
(...skipping 27 matching lines...) Expand all Loading... |
218 g_routing_id_widget_map.Get().insert(std::make_pair( | 216 g_routing_id_widget_map.Get().insert(std::make_pair( |
219 RenderWidgetHostID(process->GetID(), routing_id_), this)); | 217 RenderWidgetHostID(process->GetID(), routing_id_), this)); |
220 CHECK(result.second) << "Inserting a duplicate item!"; | 218 CHECK(result.second) << "Inserting a duplicate item!"; |
221 process_->AddRoute(routing_id_, this); | 219 process_->AddRoute(routing_id_, this); |
222 | 220 |
223 // If we're initially visible, tell the process host that we're alive. | 221 // If we're initially visible, tell the process host that we're alive. |
224 // Otherwise we'll notify the process host when we are first shown. | 222 // Otherwise we'll notify the process host when we are first shown. |
225 if (!hidden) | 223 if (!hidden) |
226 process_->WidgetRestored(); | 224 process_->WidgetRestored(); |
227 | 225 |
228 accessibility_mode_ = | |
229 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode(); | |
230 | |
231 input_router_.reset(new InputRouterImpl( | 226 input_router_.reset(new InputRouterImpl( |
232 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); | 227 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); |
233 | 228 |
234 touch_emulator_.reset(); | 229 touch_emulator_.reset(); |
235 | 230 |
236 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 231 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
237 IsRenderView() ? RenderViewHost::From(this) : NULL); | 232 IsRenderView() ? RenderViewHost::From(this) : NULL); |
238 if (BrowserPluginGuest::IsGuest(rvh) || | 233 if (BrowserPluginGuest::IsGuest(rvh) || |
239 !CommandLine::ForCurrentProcess()->HasSwitch( | 234 !CommandLine::ForCurrentProcess()->HasSwitch( |
240 switches::kDisableHangMonitor)) { | 235 switches::kDisableHangMonitor)) { |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 hang_monitor_timeout_->Restart( | 837 hang_monitor_timeout_->Restart( |
843 base::TimeDelta::FromMilliseconds(hung_renderer_delay_ms_)); | 838 base::TimeDelta::FromMilliseconds(hung_renderer_delay_ms_)); |
844 } | 839 } |
845 | 840 |
846 void RenderWidgetHostImpl::StopHangMonitorTimeout() { | 841 void RenderWidgetHostImpl::StopHangMonitorTimeout() { |
847 if (hang_monitor_timeout_) | 842 if (hang_monitor_timeout_) |
848 hang_monitor_timeout_->Stop(); | 843 hang_monitor_timeout_->Stop(); |
849 RendererIsResponsive(); | 844 RendererIsResponsive(); |
850 } | 845 } |
851 | 846 |
852 void RenderWidgetHostImpl::EnableFullAccessibilityMode() { | |
853 AddAccessibilityMode(AccessibilityModeComplete); | |
854 } | |
855 | |
856 bool RenderWidgetHostImpl::IsFullAccessibilityModeForTesting() { | |
857 return accessibility_mode() == AccessibilityModeComplete; | |
858 } | |
859 | |
860 void RenderWidgetHostImpl::EnableTreeOnlyAccessibilityMode() { | |
861 AddAccessibilityMode(AccessibilityModeTreeOnly); | |
862 } | |
863 | |
864 bool RenderWidgetHostImpl::IsTreeOnlyAccessibilityModeForTesting() { | |
865 return accessibility_mode() == AccessibilityModeTreeOnly; | |
866 } | |
867 | |
868 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { | 847 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { |
869 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); | 848 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); |
870 } | 849 } |
871 | 850 |
872 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( | 851 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( |
873 const blink::WebMouseEvent& mouse_event, | 852 const blink::WebMouseEvent& mouse_event, |
874 const ui::LatencyInfo& ui_latency) { | 853 const ui::LatencyInfo& ui_latency) { |
875 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", | 854 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", |
876 "x", mouse_event.x, "y", mouse_event.y); | 855 "x", mouse_event.x, "y", mouse_event.y); |
877 | 856 |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1939 | 1918 |
1940 void RenderWidgetHostImpl::SetBackgroundOpaque(bool opaque) { | 1919 void RenderWidgetHostImpl::SetBackgroundOpaque(bool opaque) { |
1941 Send(new ViewMsg_SetBackgroundOpaque(GetRoutingID(), opaque)); | 1920 Send(new ViewMsg_SetBackgroundOpaque(GetRoutingID(), opaque)); |
1942 } | 1921 } |
1943 | 1922 |
1944 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( | 1923 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( |
1945 const std::vector<EditCommand>& commands) { | 1924 const std::vector<EditCommand>& commands) { |
1946 Send(new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), commands)); | 1925 Send(new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), commands)); |
1947 } | 1926 } |
1948 | 1927 |
1949 void RenderWidgetHostImpl::AddAccessibilityMode(AccessibilityMode mode) { | |
1950 SetAccessibilityMode( | |
1951 content::AddAccessibilityModeTo(accessibility_mode_, mode)); | |
1952 } | |
1953 | |
1954 void RenderWidgetHostImpl::RemoveAccessibilityMode(AccessibilityMode mode) { | |
1955 SetAccessibilityMode( | |
1956 content::RemoveAccessibilityModeFrom(accessibility_mode_, mode)); | |
1957 } | |
1958 | |
1959 void RenderWidgetHostImpl::ResetAccessibilityMode() { | |
1960 SetAccessibilityMode( | |
1961 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()); | |
1962 } | |
1963 | |
1964 void RenderWidgetHostImpl::SetAccessibilityMode(AccessibilityMode mode) { | |
1965 accessibility_mode_ = mode; | |
1966 Send(new ViewMsg_SetAccessibilityMode(GetRoutingID(), mode)); | |
1967 } | |
1968 | |
1969 void RenderWidgetHostImpl::AccessibilitySetFocus(int object_id) { | |
1970 Send(new AccessibilityMsg_SetFocus(GetRoutingID(), object_id)); | |
1971 view_->OnAccessibilitySetFocus(object_id); | |
1972 } | |
1973 | |
1974 void RenderWidgetHostImpl::AccessibilityDoDefaultAction(int object_id) { | |
1975 Send(new AccessibilityMsg_DoDefaultAction(GetRoutingID(), object_id)); | |
1976 } | |
1977 | |
1978 void RenderWidgetHostImpl::AccessibilityShowMenu(int object_id) { | |
1979 view_->AccessibilityShowMenu(object_id); | |
1980 } | |
1981 | |
1982 void RenderWidgetHostImpl::AccessibilityScrollToMakeVisible( | |
1983 int acc_obj_id, gfx::Rect subfocus) { | |
1984 Send(new AccessibilityMsg_ScrollToMakeVisible( | |
1985 GetRoutingID(), acc_obj_id, subfocus)); | |
1986 } | |
1987 | |
1988 void RenderWidgetHostImpl::AccessibilityScrollToPoint( | |
1989 int acc_obj_id, gfx::Point point) { | |
1990 Send(new AccessibilityMsg_ScrollToPoint( | |
1991 GetRoutingID(), acc_obj_id, point)); | |
1992 } | |
1993 | |
1994 void RenderWidgetHostImpl::AccessibilitySetTextSelection( | |
1995 int object_id, int start_offset, int end_offset) { | |
1996 Send(new AccessibilityMsg_SetTextSelection( | |
1997 GetRoutingID(), object_id, start_offset, end_offset)); | |
1998 } | |
1999 | |
2000 bool RenderWidgetHostImpl::AccessibilityViewHasFocus() const { | |
2001 return view_->HasFocus(); | |
2002 } | |
2003 | |
2004 gfx::Rect RenderWidgetHostImpl::AccessibilityGetViewBounds() const { | |
2005 return view_->GetViewBounds(); | |
2006 } | |
2007 | |
2008 gfx::Point RenderWidgetHostImpl::AccessibilityOriginInScreen( | |
2009 const gfx::Rect& bounds) const { | |
2010 return view_->AccessibilityOriginInScreen(bounds); | |
2011 } | |
2012 | |
2013 void RenderWidgetHostImpl::AccessibilityHitTest(const gfx::Point& point) { | |
2014 Send(new AccessibilityMsg_HitTest(GetRoutingID(), point)); | |
2015 } | |
2016 | |
2017 void RenderWidgetHostImpl::AccessibilityFatalError() { | |
2018 Send(new AccessibilityMsg_FatalError(GetRoutingID())); | |
2019 view_->SetBrowserAccessibilityManager(NULL); | |
2020 } | |
2021 | |
2022 #if defined(OS_WIN) | |
2023 void RenderWidgetHostImpl::SetParentNativeViewAccessible( | |
2024 gfx::NativeViewAccessible accessible_parent) { | |
2025 if (view_) | |
2026 view_->SetParentNativeViewAccessible(accessible_parent); | |
2027 } | |
2028 | |
2029 gfx::NativeViewAccessible | |
2030 RenderWidgetHostImpl::GetParentNativeViewAccessible() const { | |
2031 return delegate_->GetParentNativeViewAccessible(); | |
2032 } | |
2033 #endif | |
2034 | |
2035 void RenderWidgetHostImpl::ExecuteEditCommand(const std::string& command, | 1928 void RenderWidgetHostImpl::ExecuteEditCommand(const std::string& command, |
2036 const std::string& value) { | 1929 const std::string& value) { |
2037 Send(new InputMsg_ExecuteEditCommand(GetRoutingID(), command, value)); | 1930 Send(new InputMsg_ExecuteEditCommand(GetRoutingID(), command, value)); |
2038 } | 1931 } |
2039 | 1932 |
2040 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( | 1933 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( |
2041 const gfx::Rect& rect) { | 1934 const gfx::Rect& rect) { |
2042 Send(new InputMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect)); | 1935 Send(new InputMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect)); |
2043 } | 1936 } |
2044 | 1937 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 ++lc; | 2267 ++lc; |
2375 } | 2268 } |
2376 } | 2269 } |
2377 | 2270 |
2378 // Add newly generated components into the latency info | 2271 // Add newly generated components into the latency info |
2379 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { | 2272 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { |
2380 latency_info->latency_components[lc->first] = lc->second; | 2273 latency_info->latency_components[lc->first] = lc->second; |
2381 } | 2274 } |
2382 } | 2275 } |
2383 | 2276 |
| 2277 BrowserAccessibilityManager* |
| 2278 RenderWidgetHostImpl::GetRootBrowserAccessibilityManager() { |
| 2279 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; |
| 2280 } |
| 2281 |
| 2282 BrowserAccessibilityManager* |
| 2283 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { |
| 2284 return delegate_ ? |
| 2285 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; |
| 2286 } |
| 2287 |
| 2288 #if defined(OS_WIN) |
| 2289 gfx::NativeViewAccessible |
| 2290 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
| 2291 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
| 2292 } |
| 2293 #endif |
| 2294 |
2384 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2295 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2385 if (view_) | 2296 if (view_) |
2386 return view_->PreferredReadbackFormat(); | 2297 return view_->PreferredReadbackFormat(); |
2387 return kN32_SkColorType; | 2298 return kN32_SkColorType; |
2388 } | 2299 } |
2389 | 2300 |
2390 } // namespace content | 2301 } // namespace content |
OLD | NEW |