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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 273423004: Migrate accessibility from RenderView to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more compile errors Created 6 years, 7 months 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/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/base/switches.h" 24 #include "cc/base/switches.h"
25 #include "cc/output/compositor_frame.h" 25 #include "cc/output/compositor_frame.h"
26 #include "cc/output/compositor_frame_ack.h" 26 #include "cc/output/compositor_frame_ack.h"
27 #include "content/browser/accessibility/accessibility_mode_helper.h"
28 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
29 #include "content/browser/gpu/compositor_util.h" 27 #include "content/browser/gpu/compositor_util.h"
30 #include "content/browser/gpu/gpu_process_host.h" 28 #include "content/browser/gpu/gpu_process_host.h"
31 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 29 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
32 #include "content/browser/gpu/gpu_surface_tracker.h" 30 #include "content/browser/gpu/gpu_surface_tracker.h"
33 #include "content/browser/renderer_host/dip_util.h" 31 #include "content/browser/renderer_host/dip_util.h"
34 #include "content/browser/renderer_host/input/input_router_config_helper.h" 32 #include "content/browser/renderer_host/input/input_router_config_helper.h"
35 #include "content/browser/renderer_host/input/input_router_impl.h" 33 #include "content/browser/renderer_host/input/input_router_impl.h"
36 #include "content/browser/renderer_host/input/synthetic_gesture.h" 34 #include "content/browser/renderer_host/input/synthetic_gesture.h"
37 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" 35 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h"
38 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" 36 #include "content/browser/renderer_host/input/synthetic_gesture_target.h"
39 #include "content/browser/renderer_host/input/timeout_monitor.h" 37 #include "content/browser/renderer_host/input/timeout_monitor.h"
40 #include "content/browser/renderer_host/input/touch_emulator.h" 38 #include "content/browser/renderer_host/input/touch_emulator.h"
41 #include "content/browser/renderer_host/overscroll_controller.h" 39 #include "content/browser/renderer_host/overscroll_controller.h"
42 #include "content/browser/renderer_host/render_process_host_impl.h" 40 #include "content/browser/renderer_host/render_process_host_impl.h"
43 #include "content/browser/renderer_host/render_view_host_impl.h" 41 #include "content/browser/renderer_host/render_view_host_impl.h"
44 #include "content/browser/renderer_host/render_widget_helper.h" 42 #include "content/browser/renderer_host/render_widget_helper.h"
45 #include "content/browser/renderer_host/render_widget_host_delegate.h" 43 #include "content/browser/renderer_host/render_widget_host_delegate.h"
46 #include "content/browser/renderer_host/render_widget_host_view_base.h" 44 #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" 45 #include "content/common/content_constants_internal.h"
49 #include "content/common/cursors/webcursor.h" 46 #include "content/common/cursors/webcursor.h"
50 #include "content/common/gpu/gpu_messages.h" 47 #include "content/common/gpu/gpu_messages.h"
51 #include "content/common/host_shared_bitmap_manager.h" 48 #include "content/common/host_shared_bitmap_manager.h"
52 #include "content/common/input_messages.h" 49 #include "content/common/input_messages.h"
53 #include "content/common/view_messages.h" 50 #include "content/common/view_messages.h"
54 #include "content/public/browser/native_web_keyboard_event.h" 51 #include "content/public/browser/native_web_keyboard_event.h"
55 #include "content/public/browser/notification_service.h" 52 #include "content/public/browser/notification_service.h"
56 #include "content/public/browser/notification_types.h" 53 #include "content/public/browser/notification_types.h"
57 #include "content/public/browser/render_widget_host_iterator.h" 54 #include "content/public/browser/render_widget_host_iterator.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 is_loading_(false), 168 is_loading_(false),
172 is_hidden_(hidden), 169 is_hidden_(hidden),
173 is_fullscreen_(false), 170 is_fullscreen_(false),
174 is_accelerated_compositing_active_(false), 171 is_accelerated_compositing_active_(false),
175 repaint_ack_pending_(false), 172 repaint_ack_pending_(false),
176 resize_ack_pending_(false), 173 resize_ack_pending_(false),
177 screen_info_out_of_date_(false), 174 screen_info_out_of_date_(false),
178 overdraw_bottom_height_(0.f), 175 overdraw_bottom_height_(0.f),
179 should_auto_resize_(false), 176 should_auto_resize_(false),
180 waiting_for_screen_rects_ack_(false), 177 waiting_for_screen_rects_ack_(false),
181 accessibility_mode_(AccessibilityModeOff),
182 needs_repainting_on_restore_(false), 178 needs_repainting_on_restore_(false),
183 is_unresponsive_(false), 179 is_unresponsive_(false),
184 in_flight_event_count_(0), 180 in_flight_event_count_(0),
185 in_get_backing_store_(false), 181 in_get_backing_store_(false),
186 view_being_painted_(false), 182 view_being_painted_(false),
187 ignore_input_events_(false), 183 ignore_input_events_(false),
188 input_method_active_(false), 184 input_method_active_(false),
189 text_direction_updated_(false), 185 text_direction_updated_(false),
190 text_direction_(blink::WebTextDirectionLeftToRight), 186 text_direction_(blink::WebTextDirectionLeftToRight),
191 text_direction_canceled_(false), 187 text_direction_canceled_(false),
(...skipping 27 matching lines...) Expand all
219 g_routing_id_widget_map.Get().insert(std::make_pair( 215 g_routing_id_widget_map.Get().insert(std::make_pair(
220 RenderWidgetHostID(process->GetID(), routing_id_), this)); 216 RenderWidgetHostID(process->GetID(), routing_id_), this));
221 CHECK(result.second) << "Inserting a duplicate item!"; 217 CHECK(result.second) << "Inserting a duplicate item!";
222 process_->AddRoute(routing_id_, this); 218 process_->AddRoute(routing_id_, this);
223 219
224 // If we're initially visible, tell the process host that we're alive. 220 // If we're initially visible, tell the process host that we're alive.
225 // Otherwise we'll notify the process host when we are first shown. 221 // Otherwise we'll notify the process host when we are first shown.
226 if (!hidden) 222 if (!hidden)
227 process_->WidgetRestored(); 223 process_->WidgetRestored();
228 224
229 accessibility_mode_ =
230 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode();
231
232 input_router_.reset(new InputRouterImpl( 225 input_router_.reset(new InputRouterImpl(
233 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); 226 process_, this, this, routing_id_, GetInputRouterConfigForPlatform()));
234 227
235 touch_emulator_.reset(); 228 touch_emulator_.reset();
236 229
237 #if defined(USE_AURA) 230 #if defined(USE_AURA)
238 bool overscroll_enabled = CommandLine::ForCurrentProcess()-> 231 bool overscroll_enabled = CommandLine::ForCurrentProcess()->
239 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; 232 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0";
240 SetOverscrollControllerEnabled(overscroll_enabled); 233 SetOverscrollControllerEnabled(overscroll_enabled);
241 #endif 234 #endif
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 hang_monitor_timeout_->Restart( 860 hang_monitor_timeout_->Restart(
868 base::TimeDelta::FromMilliseconds(hung_renderer_delay_ms_)); 861 base::TimeDelta::FromMilliseconds(hung_renderer_delay_ms_));
869 } 862 }
870 863
871 void RenderWidgetHostImpl::StopHangMonitorTimeout() { 864 void RenderWidgetHostImpl::StopHangMonitorTimeout() {
872 if (hang_monitor_timeout_) 865 if (hang_monitor_timeout_)
873 hang_monitor_timeout_->Stop(); 866 hang_monitor_timeout_->Stop();
874 RendererIsResponsive(); 867 RendererIsResponsive();
875 } 868 }
876 869
877 void RenderWidgetHostImpl::EnableFullAccessibilityMode() {
878 AddAccessibilityMode(AccessibilityModeComplete);
879 }
880
881 bool RenderWidgetHostImpl::IsFullAccessibilityModeForTesting() {
882 return accessibility_mode() == AccessibilityModeComplete;
883 }
884
885 void RenderWidgetHostImpl::EnableTreeOnlyAccessibilityMode() {
886 AddAccessibilityMode(AccessibilityModeTreeOnly);
887 }
888
889 bool RenderWidgetHostImpl::IsTreeOnlyAccessibilityModeForTesting() {
890 return accessibility_mode() == AccessibilityModeTreeOnly;
891 }
892
893 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { 870 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
894 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); 871 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo());
895 } 872 }
896 873
897 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( 874 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
898 const blink::WebMouseEvent& mouse_event, 875 const blink::WebMouseEvent& mouse_event,
899 const ui::LatencyInfo& ui_latency) { 876 const ui::LatencyInfo& ui_latency) {
900 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", 877 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent",
901 "x", mouse_event.x, "y", mouse_event.y); 878 "x", mouse_event.x, "y", mouse_event.y);
902 879
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 1944
1968 void RenderWidgetHostImpl::SetBackground(const SkBitmap& background) { 1945 void RenderWidgetHostImpl::SetBackground(const SkBitmap& background) {
1969 Send(new ViewMsg_SetBackground(GetRoutingID(), background)); 1946 Send(new ViewMsg_SetBackground(GetRoutingID(), background));
1970 } 1947 }
1971 1948
1972 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( 1949 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent(
1973 const std::vector<EditCommand>& commands) { 1950 const std::vector<EditCommand>& commands) {
1974 Send(new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), commands)); 1951 Send(new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), commands));
1975 } 1952 }
1976 1953
1977 void RenderWidgetHostImpl::AddAccessibilityMode(AccessibilityMode mode) {
1978 SetAccessibilityMode(
1979 content::AddAccessibilityModeTo(accessibility_mode_, mode));
1980 }
1981
1982 void RenderWidgetHostImpl::RemoveAccessibilityMode(AccessibilityMode mode) {
1983 SetAccessibilityMode(
1984 content::RemoveAccessibilityModeFrom(accessibility_mode_, mode));
1985 }
1986
1987 void RenderWidgetHostImpl::ResetAccessibilityMode() {
1988 SetAccessibilityMode(
1989 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode());
1990 }
1991
1992 void RenderWidgetHostImpl::SetAccessibilityMode(AccessibilityMode mode) {
1993 accessibility_mode_ = mode;
1994 Send(new ViewMsg_SetAccessibilityMode(GetRoutingID(), mode));
1995 }
1996
1997 void RenderWidgetHostImpl::AccessibilitySetFocus(int object_id) {
1998 Send(new AccessibilityMsg_SetFocus(GetRoutingID(), object_id));
1999 view_->OnAccessibilitySetFocus(object_id);
2000 }
2001
2002 void RenderWidgetHostImpl::AccessibilityDoDefaultAction(int object_id) {
2003 Send(new AccessibilityMsg_DoDefaultAction(GetRoutingID(), object_id));
2004 }
2005
2006 void RenderWidgetHostImpl::AccessibilityShowMenu(int object_id) {
2007 view_->AccessibilityShowMenu(object_id);
2008 }
2009
2010 void RenderWidgetHostImpl::AccessibilityScrollToMakeVisible(
2011 int acc_obj_id, gfx::Rect subfocus) {
2012 Send(new AccessibilityMsg_ScrollToMakeVisible(
2013 GetRoutingID(), acc_obj_id, subfocus));
2014 }
2015
2016 void RenderWidgetHostImpl::AccessibilityScrollToPoint(
2017 int acc_obj_id, gfx::Point point) {
2018 Send(new AccessibilityMsg_ScrollToPoint(
2019 GetRoutingID(), acc_obj_id, point));
2020 }
2021
2022 void RenderWidgetHostImpl::AccessibilitySetTextSelection(
2023 int object_id, int start_offset, int end_offset) {
2024 Send(new AccessibilityMsg_SetTextSelection(
2025 GetRoutingID(), object_id, start_offset, end_offset));
2026 }
2027
2028 bool RenderWidgetHostImpl::AccessibilityViewHasFocus() const {
2029 return view_->HasFocus();
2030 }
2031
2032 gfx::Rect RenderWidgetHostImpl::AccessibilityGetViewBounds() const {
2033 return view_->GetViewBounds();
2034 }
2035
2036 gfx::Point RenderWidgetHostImpl::AccessibilityOriginInScreen(
2037 const gfx::Rect& bounds) const {
2038 return view_->AccessibilityOriginInScreen(bounds);
2039 }
2040
2041 void RenderWidgetHostImpl::AccessibilityFatalError() {
2042 Send(new AccessibilityMsg_FatalError(GetRoutingID()));
2043 view_->SetBrowserAccessibilityManager(NULL);
2044 }
2045
2046 #if defined(OS_WIN)
2047 void RenderWidgetHostImpl::SetParentNativeViewAccessible(
2048 gfx::NativeViewAccessible accessible_parent) {
2049 if (view_)
2050 view_->SetParentNativeViewAccessible(accessible_parent);
2051 }
2052
2053 gfx::NativeViewAccessible
2054 RenderWidgetHostImpl::GetParentNativeViewAccessible() const {
2055 return delegate_->GetParentNativeViewAccessible();
2056 }
2057 #endif
2058
2059 void RenderWidgetHostImpl::ExecuteEditCommand(const std::string& command, 1954 void RenderWidgetHostImpl::ExecuteEditCommand(const std::string& command,
2060 const std::string& value) { 1955 const std::string& value) {
2061 Send(new InputMsg_ExecuteEditCommand(GetRoutingID(), command, value)); 1956 Send(new InputMsg_ExecuteEditCommand(GetRoutingID(), command, value));
2062 } 1957 }
2063 1958
2064 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( 1959 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect(
2065 const gfx::Rect& rect) { 1960 const gfx::Rect& rect) {
2066 Send(new InputMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect)); 1961 Send(new InputMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect));
2067 } 1962 }
2068 1963
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 } 2231 }
2337 } 2232 }
2338 2233
2339 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { 2234 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() {
2340 if (view_) 2235 if (view_)
2341 return view_->PreferredReadbackFormat(); 2236 return view_->PreferredReadbackFormat();
2342 return SkBitmap::kARGB_8888_Config; 2237 return SkBitmap::kARGB_8888_Config;
2343 } 2238 }
2344 2239
2345 } // namespace content 2240 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698