| 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 "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chrome/common/extensions/api/automation.h" | 10 #include "chrome/common/extensions/api/automation.h" |
| 11 #include "extensions/renderer/object_backed_native_handler.h" | 11 #include "extensions/renderer/object_backed_native_handler.h" |
| 12 #include "ipc/ipc_message.h" | 12 #include "ipc/ipc_message.h" |
| 13 #include "ui/accessibility/ax_tree.h" | 13 #include "ui/accessibility/ax_tree.h" |
| 14 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
| 15 | 15 |
| 16 struct ExtensionMsg_AccessibilityEventParams; | 16 struct ExtensionMsg_AccessibilityEventParams; |
| 17 struct ExtensionMsg_AccessibilityLocationChangeParams; | 17 struct ExtensionMsg_AccessibilityLocationChangeParams; |
| 18 | 18 |
| 19 namespace extensions { | 19 namespace extensions { |
| 20 | 20 |
| 21 class AutomationInternalCustomBindings; | 21 class AutomationInternalCustomBindings; |
| 22 class AutomationMessageFilter; | 22 class AutomationMessageFilter; |
| 23 class ExtensionBindingsSystem; |
| 23 | 24 |
| 24 struct TreeCache { | 25 struct TreeCache { |
| 25 TreeCache(); | 26 TreeCache(); |
| 26 ~TreeCache(); | 27 ~TreeCache(); |
| 27 | 28 |
| 28 int tab_id; | 29 int tab_id; |
| 29 int tree_id; | 30 int tree_id; |
| 30 int parent_node_id_from_parent_tree; | 31 int parent_node_id_from_parent_tree; |
| 31 | 32 |
| 32 gfx::Vector2d location_offset; | 33 gfx::Vector2d location_offset; |
| 33 ui::AXTree tree; | 34 ui::AXTree tree; |
| 34 AutomationInternalCustomBindings* owner; | 35 AutomationInternalCustomBindings* owner; |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 struct TreeChangeObserver { | 38 struct TreeChangeObserver { |
| 38 int id; | 39 int id; |
| 39 api::automation::TreeChangeObserverFilter filter; | 40 api::automation::TreeChangeObserverFilter filter; |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 // The native component of custom bindings for the chrome.automationInternal | 43 // The native component of custom bindings for the chrome.automationInternal |
| 43 // API. | 44 // API. |
| 44 class AutomationInternalCustomBindings : public ObjectBackedNativeHandler, | 45 class AutomationInternalCustomBindings : public ObjectBackedNativeHandler, |
| 45 public ui::AXTreeDelegate { | 46 public ui::AXTreeDelegate { |
| 46 public: | 47 public: |
| 47 explicit AutomationInternalCustomBindings(ScriptContext* context); | 48 AutomationInternalCustomBindings(ScriptContext* context, |
| 49 ExtensionBindingsSystem* bindings_system); |
| 48 | 50 |
| 49 ~AutomationInternalCustomBindings() override; | 51 ~AutomationInternalCustomBindings() override; |
| 50 | 52 |
| 51 void OnMessageReceived(const IPC::Message& message); | 53 void OnMessageReceived(const IPC::Message& message); |
| 52 | 54 |
| 53 TreeCache* GetTreeCacheFromTreeID(int tree_id); | 55 TreeCache* GetTreeCacheFromTreeID(int tree_id); |
| 54 | 56 |
| 55 ui::AXNode* GetParent(ui::AXNode* node, TreeCache** in_out_cache); | 57 ui::AXNode* GetParent(ui::AXNode* node, TreeCache** in_out_cache); |
| 56 | 58 |
| 57 ScriptContext* context() const { | 59 ScriptContext* context() const { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 base::hash_map<int, TreeCache*> tree_id_to_tree_cache_map_; | 178 base::hash_map<int, TreeCache*> tree_id_to_tree_cache_map_; |
| 177 base::hash_map<ui::AXTree*, TreeCache*> axtree_to_tree_cache_map_; | 179 base::hash_map<ui::AXTree*, TreeCache*> axtree_to_tree_cache_map_; |
| 178 scoped_refptr<AutomationMessageFilter> message_filter_; | 180 scoped_refptr<AutomationMessageFilter> message_filter_; |
| 179 bool is_active_profile_; | 181 bool is_active_profile_; |
| 180 std::vector<TreeChangeObserver> tree_change_observers_; | 182 std::vector<TreeChangeObserver> tree_change_observers_; |
| 181 // A bit-map of api::automation::TreeChangeObserverFilter. | 183 // A bit-map of api::automation::TreeChangeObserverFilter. |
| 182 int tree_change_observer_overall_filter_; | 184 int tree_change_observer_overall_filter_; |
| 183 std::vector<int> deleted_node_ids_; | 185 std::vector<int> deleted_node_ids_; |
| 184 std::vector<int> text_changed_node_ids_; | 186 std::vector<int> text_changed_node_ids_; |
| 185 | 187 |
| 188 ExtensionBindingsSystem* bindings_system_; |
| 189 |
| 186 DISALLOW_COPY_AND_ASSIGN(AutomationInternalCustomBindings); | 190 DISALLOW_COPY_AND_ASSIGN(AutomationInternalCustomBindings); |
| 187 }; | 191 }; |
| 188 | 192 |
| 189 } // namespace extensions | 193 } // namespace extensions |
| 190 | 194 |
| 191 #endif // CHROME_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_ | 195 #endif // CHROME_RENDERER_EXTENSIONS_AUTOMATION_INTERNAL_CUSTOM_BINDINGS_H_ |
| OLD | NEW |