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

Unified Diff: content/common/ax_tree_impl.h

Issue 67283004: First step to move common accessibility code out of content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved out of public api Created 7 years, 1 month 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/common/ax_tree_impl.h
diff --git a/content/common/ax_tree_impl.h b/content/common/ax_tree_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..8024ed6108766611bc18e646ec5a92221a426c0d
--- /dev/null
+++ b/content/common/ax_tree_impl.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_COMMON_AX_TREE_IMPL_H_
+#define CONTENT_COMMON_AX_TREE_IMPL_H_
+
+#include "base/containers/hash_tables.h"
+
+#include "content/common/ax_tree_source.h"
+#include "content/common/content_export.h"
+#include "content/public/common/ax_tree.h"
+#include "content/public/common/ax_tree_update.h"
+
+namespace content {
+
+class AXNodeImpl;
+
+// AXTree is a live, managed tree of AXNode objects that can receive
David Tseng 2013/11/11 19:27:18 AXTreeImpl.
dmazzoni 2013/11/12 00:03:04 Done.
+// updates from another AXTreeSource via AXTreeUpdates, and it can be
+// used as a source for sending updates to another client tree.
+// It's designed to be subclassed to implement support for native
+// accessibility APIs on a specific platform.
+class CONTENT_EXPORT AXTreeImpl
+ : public AXTreeSource<AXNode>,
+ public AXTree {
+ public:
+ AXTreeImpl();
David Tseng 2013/11/11 19:27:18 Again, I'm not sure why we need this?
dmazzoni 2013/11/12 00:03:04 The content API can only contain interfaces.
+ explicit AXTreeImpl(const AXTreeUpdate& initial_state);
+ virtual ~AXTreeImpl();
+
+ // AXTreeSource and AXTree.
David Tseng 2013/11/11 19:27:18 nit: ... implementation (or just make separate sec
dmazzoni 2013/11/12 00:03:04 Done.
+ virtual AXNode* GetRoot() const OVERRIDE;
+ virtual int32 GetRootId() const OVERRIDE;
+ virtual AXNode* GetFromId(int32 id) const OVERRIDE;
David Tseng 2013/11/11 19:27:18 Do the various platforms need to implement these i
dmazzoni 2013/11/12 00:03:04 This is the base class. Think of AXTree as just th
+ virtual int32 GetId(const AXNode* node) const OVERRIDE;
+ virtual int GetChildCount(const AXNode* node) const OVERRIDE;
+ virtual AXNode* GetChildAtIndex(const AXNode* node, int index)
+ const OVERRIDE;
+ virtual int32 GetParentId(const AXNode* node) const OVERRIDE;
+ virtual void Serialize(const AXNode* node, AXNodeData* out_data) const
+ OVERRIDE;
+
+ // AXTree.
David Tseng 2013/11/11 19:27:18 nit: ... implementation.
dmazzoni 2013/11/12 00:03:04 Done.
+ // Apply an update from another AXTreeSource.
+ virtual bool Unserialize(const AXTreeUpdate& update) OVERRIDE;
+
+ // Called when a node is removed from the tree.
+ void NodeWasDestroyed(AXNodeImpl* node);
David Tseng 2013/11/11 19:27:18 OnNodeDestroyed
dmazzoni 2013/11/12 00:03:04 Done.
+
+ protected:
+ // Subclasses can override this to use a subclass of AXNodeImpl.
+ virtual AXNodeImpl* CreateNode();
+
+ // This is called from within Unserialize(), it returns true on success.
+ // Subclasses can override this to do additional processing.
+ virtual bool UpdateNode(const AXNodeData& src);
+
+ // Subclasses can override this to do special behavior when the root changes.
+ virtual void OnRootChanged();
+
+ private:
+ AXNodeImpl* CreateAndInitializeNode(
+ AXNodeImpl* parent, int32 id, int32 index_in_parent);
+
+ AXNodeImpl* root_;
+ base::hash_map<int32, AXNodeImpl*> id_map_;
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_AX_TREE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698