Commit ac702a78 authored by Randy Rossi's avatar Randy Rossi Committed by Commit Bot

Moving more automation code to /extensions

Eliminating more duplicate chromecast code by moving
automation_internal_custom_bindings.* and
automation_ax_tree_wrapper.* into /extensions/renderer

Patch Set 1 is baseline for moved/deleted files

Bug: 837773
Test: Chrome official build + samus ChromeOS build, ran ChromeVox
Change-Id: I0ea12a800528cfc9c22ad1356765a330b9622e5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1593792Reviewed-by: default avatarEsmael El-Moslimany <aee@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Reviewed-by: default avatarJay Civelli <jcivelli@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Randy Rossi <rmrossi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659051}
parent 0d012669
...@@ -277,10 +277,6 @@ jumbo_static_library("renderer") { ...@@ -277,10 +277,6 @@ jumbo_static_library("renderer") {
sources += [ sources += [
"extensions/app_hooks_delegate.cc", "extensions/app_hooks_delegate.cc",
"extensions/app_hooks_delegate.h", "extensions/app_hooks_delegate.h",
"extensions/automation_ax_tree_wrapper.cc",
"extensions/automation_ax_tree_wrapper.h",
"extensions/automation_internal_custom_bindings.cc",
"extensions/automation_internal_custom_bindings.h",
"extensions/chrome_extensions_dispatcher_delegate.cc", "extensions/chrome_extensions_dispatcher_delegate.cc",
"extensions/chrome_extensions_dispatcher_delegate.h", "extensions/chrome_extensions_dispatcher_delegate.h",
"extensions/chrome_extensions_renderer_client.cc", "extensions/chrome_extensions_renderer_client.cc",
...@@ -327,7 +323,6 @@ jumbo_static_library("renderer") { ...@@ -327,7 +323,6 @@ jumbo_static_library("renderer") {
"media/cast_transport_ipc.h", "media/cast_transport_ipc.h",
"media/cast_udp_transport.cc", "media/cast_udp_transport.cc",
"media/cast_udp_transport.h", "media/cast_udp_transport.h",
"resources/extensions/automation_custom_bindings.js",
"resources/extensions/browser_action_custom_bindings.js", "resources/extensions/browser_action_custom_bindings.js",
"resources/extensions/declarative_content_custom_bindings.js", "resources/extensions/declarative_content_custom_bindings.js",
"resources/extensions/enterprise_platform_keys_custom_bindings.js", "resources/extensions/enterprise_platform_keys_custom_bindings.js",
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "chrome/common/crash_keys.h" #include "chrome/common/crash_keys.h"
#include "chrome/grit/renderer_resources.h" #include "chrome/grit/renderer_resources.h"
#include "chrome/renderer/extensions/app_hooks_delegate.h" #include "chrome/renderer/extensions/app_hooks_delegate.h"
#include "chrome/renderer/extensions/automation_internal_custom_bindings.h"
#include "chrome/renderer/extensions/cast_streaming_native_handler.h" #include "chrome/renderer/extensions/cast_streaming_native_handler.h"
#include "chrome/renderer/extensions/extension_hooks_delegate.h" #include "chrome/renderer/extensions/extension_hooks_delegate.h"
#include "chrome/renderer/extensions/media_galleries_custom_bindings.h" #include "chrome/renderer/extensions/media_galleries_custom_bindings.h"
...@@ -52,11 +51,9 @@ ...@@ -52,11 +51,9 @@
using extensions::NativeHandler; using extensions::NativeHandler;
ChromeExtensionsDispatcherDelegate::ChromeExtensionsDispatcherDelegate() { ChromeExtensionsDispatcherDelegate::ChromeExtensionsDispatcherDelegate() {}
}
ChromeExtensionsDispatcherDelegate::~ChromeExtensionsDispatcherDelegate() { ChromeExtensionsDispatcherDelegate::~ChromeExtensionsDispatcherDelegate() {}
}
void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers( void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers(
extensions::Dispatcher* dispatcher, extensions::Dispatcher* dispatcher,
...@@ -96,10 +93,6 @@ void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers( ...@@ -96,10 +93,6 @@ void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers(
"cast_streaming_natives", "cast_streaming_natives",
std::make_unique<extensions::CastStreamingNativeHandler>( std::make_unique<extensions::CastStreamingNativeHandler>(
context, bindings_system)); context, bindings_system));
module_system->RegisterNativeHandler(
"automationInternal",
std::make_unique<extensions::AutomationInternalCustomBindings>(
context, bindings_system));
// The following are native handlers that are defined in //extensions, but // The following are native handlers that are defined in //extensions, but
// are only used for APIs defined in Chrome. // are only used for APIs defined in Chrome.
...@@ -118,9 +111,6 @@ void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers( ...@@ -118,9 +111,6 @@ void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers(
void ChromeExtensionsDispatcherDelegate::PopulateSourceMap( void ChromeExtensionsDispatcherDelegate::PopulateSourceMap(
extensions::ResourceBundleSourceMap* source_map) { extensions::ResourceBundleSourceMap* source_map) {
// Custom bindings. // Custom bindings.
source_map->RegisterSource("automation", IDR_AUTOMATION_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("automationEvent", IDR_AUTOMATION_EVENT_JS);
source_map->RegisterSource("automationNode", IDR_AUTOMATION_NODE_JS);
source_map->RegisterSource("browserAction", source_map->RegisterSource("browserAction",
IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS); IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("declarativeContent", source_map->RegisterSource("declarativeContent",
......
...@@ -23,9 +23,6 @@ ...@@ -23,9 +23,6 @@
<!-- Extension libraries. --> <!-- Extension libraries. -->
<if expr="enable_extensions"> <if expr="enable_extensions">
<!-- Custom bindings for extension APIs. --> <!-- Custom bindings for extension APIs. -->
<include name="IDR_AUTOMATION_CUSTOM_BINDINGS_JS" file="extensions\automation_custom_bindings.js" type="BINDATA" />
<include name="IDR_AUTOMATION_EVENT_JS" file="extensions\automation\automation_event.js" type="BINDATA" />
<include name="IDR_AUTOMATION_NODE_JS" file="extensions\automation\automation_node.js" type="BINDATA" />
<include name="IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS" file="extensions\browser_action_custom_bindings.js" type="BINDATA" /> <include name="IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS" file="extensions\browser_action_custom_bindings.js" type="BINDATA" />
<include name="IDR_CAST_STREAMING_RTP_STREAM_CUSTOM_BINDINGS_JS" file="extensions\cast_streaming_rtp_stream_custom_bindings.js" type="BINDATA" /> <include name="IDR_CAST_STREAMING_RTP_STREAM_CUSTOM_BINDINGS_JS" file="extensions\cast_streaming_rtp_stream_custom_bindings.js" type="BINDATA" />
<include name="IDR_CAST_STREAMING_SESSION_CUSTOM_BINDINGS_JS" file="extensions\cast_streaming_session_custom_bindings.js" type="BINDATA" /> <include name="IDR_CAST_STREAMING_SESSION_CUSTOM_BINDINGS_JS" file="extensions\cast_streaming_session_custom_bindings.js" type="BINDATA" />
......
...@@ -92,10 +92,6 @@ cast_source_set("renderer") { ...@@ -92,10 +92,6 @@ cast_source_set("renderer") {
"cast_extensions_dispatcher_delegate.g", "cast_extensions_dispatcher_delegate.g",
"cast_extensions_renderer_client.cc", "cast_extensions_renderer_client.cc",
"cast_extensions_renderer_client.h", "cast_extensions_renderer_client.h",
"extensions/automation_ax_tree_wrapper.cc",
"extensions/automation_ax_tree_wrapper.h",
"extensions/automation_internal_custom_bindings.cc",
"extensions/automation_internal_custom_bindings.h",
"extensions/extension_hooks_delegate.cc", "extensions/extension_hooks_delegate.cc",
"extensions/extension_hooks_delegate.h", "extensions/extension_hooks_delegate.h",
"extensions/tabs_hooks_delegate.cc", "extensions/tabs_hooks_delegate.cc",
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "chromecast/renderer/extensions/automation_internal_custom_bindings.h"
#include "chromecast/renderer/extensions/extension_hooks_delegate.h" #include "chromecast/renderer/extensions/extension_hooks_delegate.h"
#include "chromecast/renderer/extensions/tabs_hooks_delegate.h" #include "chromecast/renderer/extensions/tabs_hooks_delegate.h"
#include "chromecast/renderer/grit/extensions_renderer_resources.h" #include "chromecast/renderer/grit/extensions_renderer_resources.h"
...@@ -39,21 +38,15 @@ ...@@ -39,21 +38,15 @@
using extensions::NativeHandler; using extensions::NativeHandler;
CastExtensionsDispatcherDelegate::CastExtensionsDispatcherDelegate() { CastExtensionsDispatcherDelegate::CastExtensionsDispatcherDelegate() {}
}
CastExtensionsDispatcherDelegate::~CastExtensionsDispatcherDelegate() { CastExtensionsDispatcherDelegate::~CastExtensionsDispatcherDelegate() {}
}
void CastExtensionsDispatcherDelegate::RegisterNativeHandlers( void CastExtensionsDispatcherDelegate::RegisterNativeHandlers(
extensions::Dispatcher* dispatcher, extensions::Dispatcher* dispatcher,
extensions::ModuleSystem* module_system, extensions::ModuleSystem* module_system,
extensions::NativeExtensionBindingsSystem* bindings_system, extensions::NativeExtensionBindingsSystem* bindings_system,
extensions::ScriptContext* context) { extensions::ScriptContext* context) {
module_system->RegisterNativeHandler(
"automationInternal",
std::make_unique<extensions::cast::AutomationInternalCustomBindings>(
context, bindings_system));
module_system->RegisterNativeHandler( module_system->RegisterNativeHandler(
"lazy_background_page", "lazy_background_page",
std::make_unique<extensions::LazyBackgroundPageNativeHandler>(context)); std::make_unique<extensions::LazyBackgroundPageNativeHandler>(context));
...@@ -62,9 +55,6 @@ void CastExtensionsDispatcherDelegate::RegisterNativeHandlers( ...@@ -62,9 +55,6 @@ void CastExtensionsDispatcherDelegate::RegisterNativeHandlers(
void CastExtensionsDispatcherDelegate::PopulateSourceMap( void CastExtensionsDispatcherDelegate::PopulateSourceMap(
extensions::ResourceBundleSourceMap* source_map) { extensions::ResourceBundleSourceMap* source_map) {
// Custom bindings. // Custom bindings.
source_map->RegisterSource("automation", IDR_AUTOMATION_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("automationEvent", IDR_AUTOMATION_EVENT_JS);
source_map->RegisterSource("automationNode", IDR_AUTOMATION_NODE_JS);
source_map->RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); source_map->RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS);
} }
......
// 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 CHROMECAST_RENDERER_EXTENSIONS_AUTOMATION_AX_TREE_WRAPPER_H_
#define CHROMECAST_RENDERER_EXTENSIONS_AUTOMATION_AX_TREE_WRAPPER_H_
#include "extensions/common/api/automation.h"
#include "ui/accessibility/ax_event_generator.h"
#include "ui/accessibility/ax_tree.h"
struct ExtensionMsg_AccessibilityEventBundleParams;
namespace extensions {
namespace cast {
class AutomationInternalCustomBindings;
// A class that wraps one AXTree and all of the additional state
// and helper methods needed to use it for the automation API.
class AutomationAXTreeWrapper : public ui::AXTreeObserver {
public:
AutomationAXTreeWrapper(ui::AXTreeID tree_id,
AutomationInternalCustomBindings* owner);
~AutomationAXTreeWrapper() override;
// Returns the AutomationAXTreeWrapper that lists |tree_id| as one of its
// child trees, if any.
static AutomationAXTreeWrapper* GetParentOfTreeId(ui::AXTreeID tree_id);
ui::AXTreeID tree_id() const { return tree_id_; }
ui::AXTree* tree() { return &tree_; }
AutomationInternalCustomBindings* owner() { return owner_; }
// Called by AutomationInternalCustomBindings::OnAccessibilityEvents on
// the AutomationAXTreeWrapper instance for the correct tree corresponding
// to this event. Unserializes the tree update and calls back to
// AutomationInternalCustomBindings to fire any automation events needed.
bool OnAccessibilityEvents(
const ExtensionMsg_AccessibilityEventBundleParams& events,
bool is_active_profile);
// Returns true if this is the desktop tree.
bool IsDesktopTree() const;
private:
// AXTreeObserver overrides.
void OnNodeDataWillChange(ui::AXTree* tree,
const ui::AXNodeData& old_node_data,
const ui::AXNodeData& new_node_data) override;
void OnNodeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override;
void OnAtomicUpdateFinished(ui::AXTree* tree,
bool root_changed,
const std::vector<Change>& changes) override;
// Given an event, return true if the event is handled by
// AXEventGenerator, and false if it's not. Temporary, this will be
// removed with the AXEventGenerator refactoring is complete.
bool IsEventTypeHandledByAXEventGenerator(
extensions::api::automation::EventType) const;
ui::AXTreeID tree_id_;
ui::AXTree tree_;
AutomationInternalCustomBindings* owner_;
std::vector<int> deleted_node_ids_;
std::vector<int> text_changed_node_ids_;
ui::AXEventGenerator event_generator_;
// Tracks whether a tree change event was sent during unserialization. Tree
// changes outside of unserialization do not get reflected here. The value is
// reset after unserialization.
bool did_send_tree_change_during_unserialization_ = false;
DISALLOW_COPY_AND_ASSIGN(AutomationAXTreeWrapper);
};
} // namespace cast
} // namespace extensions
#endif // CHROMECAST_RENDERER_EXTENSIONS_AUTOMATION_AX_TREE_WRAPPER_H_
// 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.
#ifndef CHROMECAST_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_
#define CHROMECAST_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_
#include <map>
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "chromecast/renderer/extensions/automation_ax_tree_wrapper.h"
#include "extensions/common/api/automation.h"
#include "extensions/renderer/object_backed_native_handler.h"
#include "ipc/ipc_message.h"
#include "ui/accessibility/ax_tree.h"
#include "v8/include/v8.h"
struct ExtensionMsg_AccessibilityEventBundleParams;
struct ExtensionMsg_AccessibilityLocationChangeParams;
namespace ui {
struct AXEvent;
}
namespace extensions {
class NativeExtensionBindingsSystem;
} // namespace extensions
namespace extensions {
namespace cast {
class AutomationInternalCustomBindings;
class AutomationMessageFilter;
struct TreeChangeObserver {
int id;
api::automation::TreeChangeObserverFilter filter;
};
// The native component of custom bindings for the chrome.automationInternal
// API.
class AutomationInternalCustomBindings : public ObjectBackedNativeHandler {
public:
AutomationInternalCustomBindings(
ScriptContext* context,
NativeExtensionBindingsSystem* bindings_system);
~AutomationInternalCustomBindings() override;
// ObjectBackedNativeHandler:
void AddRoutes() override;
void OnMessageReceived(const IPC::Message& message);
AutomationAXTreeWrapper* GetAutomationAXTreeWrapperFromTreeID(
ui::AXTreeID tree_id) const;
// Given a tree (|in_out_tree_wrapper|) and a node, returns the parent.
// If |node| is the root of its tree, the return value will be the host
// node of the parent tree and |in_out_tree_wrapper| will be updated to
// point to that parent tree.
ui::AXNode* GetParent(ui::AXNode* node,
AutomationAXTreeWrapper** in_out_tree_wrapper) const;
// Gets the root of a node's child tree and adjusts incoming arguments
// accordingly. Returns false if no adjustments were made.
bool GetRootOfChildTree(ui::AXNode** in_out_node,
AutomationAXTreeWrapper** in_out_tree_wrapper) const;
ui::AXNode* GetNextInTreeOrder(
ui::AXNode* start,
AutomationAXTreeWrapper** in_out_tree_wrapper) const;
ui::AXNode* GetPreviousInTreeOrder(
ui::AXNode* start,
AutomationAXTreeWrapper** in_out_tree_wrapper) const;
ScriptContext* context() const {
return ObjectBackedNativeHandler::context();
}
float GetDeviceScaleFactor() const;
void SendNodesRemovedEvent(ui::AXTree* tree, const std::vector<int>& ids);
bool SendTreeChangeEvent(api::automation::TreeChangeType change_type,
ui::AXTree* tree,
ui::AXNode* node);
void SendAutomationEvent(ui::AXTreeID tree_id,
const gfx::Point& mouse_location,
const ui::AXEvent& event,
api::automation::EventType event_type);
private:
// ObjectBackedNativeHandler overrides:
void Invalidate() override;
// Returns whether this extension has the "interact" permission set (either
// explicitly or implicitly after manifest parsing).
void IsInteractPermitted(const v8::FunctionCallbackInfo<v8::Value>& args);
// Returns an object with bindings that will be added to the
// chrome.automation namespace.
void GetSchemaAdditions(const v8::FunctionCallbackInfo<v8::Value>& args);
// This is called by automation_internal_custom_bindings.js to indicate
// that an API was called that needs access to accessibility trees. This
// enables the MessageFilter that allows us to listen to accessibility
// events forwarded to this process.
void StartCachingAccessibilityTrees(
const v8::FunctionCallbackInfo<v8::Value>& args);
// Called when an accessibility tree is destroyed and needs to be
// removed from our cache.
// Args: string ax_tree_id
void DestroyAccessibilityTree(
const v8::FunctionCallbackInfo<v8::Value>& args);
void AddTreeChangeObserver(const v8::FunctionCallbackInfo<v8::Value>& args);
void RemoveTreeChangeObserver(
const v8::FunctionCallbackInfo<v8::Value>& args);
void GetFocus(const v8::FunctionCallbackInfo<v8::Value>& args);
// Given an initial AutomationAXTreeWrapper, return the
// AutomationAXTreeWrapper and node of the focused node within this tree or a
// focused descendant tree.
bool GetFocusInternal(AutomationAXTreeWrapper* top_tree,
AutomationAXTreeWrapper** out_tree,
ui::AXNode** out_node);
void RouteTreeIDFunction(
const std::string& name,
void (*callback)(v8::Isolate* isolate,
v8::ReturnValue<v8::Value> result,
AutomationAXTreeWrapper* tree_wrapper));
void RouteNodeIDFunction(
const std::string& name,
std::function<void(v8::Isolate* isolate,
v8::ReturnValue<v8::Value> result,
AutomationAXTreeWrapper* tree_wrapper,
ui::AXNode* node)> callback);
void RouteNodeIDPlusAttributeFunction(
const std::string& name,
void (*callback)(v8::Isolate* isolate,
v8::ReturnValue<v8::Value> result,
ui::AXTree* tree,
ui::AXNode* node,
const std::string& attribute_name));
void RouteNodeIDPlusRangeFunction(
const std::string& name,
void (*callback)(v8::Isolate* isolate,
v8::ReturnValue<v8::Value> result,
AutomationAXTreeWrapper* tree_wrapper,
ui::AXNode* node,
int start,
int end));
void RouteNodeIDPlusStringBoolFunction(
const std::string& name,
std::function<void(v8::Isolate* isolate,
v8::ReturnValue<v8::Value> result,
AutomationAXTreeWrapper* tree_wrapper,
ui::AXNode* node,
const std::string& strVal,
bool boolVal)> callback);
void RouteNodeIDPlusDimensionsFunction(
const std::string& name,
void (*callback)(v8::Isolate* isolate,
v8::ReturnValue<v8::Value> result,
AutomationAXTreeWrapper* tree_wrapper,
ui::AXNode* node,
int start,
int end,
int width,
int height));
//
// Access the cached accessibility trees and properties of their nodes.
//
// Args: string ax_tree_id, int node_id, Returns: int child_id.
void GetChildIDAtIndex(const v8::FunctionCallbackInfo<v8::Value>& args);
// Args: string ax_tree_id, int node_id
// Returns: JS object with a map from html attribute key to value.
void GetHtmlAttributes(const v8::FunctionCallbackInfo<v8::Value>& args);
// Args: string ax_tree_id, int node_id
// Returns: JS object with a string key for each state flag that's set.
void GetState(const v8::FunctionCallbackInfo<v8::Value>& args);
//
// Helper functions.
//
// Handle accessibility events from the browser process.
void OnAccessibilityEvents(
const ExtensionMsg_AccessibilityEventBundleParams& events,
bool is_active_profile);
void OnAccessibilityLocationChange(
const ExtensionMsg_AccessibilityLocationChangeParams& params);
void UpdateOverallTreeChangeObserverFilter();
void SendChildTreeIDEvent(ui::AXTreeID child_tree_id);
std::map<ui::AXTreeID, std::unique_ptr<AutomationAXTreeWrapper>>
tree_id_to_tree_wrapper_map_;
std::map<ui::AXTree*, AutomationAXTreeWrapper*> axtree_to_tree_wrapper_map_;
scoped_refptr<AutomationMessageFilter> message_filter_;
bool is_active_profile_;
std::vector<TreeChangeObserver> tree_change_observers_;
// A bit-map of api::automation::TreeChangeObserverFilter.
int tree_change_observer_overall_filter_;
NativeExtensionBindingsSystem* bindings_system_;
bool should_ignore_context_;
DISALLOW_COPY_AND_ASSIGN(AutomationInternalCustomBindings);
};
} // namespace cast
} // namespace extensions
#endif // CHROMECAST_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_
// 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 utils = require('utils');
function AutomationEventImpl(type, target, eventFrom) {
this.propagationStopped = false;
this.type = type;
this.target = target;
this.eventPhase = Event.NONE;
this.eventFrom = eventFrom;
}
AutomationEventImpl.prototype = {
__proto__: null,
stopPropagation: function() {
this.propagationStopped = true;
},
};
function AutomationEvent() {
privates(AutomationEvent).constructPrivate(this, arguments);
}
utils.expose(AutomationEvent, AutomationEventImpl, {
functions: [
'stopPropagation',
],
readonly: [
'type',
'target',
'eventPhase',
'eventFrom',
],
});
exports.$set('AutomationEvent', AutomationEvent);
...@@ -9,9 +9,6 @@ ...@@ -9,9 +9,6 @@
<release seq="1"> <release seq="1">
<includes> <includes>
<!-- Custom bindings for extension APIs. --> <!-- Custom bindings for extension APIs. -->
<include name="IDR_AUTOMATION_CUSTOM_BINDINGS_JS" file="extensions\automation_custom_bindings.js" type="BINDATA" />
<include name="IDR_AUTOMATION_EVENT_JS" file="extensions\automation\automation_event.js" type="BINDATA" />
<include name="IDR_AUTOMATION_NODE_JS" file="extensions\automation\automation_node.js" type="BINDATA" />
<include name="IDR_TTS_CUSTOM_BINDINGS_JS" file="extensions\tts_custom_bindings.js" type="BINDATA" /> <include name="IDR_TTS_CUSTOM_BINDINGS_JS" file="extensions\tts_custom_bindings.js" type="BINDATA" />
</includes> </includes>
</release> </release>
......
...@@ -14,6 +14,10 @@ jumbo_source_set("renderer") { ...@@ -14,6 +14,10 @@ jumbo_source_set("renderer") {
"activity_log_converter_strategy.h", "activity_log_converter_strategy.h",
"api/automation/automation_api_helper.cc", "api/automation/automation_api_helper.cc",
"api/automation/automation_api_helper.h", "api/automation/automation_api_helper.h",
"api/automation/automation_ax_tree_wrapper.cc",
"api/automation/automation_ax_tree_wrapper.h",
"api/automation/automation_internal_custom_bindings.cc",
"api/automation/automation_internal_custom_bindings.h",
"api/display_source/display_source_session.cc", "api/display_source/display_source_session.cc",
"api/display_source/display_source_session.h", "api/display_source/display_source_session.h",
"api_activity_logger.cc", "api_activity_logger.cc",
...@@ -180,6 +184,7 @@ jumbo_source_set("renderer") { ...@@ -180,6 +184,7 @@ jumbo_source_set("renderer") {
"resource_bundle_source_map.h", "resource_bundle_source_map.h",
"resources/app_runtime_custom_bindings.js", "resources/app_runtime_custom_bindings.js",
"resources/app_window_custom_bindings.js", "resources/app_window_custom_bindings.js",
"resources/automation/automation_custom_bindings.js",
"resources/context_menus_custom_bindings.js", "resources/context_menus_custom_bindings.js",
"resources/declarative_webrequest_custom_bindings.js", "resources/declarative_webrequest_custom_bindings.js",
"resources/entry_id_manager.js", "resources/entry_id_manager.js",
......
include_rules = [ include_rules = [
"+components/translate/core/language_detection", "+components/translate/core/language_detection",
"+content/app/strings/grit",
"+content/public/child", "+content/public/child",
"+content/public/renderer", "+content/public/renderer",
...@@ -22,6 +23,8 @@ include_rules = [ ...@@ -22,6 +23,8 @@ include_rules = [
"+tools/json_schema_compiler", "+tools/json_schema_compiler",
"+ui/accessibility",
"-v8", "-v8",
"+v8/include", "+v8/include",
......
aboxhall@chromium.org file://ui/accessibility/OWNERS
dtseng@chromium.org
# COMPONENT: UI>Accessibility # COMPONENT: UI>Accessibility
...@@ -3,9 +3,8 @@ ...@@ -3,9 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "chrome/common/extensions/chrome_extension_messages.h"
#include "chrome/renderer/extensions/automation_internal_custom_bindings.h"
#include "extensions/common/extension_messages.h" #include "extensions/common/extension_messages.h"
#include "extensions/renderer/api/automation/automation_internal_custom_bindings.h"
#include "ui/accessibility/ax_language_info.h" #include "ui/accessibility/ax_language_info.h"
#include "ui/accessibility/ax_node.h" #include "ui/accessibility/ax_node.h"
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_RENDERER_EXTENSIONS_AUTOMATION_AX_TREE_WRAPPER_H_ #ifndef EXTENSIONS_RENDERER_API_AUTOMATION_AUTOMATION_AX_TREE_WRAPPER_H_
#define CHROME_RENDERER_EXTENSIONS_AUTOMATION_AX_TREE_WRAPPER_H_ #define EXTENSIONS_RENDERER_API_AUTOMATION_AUTOMATION_AX_TREE_WRAPPER_H_
#include "extensions/common/api/automation.h" #include "extensions/common/api/automation.h"
#include "ui/accessibility/ax_event_generator.h" #include "ui/accessibility/ax_event_generator.h"
...@@ -81,4 +81,4 @@ class AutomationAXTreeWrapper : public ui::AXTreeObserver { ...@@ -81,4 +81,4 @@ class AutomationAXTreeWrapper : public ui::AXTreeObserver {
} // namespace extensions } // namespace extensions
#endif // CHROME_RENDERER_EXTENSIONS_AUTOMATION_AX_TREE_WRAPPER_H_ #endif // EXTENSIONS_RENDERER_API_AUTOMATION_AUTOMATION_AX_TREE_WRAPPER_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/renderer/extensions/automation_internal_custom_bindings.h" #include "extensions/renderer/api/automation/automation_internal_custom_bindings.h"
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/common/extensions/chrome_extension_messages.h"
#include "content/app/strings/grit/content_strings.h" #include "content/app/strings/grit/content_strings.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_thread.h"
...@@ -1243,16 +1242,12 @@ void AutomationInternalCustomBindings::AddRoutes() { ...@@ -1243,16 +1242,12 @@ void AutomationInternalCustomBindings::AddRoutes() {
AutomationAXTreeWrapper* tree_wrapper, ui::AXNode* node, AutomationAXTreeWrapper* tree_wrapper, ui::AXNode* node,
const std::string& search_str, bool backward) { const std::string& search_str, bool backward) {
base::string16 search_str_16 = base::UTF8ToUTF16(search_str); base::string16 search_str_16 = base::UTF8ToUTF16(search_str);
auto func = auto next =
backward ? &AutomationInternalCustomBindings::GetPreviousInTreeOrder backward ? &AutomationInternalCustomBindings::GetPreviousInTreeOrder
: &AutomationInternalCustomBindings::GetNextInTreeOrder; : &AutomationInternalCustomBindings::GetNextInTreeOrder;
std::function<ui::AXNode*(ui::AXNode*, AutomationAXTreeWrapper**)> next(
std::bind(func, this, std::placeholders::_1,
std::placeholders::_2));
AutomationAXTreeWrapper** target_tree_wrapper = &tree_wrapper; AutomationAXTreeWrapper** target_tree_wrapper = &tree_wrapper;
while (true) { while (true) {
node = next(node, target_tree_wrapper); node = (this->*next)(node, target_tree_wrapper);
// We explicitly disallow searches in the desktop tree. // We explicitly disallow searches in the desktop tree.
if ((*target_tree_wrapper)->IsDesktopTree()) if ((*target_tree_wrapper)->IsDesktopTree())
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_ #ifndef EXTENSIONS_RENDERER_API_AUTOMATION_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_
#define CHROME_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_ #define EXTENSIONS_RENDERER_API_AUTOMATION_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_
#include <map> #include <map>
#include <string> #include <string>
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/macros.h" #include "base/macros.h"
#include "chrome/renderer/extensions/automation_ax_tree_wrapper.h"
#include "extensions/common/api/automation.h" #include "extensions/common/api/automation.h"
#include "extensions/renderer/api/automation/automation_ax_tree_wrapper.h"
#include "extensions/renderer/object_backed_native_handler.h" #include "extensions/renderer/object_backed_native_handler.h"
#include "ipc/ipc_message.h" #include "ipc/ipc_message.h"
#include "ui/accessibility/ax_tree.h" #include "ui/accessibility/ax_tree.h"
...@@ -221,4 +221,4 @@ class AutomationInternalCustomBindings : public ObjectBackedNativeHandler { ...@@ -221,4 +221,4 @@ class AutomationInternalCustomBindings : public ObjectBackedNativeHandler {
} // namespace extensions } // namespace extensions
#endif // CHROME_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_ #endif // EXTENSIONS_RENDERER_API_AUTOMATION_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "extensions/common/switches.h" #include "extensions/common/switches.h"
#include "extensions/common/view_type.h" #include "extensions/common/view_type.h"
#include "extensions/grit/extensions_renderer_resources.h" #include "extensions/grit/extensions_renderer_resources.h"
#include "extensions/renderer/api/automation/automation_internal_custom_bindings.h"
#include "extensions/renderer/api_activity_logger.h" #include "extensions/renderer/api_activity_logger.h"
#include "extensions/renderer/api_definitions_natives.h" #include "extensions/renderer/api_definitions_natives.h"
#include "extensions/renderer/app_window_custom_bindings.h" #include "extensions/renderer/app_window_custom_bindings.h"
...@@ -688,6 +689,9 @@ std::vector<Dispatcher::JsResourceInfo> Dispatcher::GetJsResources() { ...@@ -688,6 +689,9 @@ std::vector<Dispatcher::JsResourceInfo> Dispatcher::GetJsResources() {
{"extensions/common/mojo/keep_alive.mojom", IDR_KEEP_ALIVE_MOJOM_JS}, {"extensions/common/mojo/keep_alive.mojom", IDR_KEEP_ALIVE_MOJOM_JS},
// Custom bindings. // Custom bindings.
{"automation", IDR_AUTOMATION_CUSTOM_BINDINGS_JS},
{"automationEvent", IDR_AUTOMATION_EVENT_JS},
{"automationNode", IDR_AUTOMATION_NODE_JS},
{"app.runtime", IDR_APP_RUNTIME_CUSTOM_BINDINGS_JS}, {"app.runtime", IDR_APP_RUNTIME_CUSTOM_BINDINGS_JS},
{"app.window", IDR_APP_WINDOW_CUSTOM_BINDINGS_JS}, {"app.window", IDR_APP_WINDOW_CUSTOM_BINDINGS_JS},
{"declarativeWebRequest", IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS}, {"declarativeWebRequest", IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS},
...@@ -784,6 +788,10 @@ void Dispatcher::RegisterNativeHandlers( ...@@ -784,6 +788,10 @@ void Dispatcher::RegisterNativeHandlers(
module_system->RegisterNativeHandler( module_system->RegisterNativeHandler(
"display_source", "display_source",
std::make_unique<DisplaySourceCustomBindings>(context, bindings_system)); std::make_unique<DisplaySourceCustomBindings>(context, bindings_system));
module_system->RegisterNativeHandler(
"automationInternal",
std::make_unique<extensions::AutomationInternalCustomBindings>(
context, bindings_system));
} }
bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) { bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) {
......
file://ui/accessibility/OWNERS
# COMPONENT: UI>Accessibility
...@@ -55,6 +55,9 @@ ...@@ -55,6 +55,9 @@
<include name="IDR_WEB_VIEW_ELEMENT_JS" file="guest_view/web_view/web_view_element.js" type="BINDATA" /> <include name="IDR_WEB_VIEW_ELEMENT_JS" file="guest_view/web_view/web_view_element.js" type="BINDATA" />
<!-- Custom bindings for APIs. --> <!-- Custom bindings for APIs. -->
<include name="IDR_AUTOMATION_CUSTOM_BINDINGS_JS" file="automation\automation_custom_bindings.js" type="BINDATA" />
<include name="IDR_AUTOMATION_EVENT_JS" file="automation\automation_event.js" type="BINDATA" />
<include name="IDR_AUTOMATION_NODE_JS" file="automation\automation_node.js" type="BINDATA" />
<include name="IDR_APP_RUNTIME_CUSTOM_BINDINGS_JS" file="app_runtime_custom_bindings.js" type="BINDATA" /> <include name="IDR_APP_RUNTIME_CUSTOM_BINDINGS_JS" file="app_runtime_custom_bindings.js" type="BINDATA" />
<include name="IDR_APP_WINDOW_CUSTOM_BINDINGS_JS" file="app_window_custom_bindings.js" type="BINDATA" /> <include name="IDR_APP_WINDOW_CUSTOM_BINDINGS_JS" file="app_window_custom_bindings.js" type="BINDATA" />
<include name="IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS" file="context_menus_custom_bindings.js" type="BINDATA" /> <include name="IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS" file="context_menus_custom_bindings.js" type="BINDATA" />
......
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