OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 UI_ACCESSIBILITY_PLATFORM_AX_SNAPSHOT_ANDROID_H_ |
| 6 #define UI_ACCESSIBILITY_PLATFORM_AX_SNAPSHOT_ANDROID_H_ |
| 7 |
| 8 #include <cstdint> |
| 9 #include <memory> |
| 10 #include <vector> |
| 11 |
| 12 #include "base/strings/string16.h" |
| 13 #include "ui/accessibility/ax_enums.h" |
| 14 #include "ui/accessibility/ax_export.h" |
| 15 #include "ui/accessibility/ax_tree_update.h" |
| 16 #include "ui/gfx/geometry/rect.h" |
| 17 |
| 18 namespace ui { |
| 19 |
| 20 class AXNode; |
| 21 class AXTree; |
| 22 |
| 23 // An intermediate representation of the accessibility snapshot |
| 24 // in order to share code between ARC and Android. The field names |
| 25 // are kept consistent with AccessibilitySnapshotNode.java. |
| 26 struct AXSnapshotNodeAndroid { |
| 27 // Builds a whole tree of AXSnapshotNodeAndroid objects from |
| 28 // an AXTreeUpdate. |
| 29 AX_EXPORT static std::unique_ptr<AXSnapshotNodeAndroid> Create( |
| 30 const AXTreeUpdate& update, |
| 31 bool show_password); |
| 32 |
| 33 // Returns a fake Android view class that is a closest |
| 34 // approximation of the AXRole. |
| 35 AX_EXPORT static const char* AXRoleToAndroidClassName(AXRole role, |
| 36 bool has_parent); |
| 37 |
| 38 AX_EXPORT static bool AXRoleIsLink(AXRole role); |
| 39 |
| 40 AX_EXPORT static base::string16 AXUrlBaseText(base::string16 url); |
| 41 |
| 42 AX_EXPORT ~AXSnapshotNodeAndroid(); |
| 43 |
| 44 gfx::Rect rect; |
| 45 base::string16 text; |
| 46 float text_size; |
| 47 int32_t color; |
| 48 int32_t bgcolor; |
| 49 bool bold; |
| 50 bool italic; |
| 51 bool underline; |
| 52 bool line_through; |
| 53 |
| 54 bool has_selection; |
| 55 int32_t start_selection; |
| 56 int32_t end_selection; |
| 57 |
| 58 std::string class_name; |
| 59 std::vector<std::unique_ptr<AXSnapshotNodeAndroid>> children; |
| 60 |
| 61 private: |
| 62 AXSnapshotNodeAndroid(); |
| 63 |
| 64 struct WalkAXTreeConfig { |
| 65 bool should_select_leaf; |
| 66 const bool show_password; |
| 67 }; |
| 68 |
| 69 static std::unique_ptr<AXSnapshotNodeAndroid> WalkAXTreeDepthFirst( |
| 70 const AXNode* node, |
| 71 gfx::Rect rect, |
| 72 const ui::AXTreeUpdate& update, |
| 73 const AXTree* tree, |
| 74 WalkAXTreeConfig& config); |
| 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(AXSnapshotNodeAndroid); |
| 77 }; |
| 78 |
| 79 } // namespace ui |
| 80 |
| 81 #endif // UI_ACCESSIBILITY_PLATFORM_AX_SNAPSHOT_ANDROID_H_ |
OLD | NEW |