Commit 45693bf4 authored by Randy Rossi's avatar Randy Rossi Committed by Commit Bot

Add setter for ax child tree id on full screen shell surface

Allow setting the ax child tree id property on the
full screen shell surface.

Bug: None
Test: Manual w/display assistant build
Change-Id: I465e45dc37038ea3c36131fb04a8d57c7b94f3d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1720867Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Randy Rossi <rmrossi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682713}
parent b4b90d56
......@@ -128,6 +128,7 @@ source_set("exo") {
}
if (is_chromecast) {
deps += [ "//ui/accessibility:accessibility" ]
sources += [
"fullscreen_shell_surface.cc",
"fullscreen_shell_surface.h",
......@@ -249,6 +250,7 @@ source_set("unit_tests") {
}
if (is_chromecast) {
deps += [ "//ui/accessibility:accessibility" ]
sources += [ "fullscreen_shell_surface_unittest.cc" ]
}
}
......
......@@ -243,4 +243,18 @@ bool FullscreenShellSurface::OnPreWidgetCommit() {
return true;
}
void FullscreenShellSurface::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->role = ax::mojom::Role::kClient;
if (child_ax_tree_id_ == ui::AXTreeIDUnknown())
return;
node_data->AddStringAttribute(ax::mojom::StringAttribute::kChildTreeId,
child_ax_tree_id_.ToString());
}
void FullscreenShellSurface::SetChildAxTreeId(ui::AXTreeID child_ax_tree_id) {
child_ax_tree_id_ = child_ax_tree_id;
}
} // namespace exo
......@@ -7,6 +7,8 @@
#include "components/exo/surface_observer.h"
#include "components/exo/surface_tree_host.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/accessibility/ax_tree_id.h"
#include "ui/aura/window_observer.h"
#include "ui/views/widget/widget_delegate.h"
......@@ -74,6 +76,11 @@ class FullscreenShellSurface : public SurfaceTreeHost,
// Overridden from aura::WindowObserver:
void OnWindowDestroying(aura::Window* window) override;
// Overridden from ui::View
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
void SetChildAxTreeId(ui::AXTreeID child_ax_tree_id);
private:
void CreateFullscreenShellSurfaceWidget(ui::WindowShowState show_state);
void CommitWidget();
......@@ -85,6 +92,7 @@ class FullscreenShellSurface : public SurfaceTreeHost,
base::Optional<std::string> startup_id_;
base::RepeatingClosure close_callback_;
base::OnceClosure surface_destroyed_callback_;
ui::AXTreeID child_ax_tree_id_ = ui::AXTreeIDUnknown();
DISALLOW_COPY_AND_ASSIGN(FullscreenShellSurface);
};
......
......@@ -12,6 +12,8 @@
#include "components/exo/wm_helper.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/accessibility/ax_tree_id.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/compositor/compositor.h"
......@@ -181,5 +183,21 @@ TEST_F(FullscreenShellSurfaceTest, Bounds) {
EXPECT_EQ(fullscreen_bounds, expected_bounds);
}
TEST_F(FullscreenShellSurfaceTest, SetAXChildTree) {
std::unique_ptr<Surface> surface(new Surface);
std::unique_ptr<FullscreenShellSurface> fullscreen_surface(
new FullscreenShellSurface(surface.get()));
ui::AXNodeData node_data;
fullscreen_surface->GetAccessibleNodeData(&node_data);
EXPECT_FALSE(
node_data.HasStringAttribute(ax::mojom::StringAttribute::kChildTreeId));
ui::AXTreeID tree_id = ui::AXTreeID::CreateNewAXTreeID();
fullscreen_surface->SetChildAxTreeId(tree_id);
fullscreen_surface->GetAccessibleNodeData(&node_data);
EXPECT_TRUE(
node_data.HasStringAttribute(ax::mojom::StringAttribute::kChildTreeId));
}
} // namespace
} // namespace exo
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment