OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "extensions/renderer/object_backed_native_handler.h" | 9 #include "extensions/renderer/object_backed_native_handler.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
11 #include "ui/accessibility/ax_tree.h" | 11 #include "ui/accessibility/ax_tree.h" |
12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
13 | 13 |
14 struct ExtensionMsg_AccessibilityEventParams; | 14 struct ExtensionMsg_AccessibilityEventParams; |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 class AutomationMessageFilter; | 18 class AutomationMessageFilter; |
19 | 19 |
20 struct TreeCache { | |
21 TreeCache(); | |
22 ~TreeCache(); | |
23 | |
24 int tab_id; | |
25 int tree_id; | |
26 | |
27 gfx::Vector2d location_offset; | |
28 ui::AXTree tree; | |
29 }; | |
30 | |
20 // The native component of custom bindings for the chrome.automationInternal | 31 // The native component of custom bindings for the chrome.automationInternal |
21 // API. | 32 // API. |
22 class AutomationInternalCustomBindings : public ObjectBackedNativeHandler { | 33 class AutomationInternalCustomBindings : public ObjectBackedNativeHandler, |
34 public ui::AXTreeDelegate { | |
23 public: | 35 public: |
24 explicit AutomationInternalCustomBindings(ScriptContext* context); | 36 explicit AutomationInternalCustomBindings(ScriptContext* context); |
25 | 37 |
26 ~AutomationInternalCustomBindings() override; | 38 ~AutomationInternalCustomBindings() override; |
27 | 39 |
28 bool OnMessageReceived(const IPC::Message& message); | 40 bool OnMessageReceived(const IPC::Message& message); |
29 | 41 |
30 private: | 42 private: |
31 // Returns whether this extension has the "interact" permission set (either | 43 // Returns whether this extension has the "interact" permission set (either |
32 // explicitly or implicitly after manifest parsing). | 44 // explicitly or implicitly after manifest parsing). |
33 void IsInteractPermitted(const v8::FunctionCallbackInfo<v8::Value>& args); | 45 void IsInteractPermitted(const v8::FunctionCallbackInfo<v8::Value>& args); |
34 | 46 |
35 // Returns an object with bindings that will be added to the | 47 // Returns an object with bindings that will be added to the |
36 // chrome.automation namespace. | 48 // chrome.automation namespace. |
37 void GetSchemaAdditions(const v8::FunctionCallbackInfo<v8::Value>& args); | 49 void GetSchemaAdditions(const v8::FunctionCallbackInfo<v8::Value>& args); |
38 | 50 |
39 // Get the routing ID for the extension. | 51 // Get the routing ID for the extension. |
40 void GetRoutingID(const v8::FunctionCallbackInfo<v8::Value>& args); | 52 void GetRoutingID(const v8::FunctionCallbackInfo<v8::Value>& args); |
41 | 53 |
54 // | |
David Tseng
2015/06/10 17:48:16
?
aboxhall
2015/06/11 15:05:38
Contentless comment.
Were you going to add more c
dmazzoni
2015/06/11 19:09:12
Done.
| |
55 void DestroyAccessibilityTree( | |
56 const v8::FunctionCallbackInfo<v8::Value>& args); | |
57 | |
58 void GetRootID( | |
59 const v8::FunctionCallbackInfo<v8::Value>& args); | |
60 | |
61 bool GetNodeHelper( | |
aboxhall
2015/06/11 15:05:38
Maybe group these by routed vs local?
dmazzoni
2015/06/11 19:09:12
Done.
| |
62 const v8::FunctionCallbackInfo<v8::Value>& args, | |
63 TreeCache** out_cache, | |
64 ui::AXNode** out_node); | |
65 void SetReturnValueFromBaseValue( | |
66 const v8::FunctionCallbackInfo<v8::Value>& args, | |
67 base::Value* value); | |
68 | |
69 void GetParentID( | |
70 const v8::FunctionCallbackInfo<v8::Value>& args); | |
71 void GetChildCount( | |
72 const v8::FunctionCallbackInfo<v8::Value>& args); | |
73 void GetChildIDAtIndex( | |
74 const v8::FunctionCallbackInfo<v8::Value>& args); | |
75 void GetIndexInParent( | |
76 const v8::FunctionCallbackInfo<v8::Value>& args); | |
77 | |
78 void GetState( | |
79 const v8::FunctionCallbackInfo<v8::Value>& args); | |
80 void GetRole( | |
81 const v8::FunctionCallbackInfo<v8::Value>& args); | |
82 void GetLocation( | |
83 const v8::FunctionCallbackInfo<v8::Value>& args); | |
84 | |
85 bool GetAttributeHelper( | |
86 const v8::FunctionCallbackInfo<v8::Value>& args, | |
87 ui::AXNode** out_node, | |
88 std::string* out_attribute_name); | |
89 | |
90 void GetStringAttribute( | |
91 const v8::FunctionCallbackInfo<v8::Value>& args); | |
92 void GetBoolAttribute( | |
93 const v8::FunctionCallbackInfo<v8::Value>& args); | |
94 void GetIntAttribute( | |
95 const v8::FunctionCallbackInfo<v8::Value>& args); | |
96 void GetFloatAttribute( | |
97 const v8::FunctionCallbackInfo<v8::Value>& args); | |
98 void GetIntListAttribute( | |
99 const v8::FunctionCallbackInfo<v8::Value>& args); | |
100 | |
42 // Handle accessibility events from the browser process. | 101 // Handle accessibility events from the browser process. |
43 void OnAccessibilityEvent( | 102 void OnAccessibilityEvent( |
44 const ExtensionMsg_AccessibilityEventParams& params); | 103 const ExtensionMsg_AccessibilityEventParams& params); |
45 | 104 |
105 // AXTreeDelegate implementation. | |
106 void OnNodeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; | |
107 void OnSubtreeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; | |
108 void OnNodeCreated(ui::AXTree* tree, ui::AXNode* node) override; | |
109 void OnNodeChanged(ui::AXTree* tree, ui::AXNode* node) override; | |
110 void OnAtomicUpdateFinished(ui::AXTree* tree, | |
111 bool root_changed, | |
112 const std::vector<Change>& changes) override; | |
113 | |
114 void SendTreeChangeEvent(const char *change_type, | |
115 ui::AXTree* tree, | |
116 ui::AXNode* node); | |
117 | |
118 base::hash_map<int, TreeCache*> tree_id_to_tree_cache_map_; | |
119 base::hash_map<ui::AXTree*, TreeCache*> axtree_to_tree_cache_map_; | |
46 scoped_refptr<AutomationMessageFilter> message_filter_; | 120 scoped_refptr<AutomationMessageFilter> message_filter_; |
47 | 121 |
48 DISALLOW_COPY_AND_ASSIGN(AutomationInternalCustomBindings); | 122 DISALLOW_COPY_AND_ASSIGN(AutomationInternalCustomBindings); |
49 }; | 123 }; |
50 | 124 |
51 } // namespace extensions | 125 } // namespace extensions |
52 | 126 |
53 #endif // CHROME_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_ | 127 #endif // CHROME_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_ |
OLD | NEW |