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

Side by Side Diff: content/browser/accessibility/browser_accessibility.h

Issue 2759113004: Make BrowserAccessibility implement AXPlatformNodeDelegete. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "content/browser/accessibility/ax_platform_position.h" 18 #include "content/browser/accessibility/ax_platform_position.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "third_party/WebKit/public/web/WebAXEnums.h" 20 #include "third_party/WebKit/public/web/WebAXEnums.h"
21 #include "ui/accessibility/ax_node.h" 21 #include "ui/accessibility/ax_node.h"
22 #include "ui/accessibility/ax_node_data.h" 22 #include "ui/accessibility/ax_node_data.h"
23 #include "ui/accessibility/ax_range.h" 23 #include "ui/accessibility/ax_range.h"
24 #include "ui/accessibility/ax_text_utils.h" 24 #include "ui/accessibility/ax_text_utils.h"
25 #include "ui/accessibility/platform/ax_platform_node_delegate.h"
25 26
26 // Set PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL if this platform has 27 // Set PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL if this platform has
27 // a platform-specific subclass of BrowserAccessibility and 28 // a platform-specific subclass of BrowserAccessibility and
28 // BrowserAccessibilityManager. 29 // BrowserAccessibilityManager.
29 #undef PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL 30 #undef PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL
30 31
31 #if defined(OS_WIN) 32 #if defined(OS_WIN)
32 #define PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL 1 33 #define PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL 1
33 #endif 34 #endif
34 35
(...skipping 22 matching lines...) Expand all
57 // 58 //
58 // A BrowserAccessibility object represents one node in the accessibility 59 // A BrowserAccessibility object represents one node in the accessibility
59 // tree on the browser side. It exactly corresponds to one WebAXObject from 60 // tree on the browser side. It exactly corresponds to one WebAXObject from
60 // Blink. It's owned by a BrowserAccessibilityManager. 61 // Blink. It's owned by a BrowserAccessibilityManager.
61 // 62 //
62 // There are subclasses of BrowserAccessibility for each platform where 63 // There are subclasses of BrowserAccessibility for each platform where
63 // we implement native accessibility APIs. This base class is used occasionally 64 // we implement native accessibility APIs. This base class is used occasionally
64 // for tests. 65 // for tests.
65 // 66 //
66 //////////////////////////////////////////////////////////////////////////////// 67 ////////////////////////////////////////////////////////////////////////////////
67 class CONTENT_EXPORT BrowserAccessibility { 68 class CONTENT_EXPORT BrowserAccessibility : public ui::AXPlatformNodeDelegate {
68 public: 69 public:
69 // Creates a platform specific BrowserAccessibility. Ownership passes to the 70 // Creates a platform specific BrowserAccessibility. Ownership passes to the
70 // caller. 71 // caller.
71 static BrowserAccessibility* Create(); 72 static BrowserAccessibility* Create();
72 73
73 virtual ~BrowserAccessibility(); 74 virtual ~BrowserAccessibility();
74 75
75 static BrowserAccessibility* GetFromUniqueID(int32_t unique_id); 76 static BrowserAccessibility* GetFromUniqueID(int32_t unique_id);
76 77
77 // Called only once, immediately after construction. The constructor doesn't 78 // Called only once, immediately after construction. The constructor doesn't
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 358
358 // Creates a position rooted at this object. 359 // Creates a position rooted at this object.
359 // This is a text position on all platforms except IA2 and ATK, where tree 360 // This is a text position on all platforms except IA2 and ATK, where tree
360 // positions are created for non-text objects representing hypertext offsets. 361 // positions are created for non-text objects representing hypertext offsets.
361 virtual AXPlatformPosition::AXPositionInstance CreatePositionAt( 362 virtual AXPlatformPosition::AXPositionInstance CreatePositionAt(
362 int offset) const; 363 int offset) const;
363 364
364 // Gets the text offsets where new lines start. 365 // Gets the text offsets where new lines start.
365 std::vector<int> GetLineStartOffsets() const; 366 std::vector<int> GetLineStartOffsets() const;
366 367
368 // AXPlatformNodeDelegate.
369 const ui::AXNodeData& GetData() override;
370 gfx::NativeWindow GetTopLevelWidget() override;
371 gfx::NativeViewAccessible GetParent() override;
372 int GetChildCount() override;
373 gfx::NativeViewAccessible ChildAtIndex(int index) override;
374 gfx::Vector2d GetGlobalCoordinateOffset() override;
375 gfx::NativeViewAccessible HitTestSync(int x, int y) override;
376 gfx::NativeViewAccessible GetFocus() override;
377 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override;
378 bool AccessibilityPerformAction(const ui::AXActionData& data) override;
379 void DoDefaultAction() override;
380
367 protected: 381 protected:
368 using AXPlatformPositionInstance = AXPlatformPosition::AXPositionInstance; 382 using AXPlatformPositionInstance = AXPlatformPosition::AXPositionInstance;
369 using AXPlatformRange = ui::AXRange<AXPlatformPositionInstance::element_type>; 383 using AXPlatformRange = ui::AXRange<AXPlatformPositionInstance::element_type>;
370 384
371 BrowserAccessibility(); 385 BrowserAccessibility();
372 386
373 // The manager of this tree of accessibility objects. 387 // The manager of this tree of accessibility objects.
374 BrowserAccessibilityManager* manager_; 388 BrowserAccessibilityManager* manager_;
375 389
376 // The underlying node. 390 // The underlying node.
(...skipping 14 matching lines...) Expand all
391 // bounds, but "virtual" elements in the accessibility tree that don't 405 // bounds, but "virtual" elements in the accessibility tree that don't
392 // correspond to a layed-out element sometimes don't have bounds. 406 // correspond to a layed-out element sometimes don't have bounds.
393 void FixEmptyBounds(gfx::RectF* bounds) const; 407 void FixEmptyBounds(gfx::RectF* bounds) const;
394 408
395 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 409 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
396 }; 410 };
397 411
398 } // namespace content 412 } // namespace content
399 413
400 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 414 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698