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

Unified Diff: ui/accessibility/platform/ax_snapshot_node_android_platform.h

Issue 2808383004: Refactor and send voice interaction structure (Closed)
Patch Set: fix window build Created 3 years, 8 months 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: ui/accessibility/platform/ax_snapshot_node_android_platform.h
diff --git a/ui/accessibility/platform/ax_snapshot_node_android_platform.h b/ui/accessibility/platform/ax_snapshot_node_android_platform.h
new file mode 100644
index 0000000000000000000000000000000000000000..f9aa9729ae04fd71e58f98d46106bff0cbbaf07c
--- /dev/null
+++ b/ui/accessibility/platform/ax_snapshot_node_android_platform.h
@@ -0,0 +1,81 @@
+// Copyright 2017 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 UI_ACCESSIBILITY_PLATFORM_AX_SNAPSHOT_ANDROID_H_
+#define UI_ACCESSIBILITY_PLATFORM_AX_SNAPSHOT_ANDROID_H_
+
+#include <cstdint>
+#include <memory>
+#include <vector>
+
+#include "base/strings/string16.h"
+#include "ui/accessibility/ax_enums.h"
+#include "ui/accessibility/ax_export.h"
+#include "ui/accessibility/ax_tree_update.h"
+#include "ui/gfx/geometry/rect.h"
+
+namespace ui {
+
+class AXNode;
+class AXTree;
+
+// An intermediate representation of the accessibility snapshot
+// in order to share code between ARC and Android. The field names
+// are kept consistent with AccessibilitySnapshotNode.java.
+struct AXSnapshotNodeAndroid {
+ // Builds a whole tree of AXSnapshotNodeAndroid objects from
+ // an AXTreeUpdate.
+ AX_EXPORT static std::unique_ptr<AXSnapshotNodeAndroid> Create(
+ const AXTreeUpdate& update,
+ bool show_password);
+
+ // Returns a fake Android view class that is a closest
+ // approximation of the AXRole.
+ AX_EXPORT static const char* AXRoleToAndroidClassName(AXRole role,
+ bool has_parent);
+
+ AX_EXPORT static bool AXRoleIsLink(AXRole role);
+
+ AX_EXPORT static base::string16 AXUrlBaseText(base::string16 url);
+
+ AX_EXPORT ~AXSnapshotNodeAndroid();
+
+ gfx::Rect rect;
+ base::string16 text;
+ float text_size;
+ int32_t color;
+ int32_t bgcolor;
+ bool bold;
+ bool italic;
+ bool underline;
+ bool line_through;
+
+ bool has_selection;
+ int32_t start_selection;
+ int32_t end_selection;
+
+ std::string class_name;
+ std::vector<std::unique_ptr<AXSnapshotNodeAndroid>> children;
+
+ private:
+ AXSnapshotNodeAndroid();
+
+ struct WalkAXTreeConfig {
+ bool should_select_leaf;
+ const bool show_password;
+ };
+
+ static std::unique_ptr<AXSnapshotNodeAndroid> WalkAXTreeDepthFirst(
+ const AXNode* node,
+ gfx::Rect rect,
+ const ui::AXTreeUpdate& update,
+ const AXTree* tree,
+ WalkAXTreeConfig& config);
+
+ DISALLOW_COPY_AND_ASSIGN(AXSnapshotNodeAndroid);
+};
+
+} // namespace ui
+
+#endif // UI_ACCESSIBILITY_PLATFORM_AX_SNAPSHOT_ANDROID_H_
« no previous file with comments | « ui/accessibility/platform/ax_android_constants.cc ('k') | ui/accessibility/platform/ax_snapshot_node_android_platform.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698