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

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: Rebase Created 6 years, 5 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
(...skipping 27 matching lines...) Expand all
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/browser/renderer_host/render_widget_resize_helper.h" 47 #include "content/browser/renderer_host/render_widget_resize_helper.h"
48 #include "content/common/accessibility_messages.h"
49 #include "content/common/content_constants_internal.h" 48 #include "content/common/content_constants_internal.h"
50 #include "content/common/cursors/webcursor.h" 49 #include "content/common/cursors/webcursor.h"
51 #include "content/common/gpu/gpu_messages.h" 50 #include "content/common/gpu/gpu_messages.h"
52 #include "content/common/host_shared_bitmap_manager.h" 51 #include "content/common/host_shared_bitmap_manager.h"
53 #include "content/common/input_messages.h" 52 #include "content/common/input_messages.h"
54 #include "content/common/view_messages.h" 53 #include "content/common/view_messages.h"
55 #include "content/public/browser/native_web_keyboard_event.h" 54 #include "content/public/browser/native_web_keyboard_event.h"
56 #include "content/public/browser/notification_service.h" 55 #include "content/public/browser/notification_service.h"
57 #include "content/public/browser/notification_types.h" 56 #include "content/public/browser/notification_types.h"
58 #include "content/public/browser/render_widget_host_iterator.h" 57 #include "content/public/browser/render_widget_host_iterator.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 surface_id_(0), 164 surface_id_(0),
166 is_loading_(false), 165 is_loading_(false),
167 is_hidden_(hidden), 166 is_hidden_(hidden),
168 is_fullscreen_(false), 167 is_fullscreen_(false),
169 repaint_ack_pending_(false), 168 repaint_ack_pending_(false),
170 resize_ack_pending_(false), 169 resize_ack_pending_(false),
171 screen_info_out_of_date_(false), 170 screen_info_out_of_date_(false),
172 overdraw_bottom_height_(0.f), 171 overdraw_bottom_height_(0.f),
173 should_auto_resize_(false), 172 should_auto_resize_(false),
174 waiting_for_screen_rects_ack_(false), 173 waiting_for_screen_rects_ack_(false),
175 accessibility_mode_(AccessibilityModeOff),
176 needs_repainting_on_restore_(false), 174 needs_repainting_on_restore_(false),
177 is_unresponsive_(false), 175 is_unresponsive_(false),
178 in_flight_event_count_(0), 176 in_flight_event_count_(0),
179 in_get_backing_store_(false), 177 in_get_backing_store_(false),
180 ignore_input_events_(false), 178 ignore_input_events_(false),
181 input_method_active_(false), 179 input_method_active_(false),
182 text_direction_updated_(false), 180 text_direction_updated_(false),
183 text_direction_(blink::WebTextDirectionLeftToRight), 181 text_direction_(blink::WebTextDirectionLeftToRight),
184 text_direction_canceled_(false), 182 text_direction_canceled_(false),
185 suppress_next_char_events_(false), 183 suppress_next_char_events_(false),
(...skipping 27 matching lines...) Expand all
213 g_routing_id_widget_map.Get().insert(std::make_pair( 211 g_routing_id_widget_map.Get().insert(std::make_pair(
214 RenderWidgetHostID(process->GetID(), routing_id_), this)); 212 RenderWidgetHostID(process->GetID(), routing_id_), this));
215 CHECK(result.second) << "Inserting a duplicate item!"; 213 CHECK(result.second) << "Inserting a duplicate item!";
216 process_->AddRoute(routing_id_, this); 214 process_->AddRoute(routing_id_, this);
217 215
218 // If we're initially visible, tell the process host that we're alive. 216 // If we're initially visible, tell the process host that we're alive.
219 // Otherwise we'll notify the process host when we are first shown. 217 // Otherwise we'll notify the process host when we are first shown.
220 if (!hidden) 218 if (!hidden)
221 process_->WidgetRestored(); 219 process_->WidgetRestored();
222 220
223 accessibility_mode_ =
224 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode();
225
226 input_router_.reset(new InputRouterImpl( 221 input_router_.reset(new InputRouterImpl(
227 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); 222 process_, this, this, routing_id_, GetInputRouterConfigForPlatform()));
228 223
229 touch_emulator_.reset(); 224 touch_emulator_.reset();
230 225
231 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 226 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
232 IsRenderView() ? RenderViewHost::From(this) : NULL); 227 IsRenderView() ? RenderViewHost::From(this) : NULL);
233 if (BrowserPluginGuest::IsGuest(rvh) || 228 if (BrowserPluginGuest::IsGuest(rvh) ||
234 !CommandLine::ForCurrentProcess()->HasSwitch( 229 !CommandLine::ForCurrentProcess()->HasSwitch(
235 switches::kDisableHangMonitor)) { 230 switches::kDisableHangMonitor)) {
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 hang_monitor_timeout_->Restart( 834 hang_monitor_timeout_->Restart(
840 base::TimeDelta::FromMilliseconds(hung_renderer_delay_ms_)); 835 base::TimeDelta::FromMilliseconds(hung_renderer_delay_ms_));
841 } 836 }
842 837
843 void RenderWidgetHostImpl::StopHangMonitorTimeout() { 838 void RenderWidgetHostImpl::StopHangMonitorTimeout() {
844 if (hang_monitor_timeout_) 839 if (hang_monitor_timeout_)
845 hang_monitor_timeout_->Stop(); 840 hang_monitor_timeout_->Stop();
846 RendererIsResponsive(); 841 RendererIsResponsive();
847 } 842 }
848 843
849 void RenderWidgetHostImpl::EnableFullAccessibilityMode() {
850 AddAccessibilityMode(AccessibilityModeComplete);
851 }
852
853 bool RenderWidgetHostImpl::IsFullAccessibilityModeForTesting() {
854 return accessibility_mode() == AccessibilityModeComplete;
855 }
856
857 void RenderWidgetHostImpl::EnableTreeOnlyAccessibilityMode() {
858 AddAccessibilityMode(AccessibilityModeTreeOnly);
859 }
860
861 bool RenderWidgetHostImpl::IsTreeOnlyAccessibilityModeForTesting() {
862 return accessibility_mode() == AccessibilityModeTreeOnly;
863 }
864
865 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { 844 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
866 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); 845 ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo());
867 } 846 }
868 847
869 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( 848 void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
870 const blink::WebMouseEvent& mouse_event, 849 const blink::WebMouseEvent& mouse_event,
871 const ui::LatencyInfo& ui_latency) { 850 const ui::LatencyInfo& ui_latency) {
872 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", 851 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent",
873 "x", mouse_event.x, "y", mouse_event.y); 852 "x", mouse_event.x, "y", mouse_event.y);
874 853
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698