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

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

Issue 10382051: Add initial GTK web accessibility framework (third attempt). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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_VIEW_GTK_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_
7 #pragma once 7 #pragma once
8 8
9 #include <gdk/gdk.h> 9 #include <gdk/gdk.h>
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "content/browser/accessibility/browser_accessibility_manager.h"
16 #include "content/browser/renderer_host/render_widget_host_view_base.h" 17 #include "content/browser/renderer_host/render_widget_host_view_base.h"
17 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
18 #include "ui/base/animation/animation_delegate.h" 19 #include "ui/base/animation/animation_delegate.h"
19 #include "ui/base/animation/slide_animation.h" 20 #include "ui/base/animation/slide_animation.h"
20 #include "ui/base/gtk/gtk_signal.h" 21 #include "ui/base/gtk/gtk_signal.h"
21 #include "ui/base/gtk/gtk_signal_registrar.h" 22 #include "ui/base/gtk/gtk_signal_registrar.h"
22 #include "ui/base/gtk/owned_widget_gtk.h" 23 #include "ui/base/gtk/owned_widget_gtk.h"
23 #include "ui/gfx/native_widget_types.h" 24 #include "ui/gfx/native_widget_types.h"
24 #include "ui/gfx/point.h" 25 #include "ui/gfx/point.h"
25 #include "ui/gfx/rect.h" 26 #include "ui/gfx/rect.h"
26 #include "webkit/glue/webcursor.h" 27 #include "webkit/glue/webcursor.h"
27 #include "webkit/plugins/npapi/gtk_plugin_container_manager.h" 28 #include "webkit/plugins/npapi/gtk_plugin_container_manager.h"
28 29
29 class GtkIMContextWrapper; 30 class GtkIMContextWrapper;
30 struct NativeWebKeyboardEvent; 31 struct NativeWebKeyboardEvent;
31 32
32 namespace content { 33 namespace content {
33 class RenderWidgetHost; 34 class RenderWidgetHost;
34 class RenderWidgetHostImpl; 35 class RenderWidgetHostImpl;
35 } 36 }
36 37
37 class GtkKeyBindingsHandler; 38 class GtkKeyBindingsHandler;
38 39
39 typedef struct _GtkClipboard GtkClipboard; 40 typedef struct _GtkClipboard GtkClipboard;
40 typedef struct _GtkSelectionData GtkSelectionData; 41 typedef struct _GtkSelectionData GtkSelectionData;
41 42
42 // ----------------------------------------------------------------------------- 43 // -----------------------------------------------------------------------------
43 // See comments in render_widget_host_view.h about this class and its members. 44 // See comments in render_widget_host_view.h about this class and its members.
44 // ----------------------------------------------------------------------------- 45 // -----------------------------------------------------------------------------
45 class RenderWidgetHostViewGtk : public content::RenderWidgetHostViewBase { 46 class CONTENT_EXPORT RenderWidgetHostViewGtk
47 : public content::RenderWidgetHostViewBase,
48 public BrowserAccessibilityDelegate {
46 public: 49 public:
47 virtual ~RenderWidgetHostViewGtk(); 50 virtual ~RenderWidgetHostViewGtk();
48 51
49 // RenderWidgetHostView implementation. 52 // RenderWidgetHostView implementation.
50 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; 53 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE;
51 virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; 54 virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
52 virtual void SetSize(const gfx::Size& size) OVERRIDE; 55 virtual void SetSize(const gfx::Size& size) OVERRIDE;
53 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; 56 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
54 virtual gfx::NativeView GetNativeView() const OVERRIDE; 57 virtual gfx::NativeView GetNativeView() const OVERRIDE;
55 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; 58 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 bool processed) OVERRIDE; 118 bool processed) OVERRIDE;
116 virtual void SetHasHorizontalScrollbar( 119 virtual void SetHasHorizontalScrollbar(
117 bool has_horizontal_scrollbar) OVERRIDE; 120 bool has_horizontal_scrollbar) OVERRIDE;
118 virtual void SetScrollOffsetPinning( 121 virtual void SetScrollOffsetPinning(
119 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; 122 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
120 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; 123 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE;
121 virtual gfx::Rect GetRootWindowBounds() OVERRIDE; 124 virtual gfx::Rect GetRootWindowBounds() OVERRIDE;
122 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; 125 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
123 virtual bool LockMouse() OVERRIDE; 126 virtual bool LockMouse() OVERRIDE;
124 virtual void UnlockMouse() OVERRIDE; 127 virtual void UnlockMouse() OVERRIDE;
128 virtual void OnAccessibilityNotifications(
129 const std::vector<AccessibilityHostMsg_NotificationParams>& params)
130 OVERRIDE;
125 131
126 // If the widget is aligned with an edge of the monitor its on and the user 132 // If the widget is aligned with an edge of the monitor its on and the user
127 // attempts to drag past that edge we track the number of times it has 133 // attempts to drag past that edge we track the number of times it has
128 // occurred, so that we can force the widget to scroll when it otherwise 134 // occurred, so that we can force the widget to scroll when it otherwise
129 // would be unable to. 135 // would be unable to.
130 void ModifyEventForEdgeDragging(GtkWidget* widget, GdkEventMotion* event); 136 void ModifyEventForEdgeDragging(GtkWidget* widget, GdkEventMotion* event);
131 137
132 // Mouse events always provide a movementX/Y which needs to be computed. 138 // Mouse events always provide a movementX/Y which needs to be computed.
133 // Also, mouse lock requires knowledge of last unlocked cursor coordinates. 139 // Also, mouse lock requires knowledge of last unlocked cursor coordinates.
134 // State is stored on the host view to do this, and the mouse event modified. 140 // State is stored on the host view to do this, and the mouse event modified.
135 void ModifyEventMovementAndCoords(WebKit::WebMouseEvent* event); 141 void ModifyEventMovementAndCoords(WebKit::WebMouseEvent* event);
136 142
137 void Paint(const gfx::Rect&); 143 void Paint(const gfx::Rect&);
138 144
139 // Called by GtkIMContextWrapper to forward a keyboard event to renderer. 145 // Called by GtkIMContextWrapper to forward a keyboard event to renderer.
140 // On Linux (not ChromeOS): 146 // On Linux (not ChromeOS):
141 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method 147 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
142 // calls GtkKeyBindingsHandler::Match() against the event and send matched 148 // calls GtkKeyBindingsHandler::Match() against the event and send matched
143 // edit commands to renderer by calling 149 // edit commands to renderer by calling
144 // RenderWidgetHost::ForwardEditCommandsForNextKeyEvent(). 150 // RenderWidgetHost::ForwardEditCommandsForNextKeyEvent().
145 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event); 151 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event);
146 152
147 bool RetrieveSurrounding(std::string* text, size_t* cursor_index); 153 bool RetrieveSurrounding(std::string* text, size_t* cursor_index);
148 154
155 // BrowserAccessibilityDelegate implementation.
156 virtual void SetAccessibilityFocus(int acc_obj_id) OVERRIDE;
157 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE;
158 virtual void AccessibilityScrollToMakeVisible(
159 int acc_obj_id, gfx::Rect subfocus) OVERRIDE;
160 virtual void AccessibilityScrollToPoint(
161 int acc_obj_id, gfx::Point point) OVERRIDE;
162 virtual void AccessibilitySetTextSelection(
163 int acc_obj_id, int start_offset, int end_offset) OVERRIDE;
164
165 // Get the root of the AtkObject* tree for accessibility.
166 AtkObject* GetAccessible();
167
149 protected: 168 protected:
150 friend class content::RenderWidgetHostView; 169 friend class content::RenderWidgetHostView;
151 170
152 // Should construct only via RenderWidgetHostView::CreateViewForWidget. 171 // Should construct only via RenderWidgetHostView::CreateViewForWidget.
153 explicit RenderWidgetHostViewGtk(content::RenderWidgetHost* widget); 172 explicit RenderWidgetHostViewGtk(content::RenderWidgetHost* widget);
154 173
155 private: 174 private:
156 friend class RenderWidgetHostViewGtkWidget; 175 friend class RenderWidgetHostViewGtkWidget;
157 176
158 CHROMEGTK_CALLBACK_1(RenderWidgetHostViewGtk, 177 CHROMEGTK_CALLBACK_1(RenderWidgetHostViewGtk,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // monitor (if the widget is aligned with that edge). Negative values 299 // monitor (if the widget is aligned with that edge). Negative values
281 // indicate the top edge, positive the bottom. 300 // indicate the top edge, positive the bottom.
282 int dragged_at_vertical_edge_; 301 int dragged_at_vertical_edge_;
283 302
284 gfx::PluginWindowHandle compositing_surface_; 303 gfx::PluginWindowHandle compositing_surface_;
285 304
286 // The event for the last mouse down we handled. We need this for context 305 // The event for the last mouse down we handled. We need this for context
287 // menus and drags. 306 // menus and drags.
288 GdkEventButton* last_mouse_down_; 307 GdkEventButton* last_mouse_down_;
289 308
309 // Instance of accessibility information for the root of the AtkObject
310 // tree representation of the WebKit render tree.
311 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_;
312
290 ui::GtkSignalRegistrar signals_; 313 ui::GtkSignalRegistrar signals_;
291 }; 314 };
292 315
293 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ 316 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698