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

Unified Diff: content/browser/accessibility/browser_accessibility.h

Issue 224803005: Refactor BrowserAccessibility to prepare for AXNode (re-land) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix gtk Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/accessibility/browser_accessibility.h
diff --git a/content/browser/accessibility/browser_accessibility.h b/content/browser/accessibility/browser_accessibility.h
index d1df6b96a9448c4a1b835bc313ba8753aec83fbb..d72a2adbebb1a3bc800bd94fcf057003aa98cef8 100644
--- a/content/browser/accessibility/browser_accessibility.h
+++ b/content/browser/accessibility/browser_accessibility.h
@@ -66,7 +66,7 @@ class CONTENT_EXPORT BrowserAccessibility {
void InitializeTreeStructure(
BrowserAccessibilityManager* manager,
BrowserAccessibility* parent,
- int32 renderer_id,
+ int32 id,
int32 index_in_parent);
// Initialize this object's data.
@@ -83,12 +83,6 @@ class CONTENT_EXPORT BrowserAccessibility {
// Return true if this object is equal to or a descendant of |ancestor|.
bool IsDescendantOf(BrowserAccessibility* ancestor);
- // Returns the parent of this object, or NULL if it's the root.
- BrowserAccessibility* parent() const { return parent_; }
-
- // Returns the number of children of this object.
- uint32 child_count() const { return children_.size(); }
-
// Returns true if this is a leaf node on this platform, meaning any
// children should not be exposed to this platform's native accessibility
// layer. Each platform subclass should implement this itself.
@@ -154,26 +148,38 @@ class CONTENT_EXPORT BrowserAccessibility {
// Accessors
//
- const std::vector<BrowserAccessibility*>& children() const {
- return children_;
- }
- const std::vector<std::pair<std::string, std::string> >&
- html_attributes() const {
- return html_attributes_;
- }
- int32 index_in_parent() const { return index_in_parent_; }
- gfx::Rect location() const { return location_; }
BrowserAccessibilityManager* manager() const { return manager_; }
+ bool instance_active() const { return instance_active_; }
const std::string& name() const { return name_; }
const std::string& value() const { return value_; }
- int32 renderer_id() const { return renderer_id_; }
- int32 role() const { return role_; }
- int32 state() const { return state_; }
- bool instance_active() const { return instance_active_; }
-
void set_name(const std::string& name) { name_ = name; }
void set_value(const std::string& value) { value_ = value; }
+ std::vector<BrowserAccessibility*>& deprecated_children() {
+ return deprecated_children_;
+ }
+
+ // These access the internal accessibility tree, which doesn't necessarily
+ // reflect the accessibility tree that should be exposed on each platform.
+ // Use PlatformChildCount and PlatformGetChild to implement platform
+ // accessibility APIs.
+ uint32 InternalChildCount() const { return deprecated_children_.size(); }
+ BrowserAccessibility* InternalGetChild(uint32 child_index) const {
+ return deprecated_children_[child_index];
+ }
+
+ BrowserAccessibility* GetParent() const { return deprecated_parent_; }
+ int32 GetIndexInParent() const { return deprecated_index_in_parent_; }
+
+ int32 GetId() const { return data_.id; }
+ gfx::Rect GetLocation() const { return data_.location; }
+ int32 GetRole() const { return data_.role; }
+ int32 GetState() const { return data_.state; }
+ const std::vector<std::pair<std::string, std::string> >& GetHtmlAttributes()
+ const {
+ return data_.html_attributes;
+ }
+
#if defined(OS_MACOSX) && __OBJC__
BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa();
#elif defined(OS_WIN)
@@ -273,7 +279,7 @@ class CONTENT_EXPORT BrowserAccessibility {
BrowserAccessibilityManager* manager_;
// The parent of this object, may be NULL if we're the root object.
- BrowserAccessibility* parent_;
+ BrowserAccessibility* deprecated_parent_;
private:
// Return the sum of the lengths of all static text descendants,
@@ -281,32 +287,15 @@ class CONTENT_EXPORT BrowserAccessibility {
int GetStaticTextLenRecursive() const;
// The index of this within its parent object.
- int32 index_in_parent_;
-
- // The ID of this object in the renderer process.
- int32 renderer_id_;
+ int32 deprecated_index_in_parent_;
// The children of this object.
- std::vector<BrowserAccessibility*> children_;
+ std::vector<BrowserAccessibility*> deprecated_children_;
// Accessibility metadata from the renderer
std::string name_;
std::string value_;
- std::vector<std::pair<
- ui::AXBoolAttribute, bool> > bool_attributes_;
- std::vector<std::pair<
- ui::AXFloatAttribute, float> > float_attributes_;
- std::vector<std::pair<
- ui::AXIntAttribute, int> > int_attributes_;
- std::vector<std::pair<
- ui::AXStringAttribute, std::string> > string_attributes_;
- std::vector<std::pair<
- ui::AXIntListAttribute, std::vector<int32> > >
- intlist_attributes_;
- std::vector<std::pair<std::string, std::string> > html_attributes_;
- int32 role_;
- int32 state_;
- gfx::Rect location_;
+ ui::AXNodeData data_;
// BrowserAccessibility objects are reference-counted on some platforms.
// When we're done with this object and it's removed from our accessibility

Powered by Google App Engine
This is Rietveld 408576698