Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: chrome/renderer/extensions/automation_internal_custom_bindings.cc

Issue 2640123004: Initial support for native accessibility in ARC (Closed)
Patch Set: Experimental changes Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/renderer/extensions/automation_internal_custom_bindings.h" 5 #include "chrome/renderer/extensions/automation_internal_custom_bindings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } 824 }
825 825
826 void AutomationInternalCustomBindings::DestroyAccessibilityTree( 826 void AutomationInternalCustomBindings::DestroyAccessibilityTree(
827 const v8::FunctionCallbackInfo<v8::Value>& args) { 827 const v8::FunctionCallbackInfo<v8::Value>& args) {
828 if (args.Length() != 1 || !args[0]->IsNumber()) { 828 if (args.Length() != 1 || !args[0]->IsNumber()) {
829 ThrowInvalidArgumentsException(this); 829 ThrowInvalidArgumentsException(this);
830 return; 830 return;
831 } 831 }
832 832
833 int tree_id = args[0]->Int32Value(); 833 int tree_id = args[0]->Int32Value();
834 LOG(ERROR) << "tree destroyed!" << tree_id;
834 auto iter = tree_id_to_tree_cache_map_.find(tree_id); 835 auto iter = tree_id_to_tree_cache_map_.find(tree_id);
835 if (iter == tree_id_to_tree_cache_map_.end()) 836 if (iter == tree_id_to_tree_cache_map_.end())
836 return; 837 return;
837 838
838 TreeCache* cache = iter->second; 839 TreeCache* cache = iter->second;
839 tree_id_to_tree_cache_map_.erase(tree_id); 840 tree_id_to_tree_cache_map_.erase(tree_id);
840 axtree_to_tree_cache_map_.erase(&cache->tree); 841 axtree_to_tree_cache_map_.erase(&cache->tree);
841 delete cache; 842 delete cache;
842 } 843 }
843 844
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 args.GetReturnValue().Set(v8::Integer::New(GetIsolate(), child_id)); 1131 args.GetReturnValue().Set(v8::Integer::New(GetIsolate(), child_id));
1131 } 1132 }
1132 1133
1133 // 1134 //
1134 // Handle accessibility events from the browser process. 1135 // Handle accessibility events from the browser process.
1135 // 1136 //
1136 1137
1137 void AutomationInternalCustomBindings::OnAccessibilityEvent( 1138 void AutomationInternalCustomBindings::OnAccessibilityEvent(
1138 const ExtensionMsg_AccessibilityEventParams& params, 1139 const ExtensionMsg_AccessibilityEventParams& params,
1139 bool is_active_profile) { 1140 bool is_active_profile) {
1141 LOG(ERROR) << "Event!" << params.event_type << " "
1142 << params.update.ToString();
1140 is_active_profile_ = is_active_profile; 1143 is_active_profile_ = is_active_profile;
1141 int tree_id = params.tree_id; 1144 int tree_id = params.tree_id;
1142 TreeCache* cache; 1145 TreeCache* cache;
1143 auto iter = tree_id_to_tree_cache_map_.find(tree_id); 1146 auto iter = tree_id_to_tree_cache_map_.find(tree_id);
1144 if (iter == tree_id_to_tree_cache_map_.end()) { 1147 if (iter == tree_id_to_tree_cache_map_.end()) {
1145 cache = new TreeCache(); 1148 cache = new TreeCache();
1146 cache->tab_id = -1; 1149 cache->tab_id = -1;
1147 cache->tree_id = params.tree_id; 1150 cache->tree_id = params.tree_id;
1148 cache->parent_node_id_from_parent_tree = -1; 1151 cache->parent_node_id_from_parent_tree = -1;
1149 cache->tree.SetDelegate(this); 1152 cache->tree.SetDelegate(this);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 v8::Local<v8::Array> args(v8::Array::New(GetIsolate(), 2U)); 1418 v8::Local<v8::Array> args(v8::Array::New(GetIsolate(), 2U));
1416 args->Set(0U, v8::Integer::New(GetIsolate(), tree_id)); 1419 args->Set(0U, v8::Integer::New(GetIsolate(), tree_id));
1417 v8::Local<v8::Array> nodes(v8::Array::New(GetIsolate(), ids.size())); 1420 v8::Local<v8::Array> nodes(v8::Array::New(GetIsolate(), ids.size()));
1418 args->Set(1U, nodes); 1421 args->Set(1U, nodes);
1419 for (size_t i = 0; i < ids.size(); ++i) 1422 for (size_t i = 0; i < ids.size(); ++i)
1420 nodes->Set(i, v8::Integer::New(GetIsolate(), ids[i])); 1423 nodes->Set(i, v8::Integer::New(GetIsolate(), ids[i]));
1421 context()->DispatchEvent("automationInternal.onNodesRemoved", args); 1424 context()->DispatchEvent("automationInternal.onNodesRemoved", args);
1422 } 1425 }
1423 1426
1424 } // namespace extensions 1427 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698