Index: trunk/src/content/browser/accessibility/accessibility_tree_formatter.h |
=================================================================== |
--- trunk/src/content/browser/accessibility/accessibility_tree_formatter.h (revision 194894) |
+++ trunk/src/content/browser/accessibility/accessibility_tree_formatter.h (working copy) |
@@ -10,7 +10,6 @@ |
#include "base/files/file_path.h" |
#include "base/string16.h" |
#include "base/utf_string_conversions.h" |
-#include "base/values.h" |
#include "content/browser/accessibility/browser_accessibility.h" |
#include "content/common/content_export.h" |
@@ -24,33 +23,11 @@ |
// implemented. |
class CONTENT_EXPORT AccessibilityTreeFormatter { |
public: |
- explicit AccessibilityTreeFormatter(BrowserAccessibility* root); |
+ explicit AccessibilityTreeFormatter(BrowserAccessibility* node); |
virtual ~AccessibilityTreeFormatter(); |
static AccessibilityTreeFormatter* Create(RenderViewHost* rvh); |
- // Populates the given DictionaryValue with the accessibility tree. |
- // The dictionary contains a key/value pair for each attribute of the node, |
- // plus a "children" attribute containing a list of all child nodes. |
- // { |
- // "AXName": "node", /* actual attributes will vary by platform */ |
- // "position": { /* some attributes may be dictionaries */ |
- // "x": 0, |
- // "y": 0 |
- // }, |
- // /* ... more attributes of |node| */ |
- // "children": [ { /* list of children created recursively */ |
- // "AXName": "child node 1", |
- // /* ... more attributes */ |
- // "children": [ ] |
- // }, { |
- // "AXName": "child name 2", |
- // /* ... more attributes */ |
- // "children": [ ] |
- // } ] |
- // } |
- scoped_ptr<DictionaryValue> BuildAccessibilityTree(); |
- |
// Dumps a BrowserAccessibility tree into a string. |
void FormatAccessibilityTree(string16* contents); |
@@ -99,45 +76,25 @@ |
static const std::string GetDenyString(); |
protected: |
- void RecursiveFormatAccessibilityTree(const BrowserAccessibility& node, |
+ void RecursiveFormatAccessibilityTree(BrowserAccessibility* node, |
string16* contents, |
int indent); |
- void RecursiveBuildAccessibilityTree(const BrowserAccessibility& node, |
- DictionaryValue* tree_node); |
- void RecursiveFormatAccessibilityTree(const DictionaryValue& tree_node, |
- string16* contents, |
- int depth = 0); |
- |
- // Overridden by each platform to add the required attributes for each node |
- // into the given dict. |
- void AddProperties(const BrowserAccessibility& node, DictionaryValue* dict); |
- |
- string16 FormatCoordinates(const char* name, |
- const char* x_name, |
- const char* y_name, |
- const DictionaryValue& value); |
// Returns a platform specific representation of a BrowserAccessibility. |
// Should be zero or more complete lines, each with |prefix| prepended |
// (to indent each line). |
- string16 ToString(const DictionaryValue& node, const string16& indent); |
+ string16 ToString(BrowserAccessibility* node, char* prefix); |
void Initialize(); |
bool MatchesFilters(const string16& text, bool default_result) const; |
+ void StartLine(); |
+ void Add(bool include_by_default, const string16& attr); |
+ string16 FinishLine(); |
- // Writes the given attribute string out to |line| if it matches the filters. |
- void WriteAttribute(bool include_by_default, |
- const string16& attr, |
- string16* line); |
- void WriteAttribute(bool include_by_default, |
- const std::string& attr, |
- string16* line); |
- |
- BrowserAccessibility* root_; |
- |
- // Filters used when formatting the accessibility tree as text. |
+ BrowserAccessibility* node_; |
std::vector<Filter> filters_; |
+ string16 line_; |
DISALLOW_COPY_AND_ASSIGN(AccessibilityTreeFormatter); |
}; |