Chromium Code Reviews| 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 <memory> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/strings/string16.h" | |
| 12 #include "ui/accessibility/ax_enums.h" | |
| 13 #include "ui/accessibility/ax_tree_update.h" | |
| 14 #include "ui/gfx/geometry/rect.h" | |
| 15 | |
| 16 namespace ui { | |
| 17 | |
| 18 class AXNode; | |
| 19 class AXTree; | |
| 20 | |
| 21 // An intermediate representation of the accessibility snapshot | |
| 22 // in order to share code between ARC and Android. The field names | |
| 23 // are kept consistent with AccessibilitySnapshotNode.java. | |
| 24 struct AXSnapshotNodeAndroid { | |
| 25 // Builds a whole tree of AXSnapshotNodeAndroid objects from | |
| 26 // an AxTreeUpdate. | |
|
dmazzoni
2017/04/25 17:06:58
nit: AXTreeUpdate (capitalization)
Muyuan
2017/04/25 17:51:03
Done.
| |
| 27 static std::unique_ptr<AXSnapshotNodeAndroid> Create( | |
| 28 const AXTreeUpdate& update); | |
| 29 | |
| 30 // Returns a fake Android view class that is a closest | |
| 31 // approximation of the AXRole. | |
| 32 static const char* AXRoleToAndroidClassName(AXRole role, bool has_parent); | |
| 33 | |
| 34 ~AXSnapshotNodeAndroid(); | |
| 35 | |
| 36 gfx::Rect rect; | |
| 37 base::string16 text; | |
| 38 float text_size; | |
| 39 int32_t color; | |
|
Luis Héctor Chávez
2017/04/25 18:22:36
iwyu: #include <cstdint>
Muyuan
2017/04/25 19:38:13
Done.
| |
| 40 int32_t bgcolor; | |
| 41 bool bold; | |
| 42 bool italic; | |
| 43 bool underline; | |
| 44 bool line_through; | |
| 45 | |
| 46 bool has_selection; | |
| 47 int32_t start_selection; | |
| 48 int32_t end_selection; | |
| 49 | |
| 50 std::string class_name; | |
| 51 std::vector<std::unique_ptr<AXSnapshotNodeAndroid>> children; | |
| 52 | |
| 53 private: | |
| 54 AXSnapshotNodeAndroid(); | |
| 55 | |
| 56 static std::unique_ptr<AXSnapshotNodeAndroid> WalkAXTreeDepthFirst( | |
|
Luis Héctor Chávez
2017/04/25 18:22:37
does it make sense to move this private static met
Muyuan
2017/04/25 19:38:13
It was moved here to get rid of public constructor
Luis Héctor Chávez
2017/04/25 20:05:32
Acknowledged.
| |
| 57 const AXNode* node, | |
| 58 gfx::Rect rect, | |
| 59 const AXTreeUpdate& update, | |
| 60 const AXTree* tree); | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(AXSnapshotNodeAndroid); | |
| 63 }; | |
| 64 | |
| 65 } // namespace ui | |
| 66 | |
| 67 #endif // UI_ACCESSIBILITY_PLATFORM_AX_SNAPSHOT_ANDROID_H_ | |
| OLD | NEW |