Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_COMMON_AX_TREE_IMPL_H_ | |
| 6 #define CONTENT_COMMON_AX_TREE_IMPL_H_ | |
| 7 | |
| 8 #include "base/containers/hash_tables.h" | |
| 9 | |
| 10 #include "content/common/ax_tree_source.h" | |
| 11 #include "content/common/content_export.h" | |
| 12 #include "content/public/common/ax_tree.h" | |
| 13 #include "content/public/common/ax_tree_update.h" | |
| 14 | |
| 15 namespace content { | |
| 16 | |
| 17 class AXNodeImpl; | |
| 18 | |
| 19 // 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.
| |
| 20 // updates from another AXTreeSource via AXTreeUpdates, and it can be | |
| 21 // used as a source for sending updates to another client tree. | |
| 22 // It's designed to be subclassed to implement support for native | |
| 23 // accessibility APIs on a specific platform. | |
| 24 class CONTENT_EXPORT AXTreeImpl | |
| 25 : public AXTreeSource<AXNode>, | |
| 26 public AXTree { | |
| 27 public: | |
| 28 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.
| |
| 29 explicit AXTreeImpl(const AXTreeUpdate& initial_state); | |
| 30 virtual ~AXTreeImpl(); | |
| 31 | |
| 32 // 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.
| |
| 33 virtual AXNode* GetRoot() const OVERRIDE; | |
| 34 virtual int32 GetRootId() const OVERRIDE; | |
| 35 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
| |
| 36 virtual int32 GetId(const AXNode* node) const OVERRIDE; | |
| 37 virtual int GetChildCount(const AXNode* node) const OVERRIDE; | |
| 38 virtual AXNode* GetChildAtIndex(const AXNode* node, int index) | |
| 39 const OVERRIDE; | |
| 40 virtual int32 GetParentId(const AXNode* node) const OVERRIDE; | |
| 41 virtual void Serialize(const AXNode* node, AXNodeData* out_data) const | |
| 42 OVERRIDE; | |
| 43 | |
| 44 // AXTree. | |
|
David Tseng
2013/11/11 19:27:18
nit: ... implementation.
dmazzoni
2013/11/12 00:03:04
Done.
| |
| 45 // Apply an update from another AXTreeSource. | |
| 46 virtual bool Unserialize(const AXTreeUpdate& update) OVERRIDE; | |
| 47 | |
| 48 // Called when a node is removed from the tree. | |
| 49 void NodeWasDestroyed(AXNodeImpl* node); | |
|
David Tseng
2013/11/11 19:27:18
OnNodeDestroyed
dmazzoni
2013/11/12 00:03:04
Done.
| |
| 50 | |
| 51 protected: | |
| 52 // Subclasses can override this to use a subclass of AXNodeImpl. | |
| 53 virtual AXNodeImpl* CreateNode(); | |
| 54 | |
| 55 // This is called from within Unserialize(), it returns true on success. | |
| 56 // Subclasses can override this to do additional processing. | |
| 57 virtual bool UpdateNode(const AXNodeData& src); | |
| 58 | |
| 59 // Subclasses can override this to do special behavior when the root changes. | |
| 60 virtual void OnRootChanged(); | |
| 61 | |
| 62 private: | |
| 63 AXNodeImpl* CreateAndInitializeNode( | |
| 64 AXNodeImpl* parent, int32 id, int32 index_in_parent); | |
| 65 | |
| 66 AXNodeImpl* root_; | |
| 67 base::hash_map<int32, AXNodeImpl*> id_map_; | |
| 68 }; | |
| 69 | |
| 70 } // namespace content | |
| 71 | |
| 72 #endif // CONTENT_COMMON_AX_TREE_IMPL_H_ | |
| OLD | NEW |