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

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

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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
11 #include <queue> 11 #include <queue>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/observer_list.h" 20 #include "base/observer_list.h"
21 #include "base/process/kill.h" 21 #include "base/process/kill.h"
22 #include "base/strings/string16.h" 22 #include "base/strings/string16.h"
23 #include "base/time/time.h" 23 #include "base/time/time.h"
24 #include "base/timer/timer.h" 24 #include "base/timer/timer.h"
25 #include "build/build_config.h" 25 #include "build/build_config.h"
26 #include "cc/resources/shared_bitmap.h" 26 #include "cc/resources/shared_bitmap.h"
27 #include "content/browser/accessibility/browser_accessibility_manager.h"
28 #include "content/browser/renderer_host/event_with_latency_info.h" 27 #include "content/browser/renderer_host/event_with_latency_info.h"
29 #include "content/browser/renderer_host/input/input_ack_handler.h" 28 #include "content/browser/renderer_host/input/input_ack_handler.h"
30 #include "content/browser/renderer_host/input/input_router_client.h" 29 #include "content/browser/renderer_host/input/input_router_client.h"
31 #include "content/browser/renderer_host/input/synthetic_gesture.h" 30 #include "content/browser/renderer_host/input/synthetic_gesture.h"
32 #include "content/browser/renderer_host/input/touch_emulator_client.h" 31 #include "content/browser/renderer_host/input/touch_emulator_client.h"
33 #include "content/common/input/input_event_ack_state.h" 32 #include "content/common/input/input_event_ack_state.h"
34 #include "content/common/input/synthetic_gesture_packet.h" 33 #include "content/common/input/synthetic_gesture_packet.h"
35 #include "content/common/view_message_enums.h" 34 #include "content/common/view_message_enums.h"
36 #include "content/public/browser/render_widget_host.h" 35 #include "content/public/browser/render_widget_host.h"
37 #include "content/public/common/page_zoom.h" 36 #include "content/public/common/page_zoom.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 class WebCursor; 89 class WebCursor;
91 struct EditCommand; 90 struct EditCommand;
92 91
93 // This implements the RenderWidgetHost interface that is exposed to 92 // This implements the RenderWidgetHost interface that is exposed to
94 // embedders of content, and adds things only visible to content. 93 // embedders of content, and adds things only visible to content.
95 class CONTENT_EXPORT RenderWidgetHostImpl 94 class CONTENT_EXPORT RenderWidgetHostImpl
96 : virtual public RenderWidgetHost, 95 : virtual public RenderWidgetHost,
97 public InputRouterClient, 96 public InputRouterClient,
98 public InputAckHandler, 97 public InputAckHandler,
99 public TouchEmulatorClient, 98 public TouchEmulatorClient,
100 public IPC::Listener, 99 public IPC::Listener {
101 public BrowserAccessibilityDelegate {
102 public: 100 public:
103 // routing_id can be MSG_ROUTING_NONE, in which case the next available 101 // routing_id can be MSG_ROUTING_NONE, in which case the next available
104 // routing id is taken from the RenderProcessHost. 102 // routing id is taken from the RenderProcessHost.
105 // If this object outlives |delegate|, DetachDelegate() must be called when 103 // If this object outlives |delegate|, DetachDelegate() must be called when
106 // |delegate| goes away. 104 // |delegate| goes away.
107 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, 105 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
108 RenderProcessHost* process, 106 RenderProcessHost* process,
109 int routing_id, 107 int routing_id,
110 bool hidden); 108 bool hidden);
111 virtual ~RenderWidgetHostImpl(); 109 virtual ~RenderWidgetHostImpl();
(...skipping 24 matching lines...) Expand all
136 virtual void CopyFromBackingStore( 134 virtual void CopyFromBackingStore(
137 const gfx::Rect& src_rect, 135 const gfx::Rect& src_rect,
138 const gfx::Size& accelerated_dst_size, 136 const gfx::Size& accelerated_dst_size,
139 const base::Callback<void(bool, const SkBitmap&)>& callback, 137 const base::Callback<void(bool, const SkBitmap&)>& callback,
140 const SkBitmap::Config& bitmap_config) OVERRIDE; 138 const SkBitmap::Config& bitmap_config) OVERRIDE;
141 virtual bool CanCopyFromBackingStore() OVERRIDE; 139 virtual bool CanCopyFromBackingStore() OVERRIDE;
142 #if defined(OS_ANDROID) 140 #if defined(OS_ANDROID)
143 virtual void LockBackingStore() OVERRIDE; 141 virtual void LockBackingStore() OVERRIDE;
144 virtual void UnlockBackingStore() OVERRIDE; 142 virtual void UnlockBackingStore() OVERRIDE;
145 #endif 143 #endif
146 virtual void EnableFullAccessibilityMode() OVERRIDE;
147 virtual bool IsFullAccessibilityModeForTesting() OVERRIDE;
148 virtual void EnableTreeOnlyAccessibilityMode() OVERRIDE;
149 virtual bool IsTreeOnlyAccessibilityModeForTesting() OVERRIDE;
150 virtual void ForwardMouseEvent( 144 virtual void ForwardMouseEvent(
151 const blink::WebMouseEvent& mouse_event) OVERRIDE; 145 const blink::WebMouseEvent& mouse_event) OVERRIDE;
152 virtual void ForwardWheelEvent( 146 virtual void ForwardWheelEvent(
153 const blink::WebMouseWheelEvent& wheel_event) OVERRIDE; 147 const blink::WebMouseWheelEvent& wheel_event) OVERRIDE;
154 virtual void ForwardKeyboardEvent( 148 virtual void ForwardKeyboardEvent(
155 const NativeWebKeyboardEvent& key_event) OVERRIDE; 149 const NativeWebKeyboardEvent& key_event) OVERRIDE;
156 virtual const gfx::Vector2d& GetLastScrollOffset() const OVERRIDE; 150 virtual const gfx::Vector2d& GetLastScrollOffset() const OVERRIDE;
157 virtual RenderProcessHost* GetProcess() const OVERRIDE; 151 virtual RenderProcessHost* GetProcess() const OVERRIDE;
158 virtual int GetRoutingID() const OVERRIDE; 152 virtual int GetRoutingID() const OVERRIDE;
159 virtual RenderWidgetHostView* GetView() const OVERRIDE; 153 virtual RenderWidgetHostView* GetView() const OVERRIDE;
160 virtual bool IsLoading() const OVERRIDE; 154 virtual bool IsLoading() const OVERRIDE;
161 virtual bool IsRenderView() const OVERRIDE; 155 virtual bool IsRenderView() const OVERRIDE;
162 virtual void ResizeRectChanged(const gfx::Rect& new_rect) OVERRIDE; 156 virtual void ResizeRectChanged(const gfx::Rect& new_rect) OVERRIDE;
163 virtual void RestartHangMonitorTimeout() OVERRIDE; 157 virtual void RestartHangMonitorTimeout() OVERRIDE;
164 virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE; 158 virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE;
165 virtual void Stop() OVERRIDE; 159 virtual void Stop() OVERRIDE;
166 virtual void WasResized() OVERRIDE; 160 virtual void WasResized() OVERRIDE;
167 virtual void AddKeyPressEventCallback( 161 virtual void AddKeyPressEventCallback(
168 const KeyPressEventCallback& callback) OVERRIDE; 162 const KeyPressEventCallback& callback) OVERRIDE;
169 virtual void RemoveKeyPressEventCallback( 163 virtual void RemoveKeyPressEventCallback(
170 const KeyPressEventCallback& callback) OVERRIDE; 164 const KeyPressEventCallback& callback) OVERRIDE;
171 virtual void AddMouseEventCallback( 165 virtual void AddMouseEventCallback(
172 const MouseEventCallback& callback) OVERRIDE; 166 const MouseEventCallback& callback) OVERRIDE;
173 virtual void RemoveMouseEventCallback( 167 virtual void RemoveMouseEventCallback(
174 const MouseEventCallback& callback) OVERRIDE; 168 const MouseEventCallback& callback) OVERRIDE;
175 virtual void GetWebScreenInfo(blink::WebScreenInfo* result) OVERRIDE; 169 virtual void GetWebScreenInfo(blink::WebScreenInfo* result) OVERRIDE;
176 170
177 virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE; 171 virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE;
178 172
179 // BrowserAccessibilityDelegate
180 virtual void AccessibilitySetFocus(int acc_obj_id) OVERRIDE;
181 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE;
182 virtual void AccessibilityShowMenu(int acc_obj_id) OVERRIDE;
183 virtual void AccessibilityScrollToMakeVisible(
184 int acc_obj_id, gfx::Rect subfocus) OVERRIDE;
185 virtual void AccessibilityScrollToPoint(
186 int acc_obj_id, gfx::Point point) OVERRIDE;
187 virtual void AccessibilitySetTextSelection(
188 int acc_obj_id, int start_offset, int end_offset) OVERRIDE;
189 virtual bool AccessibilityViewHasFocus() const OVERRIDE;
190 virtual gfx::Rect AccessibilityGetViewBounds() const OVERRIDE;
191 virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds)
192 const OVERRIDE;
193 virtual void AccessibilityFatalError() OVERRIDE;
194
195 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const; 173 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const;
196 174
197 // Notification that the screen info has changed. 175 // Notification that the screen info has changed.
198 void NotifyScreenInfoChanged(); 176 void NotifyScreenInfoChanged();
199 177
200 // Invalidates the cached screen info so that next resize request 178 // Invalidates the cached screen info so that next resize request
201 // will carry the up to date screen info. Unlike 179 // will carry the up to date screen info. Unlike
202 // |NotifyScreenInfoChanged|, this doesn't send a message to the renderer. 180 // |NotifyScreenInfoChanged|, this doesn't send a message to the renderer.
203 void InvalidateScreenInfo(); 181 void InvalidateScreenInfo();
204 182
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 void StartUserGesture(); 363 void StartUserGesture();
386 364
387 // Set the RenderView background. 365 // Set the RenderView background.
388 void SetBackground(const SkBitmap& background); 366 void SetBackground(const SkBitmap& background);
389 367
390 // Notifies the renderer that the next key event is bound to one or more 368 // Notifies the renderer that the next key event is bound to one or more
391 // pre-defined edit commands 369 // pre-defined edit commands
392 void SetEditCommandsForNextKeyEvent( 370 void SetEditCommandsForNextKeyEvent(
393 const std::vector<EditCommand>& commands); 371 const std::vector<EditCommand>& commands);
394 372
395 // Gets the accessibility mode.
396 AccessibilityMode accessibility_mode() const {
397 return accessibility_mode_;
398 }
399
400 // Adds the given accessibility mode to the current accessibility mode bitmap.
401 void AddAccessibilityMode(AccessibilityMode mode);
402
403 // Removes the given accessibility mode from the current accessibility mode
404 // bitmap, managing the bits that are shared with other modes such that a
405 // bit will only be turned off when all modes that depend on it have been
406 // removed.
407 void RemoveAccessibilityMode(AccessibilityMode mode);
408
409 // Resets the accessibility mode to the default setting in
410 // BrowserStateAccessibilityImpl.
411 void ResetAccessibilityMode();
412
413 #if defined(OS_WIN)
414 void SetParentNativeViewAccessible(
415 gfx::NativeViewAccessible accessible_parent);
416 gfx::NativeViewAccessible GetParentNativeViewAccessible() const;
417 #endif
418
419 // Executes the edit command on the RenderView. 373 // Executes the edit command on the RenderView.
420 void ExecuteEditCommand(const std::string& command, 374 void ExecuteEditCommand(const std::string& command,
421 const std::string& value); 375 const std::string& value);
422 376
423 // Tells the renderer to scroll the currently focused node into rect only if 377 // Tells the renderer to scroll the currently focused node into rect only if
424 // the currently focused node is a Text node (textfield, text area or content 378 // the currently focused node is a Text node (textfield, text area or content
425 // editable divs). 379 // editable divs).
426 void ScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect); 380 void ScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect);
427 381
428 // Requests the renderer to move the caret selection towards the point. 382 // Requests the renderer to move the caret selection towards the point.
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 virtual void OnUnexpectedEventAck(UnexpectedEventAckType type) OVERRIDE; 658 virtual void OnUnexpectedEventAck(UnexpectedEventAckType type) OVERRIDE;
705 659
706 void OnSyntheticGestureCompleted(SyntheticGesture::Result result); 660 void OnSyntheticGestureCompleted(SyntheticGesture::Result result);
707 661
708 // Called when there is a new auto resize (using a post to avoid a stack 662 // Called when there is a new auto resize (using a post to avoid a stack
709 // which may get in recursive loops). 663 // which may get in recursive loops).
710 void DelayedAutoResized(); 664 void DelayedAutoResized();
711 665
712 void WindowSnapshotReachedScreen(int snapshot_id); 666 void WindowSnapshotReachedScreen(int snapshot_id);
713 667
714 // Send a message to the renderer process to change the accessibility mode.
715 void SetAccessibilityMode(AccessibilityMode AccessibilityMode);
716
717 // Our delegate, which wants to know mainly about keyboard events. 668 // Our delegate, which wants to know mainly about keyboard events.
718 // It will remain non-NULL until DetachDelegate() is called. 669 // It will remain non-NULL until DetachDelegate() is called.
719 RenderWidgetHostDelegate* delegate_; 670 RenderWidgetHostDelegate* delegate_;
720 671
721 // Created during construction but initialized during Init*(). Therefore, it 672 // Created during construction but initialized during Init*(). Therefore, it
722 // is guaranteed never to be NULL, but its channel may be NULL if the 673 // is guaranteed never to be NULL, but its channel may be NULL if the
723 // renderer crashed, so you must always check that. 674 // renderer crashed, so you must always check that.
724 RenderProcessHost* process_; 675 RenderProcessHost* process_;
725 676
726 // The ID of the corresponding object in the Renderer Instance. 677 // The ID of the corresponding object in the Renderer Instance.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 gfx::Size new_auto_size_; 732 gfx::Size new_auto_size_;
782 733
783 // True if the render widget host should track the render widget's size as 734 // True if the render widget host should track the render widget's size as
784 // opposed to visa versa. 735 // opposed to visa versa.
785 bool should_auto_resize_; 736 bool should_auto_resize_;
786 737
787 bool waiting_for_screen_rects_ack_; 738 bool waiting_for_screen_rects_ack_;
788 gfx::Rect last_view_screen_rect_; 739 gfx::Rect last_view_screen_rect_;
789 gfx::Rect last_window_screen_rect_; 740 gfx::Rect last_window_screen_rect_;
790 741
791 AccessibilityMode accessibility_mode_;
792
793 // Keyboard event listeners. 742 // Keyboard event listeners.
794 std::vector<KeyPressEventCallback> key_press_event_callbacks_; 743 std::vector<KeyPressEventCallback> key_press_event_callbacks_;
795 744
796 // Mouse event callbacks. 745 // Mouse event callbacks.
797 std::vector<MouseEventCallback> mouse_event_callbacks_; 746 std::vector<MouseEventCallback> mouse_event_callbacks_;
798 747
799 // If true, then we should repaint when restoring even if we have a 748 // If true, then we should repaint when restoring even if we have a
800 // backingstore. This flag is set to true if we receive a paint message 749 // backingstore. This flag is set to true if we receive a paint message
801 // while is_hidden_ to true. Even though we tell the render widget to hide 750 // while is_hidden_ to true. Even though we tell the render widget to hide
802 // itself, a paint message could already be in flight at that point. 751 // itself, a paint message could already be in flight at that point.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 #endif 834 #endif
886 835
887 int64 last_input_number_; 836 int64 last_input_number_;
888 837
889 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); 838 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl);
890 }; 839 };
891 840
892 } // namespace content 841 } // namespace content
893 842
894 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 843 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698