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

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

Issue 407493004: Revert of Revert of Migrate accessibility from RenderView to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 1878
1900 void RenderWidgetHostImpl::SetBackgroundOpaque(bool opaque) { 1879 void RenderWidgetHostImpl::SetBackgroundOpaque(bool opaque) {
1901 Send(new ViewMsg_SetBackgroundOpaque(GetRoutingID(), opaque)); 1880 Send(new ViewMsg_SetBackgroundOpaque(GetRoutingID(), opaque));
1902 } 1881 }
1903 1882
1904 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( 1883 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent(
1905 const std::vector<EditCommand>& commands) { 1884 const std::vector<EditCommand>& commands) {
1906 Send(new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), commands)); 1885 Send(new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), commands));
1907 } 1886 }
1908 1887
1909 void RenderWidgetHostImpl::AddAccessibilityMode(AccessibilityMode mode) {
1910 SetAccessibilityMode(
1911 content::AddAccessibilityModeTo(accessibility_mode_, mode));
1912 }
1913
1914 void RenderWidgetHostImpl::RemoveAccessibilityMode(AccessibilityMode mode) {
1915 SetAccessibilityMode(
1916 content::RemoveAccessibilityModeFrom(accessibility_mode_, mode));
1917 }
1918
1919 void RenderWidgetHostImpl::ResetAccessibilityMode() {
1920 SetAccessibilityMode(
1921 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode());
1922 }
1923
1924 void RenderWidgetHostImpl::SetAccessibilityMode(AccessibilityMode mode) {
1925 accessibility_mode_ = mode;
1926 Send(new ViewMsg_SetAccessibilityMode(GetRoutingID(), mode));
1927 }
1928
1929 void RenderWidgetHostImpl::AccessibilitySetFocus(int object_id) {
1930 Send(new AccessibilityMsg_SetFocus(GetRoutingID(), object_id));
1931 view_->OnAccessibilitySetFocus(object_id);
1932 }
1933
1934 void RenderWidgetHostImpl::AccessibilityDoDefaultAction(int object_id) {
1935 Send(new AccessibilityMsg_DoDefaultAction(GetRoutingID(), object_id));
1936 }
1937
1938 void RenderWidgetHostImpl::AccessibilityShowMenu(int object_id) {
1939 view_->AccessibilityShowMenu(object_id);
1940 }
1941
1942 void RenderWidgetHostImpl::AccessibilityScrollToMakeVisible(
1943 int acc_obj_id, gfx::Rect subfocus) {
1944 Send(new AccessibilityMsg_ScrollToMakeVisible(
1945 GetRoutingID(), acc_obj_id, subfocus));
1946 }
1947
1948 void RenderWidgetHostImpl::AccessibilityScrollToPoint(
1949 int acc_obj_id, gfx::Point point) {
1950 Send(new AccessibilityMsg_ScrollToPoint(
1951 GetRoutingID(), acc_obj_id, point));
1952 }
1953
1954 void RenderWidgetHostImpl::AccessibilitySetTextSelection(
1955 int object_id, int start_offset, int end_offset) {
1956 Send(new AccessibilityMsg_SetTextSelection(
1957 GetRoutingID(), object_id, start_offset, end_offset));
1958 }
1959
1960 bool RenderWidgetHostImpl::AccessibilityViewHasFocus() const {
1961 return view_->HasFocus();
1962 }
1963
1964 gfx::Rect RenderWidgetHostImpl::AccessibilityGetViewBounds() const {
1965 return view_->GetViewBounds();
1966 }
1967
1968 gfx::Point RenderWidgetHostImpl::AccessibilityOriginInScreen(
1969 const gfx::Rect& bounds) const {
1970 return view_->AccessibilityOriginInScreen(bounds);
1971 }
1972
1973 void RenderWidgetHostImpl::AccessibilityHitTest(const gfx::Point& point) {
1974 Send(new AccessibilityMsg_HitTest(GetRoutingID(), point));
1975 }
1976
1977 void RenderWidgetHostImpl::AccessibilityFatalError() {
1978 Send(new AccessibilityMsg_FatalError(GetRoutingID()));
1979 view_->SetBrowserAccessibilityManager(NULL);
1980 }
1981
1982 #if defined(OS_WIN)
1983 void RenderWidgetHostImpl::SetParentNativeViewAccessible(
1984 gfx::NativeViewAccessible accessible_parent) {
1985 if (view_)
1986 view_->SetParentNativeViewAccessible(accessible_parent);
1987 }
1988
1989 gfx::NativeViewAccessible
1990 RenderWidgetHostImpl::GetParentNativeViewAccessible() const {
1991 return delegate_->GetParentNativeViewAccessible();
1992 }
1993 #endif
1994
1995 void RenderWidgetHostImpl::ExecuteEditCommand(const std::string& command, 1888 void RenderWidgetHostImpl::ExecuteEditCommand(const std::string& command,
1996 const std::string& value) { 1889 const std::string& value) {
1997 Send(new InputMsg_ExecuteEditCommand(GetRoutingID(), command, value)); 1890 Send(new InputMsg_ExecuteEditCommand(GetRoutingID(), command, value));
1998 } 1891 }
1999 1892
2000 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( 1893 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect(
2001 const gfx::Rect& rect) { 1894 const gfx::Rect& rect) {
2002 Send(new InputMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect)); 1895 Send(new InputMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect));
2003 } 1896 }
2004 1897
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 ++lc; 2227 ++lc;
2335 } 2228 }
2336 } 2229 }
2337 2230
2338 // Add newly generated components into the latency info 2231 // Add newly generated components into the latency info
2339 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { 2232 for (lc = new_components.begin(); lc != new_components.end(); ++lc) {
2340 latency_info->latency_components[lc->first] = lc->second; 2233 latency_info->latency_components[lc->first] = lc->second;
2341 } 2234 }
2342 } 2235 }
2343 2236
2237 BrowserAccessibilityManager*
2238 RenderWidgetHostImpl::GetRootBrowserAccessibilityManager() {
2239 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL;
2240 }
2241
2242 BrowserAccessibilityManager*
2243 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() {
2244 return delegate_ ?
2245 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL;
2246 }
2247
2248 #if defined(OS_WIN)
2249 gfx::NativeViewAccessible
2250 RenderWidgetHostImpl::GetParentNativeViewAccessible() {
2251 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL;
2252 }
2253 #endif
2254
2344 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { 2255 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() {
2345 if (view_) 2256 if (view_)
2346 return view_->PreferredReadbackFormat(); 2257 return view_->PreferredReadbackFormat();
2347 return kN32_SkColorType; 2258 return kN32_SkColorType;
2348 } 2259 }
2349 2260
2350 } // namespace content 2261 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698