15c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// Copyright 2014 The Chromium Authors. All rights reserved.
25c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// Use of this source code is governed by a BSD-style license that can be
35c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// found in the LICENSE file.
45c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AX_TREE_SOURCE_ASH_H_
6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#define CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AX_TREE_SOURCE_ASH_H_
75c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
85c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include <map>
95c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
105c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include "base/basictypes.h"
115c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include "base/memory/scoped_ptr.h"
125c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include "chrome/browser/ui/ash/accessibility/ax_root_obj_wrapper.h"
135c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include "ui/accessibility/ax_tree_source.h"
145c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
155c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liunamespace views {
165c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liuclass AXAuraObjWrapper;
175c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu}  // namespace views
185c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
195c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// This class exposes the views hierarchy as an accessibility tree permitting
205c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// use with other accessibility classes.
21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class AXTreeSourceAsh
225c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu    : public ui::AXTreeSource<views::AXAuraObjWrapper*> {
235c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu public:
24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  AXTreeSourceAsh();
25cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual ~AXTreeSourceAsh();
26cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // A set of actions invoked on an Aura view.
28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void DoDefault(int32 id);
29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void Focus(int32 id);
30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void MakeVisible(int32 id);
31cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void SetSelection(int32 id, int32 start, int32 end);
325c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
335c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  // AXTreeSource implementation.
345c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  virtual views::AXAuraObjWrapper* GetRoot() const OVERRIDE;
355c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  virtual views::AXAuraObjWrapper* GetFromId(int32 id) const OVERRIDE;
365c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  virtual int32 GetId(views::AXAuraObjWrapper* node) const OVERRIDE;
375c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  virtual void GetChildren(views::AXAuraObjWrapper* node,
385c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu      std::vector<views::AXAuraObjWrapper*>* out_children) const OVERRIDE;
395c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  virtual views::AXAuraObjWrapper* GetParent(
405c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu      views::AXAuraObjWrapper* node) const OVERRIDE;
415c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  virtual bool IsValid(views::AXAuraObjWrapper* node) const OVERRIDE;
425c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  virtual bool IsEqual(views::AXAuraObjWrapper* node1,
435c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                       views::AXAuraObjWrapper* node2) const OVERRIDE;
445c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  virtual views::AXAuraObjWrapper* GetNull() const OVERRIDE;
455c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  virtual void SerializeNode(
465c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu      views::AXAuraObjWrapper* node, ui::AXNodeData* out_data) const OVERRIDE;
475c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
485c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  // Useful for debugging.
495c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  std::string ToString(views::AXAuraObjWrapper* root, std::string prefix);
505c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
515c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu private:
525c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  scoped_ptr<AXRootObjWrapper> root_;
535c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
54cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(AXTreeSourceAsh);
555c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu};
565c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
57cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_ASH_ACCESSIBILITY_AX_TREE_SOURCE_ASH_H_
58