From cc8ba566dc2ae5e07de5caf5104875413163c488 Mon Sep 17 00:00:00 2001 From: "dtseng@chromium.org" Date: Thu, 8 May 2014 05:09:05 +0000 Subject: [PATCH] GetDesktop implementation for Automation API. This completes the initial implementation of the desktop portion of the automation API. It hooks up the javascript side bindings and js side backing objects. BUG=309681 NOTRY=true Review URL: https://codereview.chromium.org/260593002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269036 0039d316-1c4b-4281-b951-d872f2087c98 --- .../api/automation/automation_apitest.cc | 15 ++++-- .../automation_internal/automation_internal_api.cc | 19 +++++++ .../automation_internal/automation_internal_api.h | 10 ++++ .../ash/accessibility/automation_manager_views.cc | 58 +++++++++++++--------- .../ash/accessibility/automation_manager_views.h | 19 +++++-- .../ui/ash/accessibility/ax_root_obj_wrapper.cc | 3 ++ chrome/common/extensions/api/automation.idl | 3 ++ .../common/extensions/api/automation_internal.idl | 4 ++ .../extensions/automation/automation_tree.js | 2 +- .../extensions/automation_custom_bindings.js | 15 +++++- .../tests/{content.js => desktop/common.js} | 4 +- .../tests/{action.html => desktop/desktop.html} | 2 +- .../api_test/automation/tests/desktop/desktop.js | 17 +++++++ .../automation/tests/desktop/manifest.json | 7 +++ .../automation/tests/{ => tabs}/action.html | 0 .../automation/tests/{ => tabs}/actions.html | 0 .../automation/tests/{ => tabs}/actions.js | 0 .../api_test/automation/tests/{ => tabs}/common.js | 0 .../automation/tests/{ => tabs}/content.js | 0 .../automation/tests/{ => tabs}/events.html | 0 .../api_test/automation/tests/{ => tabs}/events.js | 0 .../automation/tests/{ => tabs}/location.html | 0 .../automation/tests/{ => tabs}/location.js | 0 .../automation/tests/{ => tabs}/manifest.json | 0 .../automation/tests/{ => tabs}/sanity_check.html | 0 .../automation/tests/{ => tabs}/sanity_check.js | 0 .../browser/extension_function_histogram_value.h | 1 + tools/metrics/histograms/histograms.xml | 1 + ui/accessibility/ax_tree_serializer.h | 7 ++- ui/views/accessibility/ax_aura_obj_cache.cc | 1 + 30 files changed, 151 insertions(+), 37 deletions(-) copy chrome/test/data/extensions/api_test/automation/tests/{content.js => desktop/common.js} (57%) copy chrome/test/data/extensions/api_test/automation/tests/{action.html => desktop/desktop.html} (85%) create mode 100644 chrome/test/data/extensions/api_test/automation/tests/desktop/desktop.js create mode 100644 chrome/test/data/extensions/api_test/automation/tests/desktop/manifest.json rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/action.html (100%) rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/actions.html (100%) rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/actions.js (100%) rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/common.js (100%) rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/content.js (100%) rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/events.html (100%) rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/events.js (100%) rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/location.html (100%) rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/location.js (100%) rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/manifest.json (100%) rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/sanity_check.html (100%) rename chrome/test/data/extensions/api_test/automation/tests/{ => tabs}/sanity_check.js (100%) diff --git a/chrome/browser/extensions/api/automation/automation_apitest.cc b/chrome/browser/extensions/api/automation/automation_apitest.cc index 5e38d0b3ce81..470cb4d9b7c3 100644 --- a/chrome/browser/extensions/api/automation/automation_apitest.cc +++ b/chrome/browser/extensions/api/automation/automation_apitest.cc @@ -99,26 +99,33 @@ IN_PROC_BROWSER_TEST_F(AutomationApiTest, TestRendererAccessibilityEnabled) { #endif // defined(OS_MACOSX) IN_PROC_BROWSER_TEST_F(AutomationApiTest, MAYBE_SanityCheck) { StartEmbeddedTestServer(); - ASSERT_TRUE(RunExtensionSubtest("automation/tests", "sanity_check.html")) + ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "sanity_check.html")) << message_; } IN_PROC_BROWSER_TEST_F(AutomationApiTest, Events) { LoadPage(); - ASSERT_TRUE(RunExtensionSubtest("automation/tests", "events.html")) + ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "events.html")) << message_; } IN_PROC_BROWSER_TEST_F(AutomationApiTest, Actions) { LoadPage(); - ASSERT_TRUE(RunExtensionSubtest("automation/tests", "actions.html")) + ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "actions.html")) << message_; } IN_PROC_BROWSER_TEST_F(AutomationApiTest, Location) { LoadPage(); - ASSERT_TRUE(RunExtensionSubtest("automation/tests", "location.html")) + ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "location.html")) << message_; } +#if defined(OS_CHROMEOS) +IN_PROC_BROWSER_TEST_F(AutomationApiTest, Desktop) { + ASSERT_TRUE(RunExtensionSubtest("automation/tests/desktop", "desktop.html")) + << message_; +} +#endif + } // namespace extensions diff --git a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc index 88600550e2d7..8d2769ce943f 100644 --- a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc +++ b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc @@ -19,6 +19,10 @@ #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents.h" +#if defined(OS_CHROMEOS) +#include "chrome/browser/ui/ash/accessibility/automation_manager_views.h" +#endif + namespace extensions { class AutomationWebContentsObserver; } // namespace extensions @@ -124,4 +128,19 @@ bool AutomationInternalPerformActionFunction::RunAsync() { return true; } +bool AutomationInternalEnableDesktopFunction::RunAsync() { + if (!CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableAutomationAPI)) { + return false; + } + +#if defined(OS_CHROMEOS) + AutomationManagerViews::GetInstance()->Enable(browser_context()); +#else + error_ = "getDesktop is unsupported by this platform"; +#endif + + return true; +} + } // namespace extensions diff --git a/chrome/browser/extensions/api/automation_internal/automation_internal_api.h b/chrome/browser/extensions/api/automation_internal/automation_internal_api.h index 6f902f7c152c..007cb27f9c9a 100644 --- a/chrome/browser/extensions/api/automation_internal/automation_internal_api.h +++ b/chrome/browser/extensions/api/automation_internal/automation_internal_api.h @@ -40,6 +40,16 @@ class AutomationInternalPerformActionFunction virtual bool RunAsync() OVERRIDE; }; +class AutomationInternalEnableDesktopFunction + : public ChromeAsyncExtensionFunction { + DECLARE_EXTENSION_FUNCTION("automationInternal.enableDesktop", + AUTOMATIONINTERNAL_ENABLEDESKTOP) + protected: + virtual ~AutomationInternalEnableDesktopFunction() {} + + virtual bool RunAsync() OVERRIDE; +}; + } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL_API_H_ diff --git a/chrome/browser/ui/ash/accessibility/automation_manager_views.cc b/chrome/browser/ui/ash/accessibility/automation_manager_views.cc index 92c808531042..859704ba9327 100644 --- a/chrome/browser/ui/ash/accessibility/automation_manager_views.cc +++ b/chrome/browser/ui/ash/accessibility/automation_manager_views.cc @@ -9,31 +9,35 @@ #include "base/memory/singleton.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/api/automation_internal/automation_util.h" -#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "content/public/browser/ax_event_notification_details.h" +#include "content/public/browser/browser_context.h" #include "ui/views/accessibility/ax_aura_obj_cache.h" #include "ui/views/accessibility/ax_aura_obj_wrapper.h" #include "ui/views/view.h" #include "ui/views/widget/widget.h" +using content::BrowserContext; + // static AutomationManagerViews* AutomationManagerViews::GetInstance() { return Singleton::get(); } -void AutomationManagerViews::Enable() { +void AutomationManagerViews::Enable(BrowserContext* context) { enabled_ = true; - if (current_tree_serializer_.get()) - current_tree_serializer_->Reset(); + Reset(); + SendEvent(context, current_tree_->GetRoot(), ui::AX_EVENT_LOAD_COMPLETE); } void AutomationManagerViews::Disable() { enabled_ = false; + + // Reset the serializer to save memory. current_tree_serializer_->Reset(); } -void AutomationManagerViews::HandleEvent(Profile* profile, +void AutomationManagerViews::HandleEvent(BrowserContext* context, views::View* view, ui::AXEvent event_type) { if (!enabled_) { @@ -46,30 +50,40 @@ void AutomationManagerViews::HandleEvent(Profile* profile, if (!widget) return; - if (!profile && g_browser_process->profile_manager()) { - profile = g_browser_process->profile_manager()->GetLastUsedProfile(); + if (!context && g_browser_process->profile_manager()) { + context = g_browser_process->profile_manager()->GetLastUsedProfile(); } - if (!profile) { - LOG(WARNING) << "Accessibility notification but no profile"; + if (!context) { + LOG(WARNING) << "Accessibility notification but no browser context"; return; } - if (!current_tree_.get()) { - current_tree_.reset(new AXTreeSourceViews()); - current_tree_serializer_.reset( - new ui::AXTreeSerializer( - current_tree_.get())); - } - - ui::AXTreeUpdate out_update; views::AXAuraObjWrapper* aura_obj = views::AXAuraObjCache::GetInstance()->GetOrCreate(view); - current_tree_serializer_->SerializeChanges(aura_obj, &out_update); + SendEvent(context, aura_obj, event_type); +} + +AutomationManagerViews::AutomationManagerViews() : enabled_(false) {} + +AutomationManagerViews::~AutomationManagerViews() {} + +void AutomationManagerViews::Reset() { + current_tree_.reset(new AXTreeSourceViews()); + current_tree_serializer_.reset( + new ui::AXTreeSerializer( + current_tree_.get())); +} + +void AutomationManagerViews::SendEvent(BrowserContext* context, + views::AXAuraObjWrapper* aura_obj, + ui::AXEvent event_type) { + ui::AXTreeUpdate update; + current_tree_serializer_->SerializeChanges(aura_obj, &update); // Route this event to special process/routing ids recognized by the // Automation API as the desktop tree. // TODO(dtseng): Would idealy define these special desktop constants in idl. - content::AXEventNotificationDetails detail(out_update.nodes, + content::AXEventNotificationDetails detail(update.nodes, event_type, aura_obj->GetID(), 0, /* process_id */ @@ -77,9 +91,5 @@ void AutomationManagerViews::HandleEvent(Profile* profile, std::vector details; details.push_back(detail); extensions::automation_util::DispatchAccessibilityEventsToAutomation( - details, profile); + details, context); } - -AutomationManagerViews::AutomationManagerViews() : enabled_(false) {} - -AutomationManagerViews:: ~AutomationManagerViews() {} diff --git a/chrome/browser/ui/ash/accessibility/automation_manager_views.h b/chrome/browser/ui/ash/accessibility/automation_manager_views.h index af34ff7d07fb..f9a15433ab0a 100644 --- a/chrome/browser/ui/ash/accessibility/automation_manager_views.h +++ b/chrome/browser/ui/ash/accessibility/automation_manager_views.h @@ -13,7 +13,9 @@ template struct DefaultSingletonTraits; -class Profile; +namespace content { +class BrowserContext; +} // namespace content namespace views { class AXAuraObjWrapper; @@ -27,13 +29,15 @@ class AutomationManagerViews { static AutomationManagerViews* GetInstance(); // Enable automation support for views. - void Enable(); + void Enable(content::BrowserContext* context); // Disable automation support for views. void Disable(); // Handle an event fired upon a |View|. - void HandleEvent(Profile* profile, views::View* view, ui::AXEvent event_type); + void HandleEvent(content::BrowserContext* context, + views::View* view, + ui::AXEvent event_type); private: friend struct DefaultSingletonTraits; @@ -41,7 +45,14 @@ class AutomationManagerViews { AutomationManagerViews(); ~AutomationManagerViews(); - // Whether Views-based automation is enabled. + // Reset all state in this manager. + void Reset(); + + void SendEvent(content::BrowserContext* context, + views::AXAuraObjWrapper* aura_obj, + ui::AXEvent event_type); + + // Whether automation support for views is enabled. bool enabled_; // Holds the active views-based accessibility tree. A tree currently consists diff --git a/chrome/browser/ui/ash/accessibility/ax_root_obj_wrapper.cc b/chrome/browser/ui/ash/accessibility/ax_root_obj_wrapper.cc index 39a5b8d300ad..0a2246aa8e66 100644 --- a/chrome/browser/ui/ash/accessibility/ax_root_obj_wrapper.cc +++ b/chrome/browser/ui/ash/accessibility/ax_root_obj_wrapper.cc @@ -27,6 +27,9 @@ views::AXAuraObjWrapper* AXRootObjWrapper::GetParent() { void AXRootObjWrapper::GetChildren( std::vector* out_children) { + if (!ash::Shell::HasInstance()) + return; + // Only on ash is there a notion of a root with children. aura::Window::Windows children = ash::Shell::GetInstance()->GetAllRootWindows(); diff --git a/chrome/common/extensions/api/automation.idl b/chrome/common/extensions/api/automation.idl index 3b280c72df7a..9dd1072d26b4 100644 --- a/chrome/common/extensions/api/automation.idl +++ b/chrome/common/extensions/api/automation.idl @@ -95,5 +95,8 @@ // loaded (the previous root node reference will stop working at or before // this point). [nocompile] static void getTree(RootCallback callback); + + // Get the automation tree for the desktop. + [nocompile] static void getDesktop(RootCallback callback); }; }; diff --git a/chrome/common/extensions/api/automation_internal.idl b/chrome/common/extensions/api/automation_internal.idl index dbdb91b18c65..6d8becc922fa 100644 --- a/chrome/common/extensions/api/automation_internal.idl +++ b/chrome/common/extensions/api/automation_internal.idl @@ -84,6 +84,10 @@ namespace automationInternal { // in future updates. static void enableCurrentTab(EnableCallback callback); + // Enables desktop automation. + static void enableDesktop(); + + // Performs an action on an automation node. static void performAction(PerformActionRequiredParams args, object opt_args); }; diff --git a/chrome/renderer/resources/extensions/automation/automation_tree.js b/chrome/renderer/resources/extensions/automation/automation_tree.js index 6d8afc53c6ac..43d535017dc9 100644 --- a/chrome/renderer/resources/extensions/automation/automation_tree.js +++ b/chrome/renderer/resources/extensions/automation/automation_tree.js @@ -136,7 +136,7 @@ AutomationTreeImpl.prototype = { } } - if (nodeData.role == 'root_web_area') { + if (nodeData.role == 'root_web_area' || nodeData.role == 'desktop') { this.root = node; didUpdateRoot = true; } diff --git a/chrome/renderer/resources/extensions/automation_custom_bindings.js b/chrome/renderer/resources/extensions/automation_custom_bindings.js index fae3ee1c0763..dd783b27ff0d 100644 --- a/chrome/renderer/resources/extensions/automation_custom_bindings.js +++ b/chrome/renderer/resources/extensions/automation_custom_bindings.js @@ -52,6 +52,20 @@ automation.registerCustomHook(function(bindingsAPI) { } }); }); + + var desktopTree = null; + apiFunctions.setHandleRequest('getDesktop', function(callback) { + var id = createAutomationTreeID(0, 0); + desktopTree = idToAutomationTree[id]; + if (!desktopTree) { + desktopTree = new AutomationTree(0, 0); + idToAutomationTree[id] = desktopTree; + // TODO(dtseng): Disable desktop tree once desktop object goes out of + // scope. + automationInternal.enableDesktop(); + } + window.setTimeout(function() { callback(desktopTree); }, 0); + }); }); // Listen to the automationInternal.onaccessibilityEvent event, which is @@ -70,7 +84,6 @@ automationInternal.onAccessibilityEvent.addListener(function(data) { idToAutomationTree[id] = targetTree; } privates(targetTree).impl.update(data); - var eventType = data.eventType; if (eventType == 'load_complete' || eventType == 'layout_complete') { // If the tree wasn't available when getTree() was called, the callback will diff --git a/chrome/test/data/extensions/api_test/automation/tests/content.js b/chrome/test/data/extensions/api_test/automation/tests/desktop/common.js similarity index 57% copy from chrome/test/data/extensions/api_test/automation/tests/content.js copy to chrome/test/data/extensions/api_test/automation/tests/desktop/common.js index 694ce16d00f4..21ce28c47269 100644 --- a/chrome/test/data/extensions/api_test/automation/tests/content.js +++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/common.js @@ -2,4 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -chrome.runtime.sendMessage({ 'loaded': true }); +var assertEq = chrome.test.assertEq; +var assertFalse = chrome.test.assertFalse; +var assertTrue = chrome.test.assertTrue; diff --git a/chrome/test/data/extensions/api_test/automation/tests/action.html b/chrome/test/data/extensions/api_test/automation/tests/desktop/desktop.html similarity index 85% copy from chrome/test/data/extensions/api_test/automation/tests/action.html copy to chrome/test/data/extensions/api_test/automation/tests/desktop/desktop.html index 791ac97a97b5..031f8a26c2c2 100644 --- a/chrome/test/data/extensions/api_test/automation/tests/action.html +++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/desktop.html @@ -4,4 +4,4 @@ * LICENSE file. --> - + diff --git a/chrome/test/data/extensions/api_test/automation/tests/desktop/desktop.js b/chrome/test/data/extensions/api_test/automation/tests/desktop/desktop.js new file mode 100644 index 000000000000..fb393090140d --- /dev/null +++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/desktop.js @@ -0,0 +1,17 @@ +// Copyright 2014 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. + +var allTests = [ + function testGetDesktop() { + chrome.automation.getDesktop(function(tree) { + tree.addEventListener('load_complete', function(e) { + assertEq('desktop', tree.root.role); + assertEq('window', tree.root.firstChild().role); + chrome.test.succeed(); + }, true); + }); + } +]; + +chrome.test.runTests(allTests); diff --git a/chrome/test/data/extensions/api_test/automation/tests/desktop/manifest.json b/chrome/test/data/extensions/api_test/automation/tests/desktop/manifest.json new file mode 100644 index 000000000000..e1f52b3f28b4 --- /dev/null +++ b/chrome/test/data/extensions/api_test/automation/tests/desktop/manifest.json @@ -0,0 +1,7 @@ +{ + "name": "chrome.automation.sanityCheck", + "version": "0.1", + "manifest_version": 2, + "description": "Tests for the Automation API.", + "automation": {"desktop": true} +} diff --git a/chrome/test/data/extensions/api_test/automation/tests/action.html b/chrome/test/data/extensions/api_test/automation/tests/tabs/action.html similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/action.html rename to chrome/test/data/extensions/api_test/automation/tests/tabs/action.html diff --git a/chrome/test/data/extensions/api_test/automation/tests/actions.html b/chrome/test/data/extensions/api_test/automation/tests/tabs/actions.html similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/actions.html rename to chrome/test/data/extensions/api_test/automation/tests/tabs/actions.html diff --git a/chrome/test/data/extensions/api_test/automation/tests/actions.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/actions.js similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/actions.js rename to chrome/test/data/extensions/api_test/automation/tests/tabs/actions.js diff --git a/chrome/test/data/extensions/api_test/automation/tests/common.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/common.js similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/common.js rename to chrome/test/data/extensions/api_test/automation/tests/tabs/common.js diff --git a/chrome/test/data/extensions/api_test/automation/tests/content.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/content.js similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/content.js rename to chrome/test/data/extensions/api_test/automation/tests/tabs/content.js diff --git a/chrome/test/data/extensions/api_test/automation/tests/events.html b/chrome/test/data/extensions/api_test/automation/tests/tabs/events.html similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/events.html rename to chrome/test/data/extensions/api_test/automation/tests/tabs/events.html diff --git a/chrome/test/data/extensions/api_test/automation/tests/events.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/events.js similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/events.js rename to chrome/test/data/extensions/api_test/automation/tests/tabs/events.js diff --git a/chrome/test/data/extensions/api_test/automation/tests/location.html b/chrome/test/data/extensions/api_test/automation/tests/tabs/location.html similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/location.html rename to chrome/test/data/extensions/api_test/automation/tests/tabs/location.html diff --git a/chrome/test/data/extensions/api_test/automation/tests/location.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/location.js similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/location.js rename to chrome/test/data/extensions/api_test/automation/tests/tabs/location.js diff --git a/chrome/test/data/extensions/api_test/automation/tests/manifest.json b/chrome/test/data/extensions/api_test/automation/tests/tabs/manifest.json similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/manifest.json rename to chrome/test/data/extensions/api_test/automation/tests/tabs/manifest.json diff --git a/chrome/test/data/extensions/api_test/automation/tests/sanity_check.html b/chrome/test/data/extensions/api_test/automation/tests/tabs/sanity_check.html similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/sanity_check.html rename to chrome/test/data/extensions/api_test/automation/tests/tabs/sanity_check.html diff --git a/chrome/test/data/extensions/api_test/automation/tests/sanity_check.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/sanity_check.js similarity index 100% rename from chrome/test/data/extensions/api_test/automation/tests/sanity_check.js rename to chrome/test/data/extensions/api_test/automation/tests/tabs/sanity_check.js diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index 3a08a473d398..b4680c862a2f 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h @@ -815,6 +815,7 @@ enum HistogramValue { WEBVIEW_SHOWCONTEXTMENU, WEBRTCLOGGINGPRIVATE_STARTRTPDUMP, WEBRTCLOGGINGPRIVATE_STOPRTPDUMP, + AUTOMATIONINTERNAL_ENABLEDESKTOP, // Last entry: Add new entries above and ensure to update // tools/metrics/histograms/histograms/histograms.xml. ENUM_BOUNDARY diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 5cfcb727ee23..faef4a334f99 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -33979,6 +33979,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. + diff --git a/ui/accessibility/ax_tree_serializer.h b/ui/accessibility/ax_tree_serializer.h index 546f95f073c7..f1cbfcea1053 100644 --- a/ui/accessibility/ax_tree_serializer.h +++ b/ui/accessibility/ax_tree_serializer.h @@ -417,8 +417,13 @@ void AXTreeSerializer::SerializeChangedNodes( out_update->nodes.push_back(AXNodeData()); AXNodeData* serialized_node = &out_update->nodes.back(); tree_->SerializeNode(node, serialized_node); - if (serialized_node->id == client_root_->id) + // TODO(dmazzoni/dtseng): Make the serializer not depend on roles to identify + // the root. + if (serialized_node->id == client_root_->id && + (serialized_node->role != AX_ROLE_ROOT_WEB_AREA && + serialized_node->role != AX_ROLE_DESKTOP)) { serialized_node->role = AX_ROLE_ROOT_WEB_AREA; + } serialized_node->child_ids.clear(); // Iterate over the children, make note of the ones that are new diff --git a/ui/views/accessibility/ax_aura_obj_cache.cc b/ui/views/accessibility/ax_aura_obj_cache.cc index 43efa1e01aaf..ae2df2068abc 100644 --- a/ui/views/accessibility/ax_aura_obj_cache.cc +++ b/ui/views/accessibility/ax_aura_obj_cache.cc @@ -5,6 +5,7 @@ #include "ui/views/accessibility/ax_aura_obj_cache.h" #include "base/memory/singleton.h" +#include "base/stl_util.h" #include "ui/aura/window.h" #include "ui/views/accessibility/ax_aura_obj_wrapper.h" #include "ui/views/accessibility/ax_view_obj_wrapper.h" -- 2.11.4.GIT