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

Side by Side Diff: chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.cc

Issue 2873373005: Add custom action support (Closed)
Patch Set: Rebase. Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/browser/chromeos/arc/accessibility/ax_tree_source_arc.h" 5 #include "chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "chrome/browser/extensions/api/automation_internal/automation_event_rou ter.h" 9 #include "chrome/browser/extensions/api/automation_internal/automation_event_rou ter.h"
10 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" 10 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 out_data->AddStringAttribute(ui::AX_ATTR_VALUE, text); 390 out_data->AddStringAttribute(ui::AX_ATTR_VALUE, text);
391 391
392 // Integer properties. 392 // Integer properties.
393 int32_t val; 393 int32_t val;
394 if (GetIntProperty(node, AXIntProperty::TEXT_SELECTION_START, &val) && 394 if (GetIntProperty(node, AXIntProperty::TEXT_SELECTION_START, &val) &&
395 val >= 0) 395 val >= 0)
396 out_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, val); 396 out_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, val);
397 397
398 if (GetIntProperty(node, AXIntProperty::TEXT_SELECTION_END, &val) && val >= 0) 398 if (GetIntProperty(node, AXIntProperty::TEXT_SELECTION_END, &val) && val >= 0)
399 out_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, val); 399 out_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, val);
400
401 // TODO(yawano): Remove this. This is test code for WIP code.
402 std::vector<int32_t> custom_action_ids;
403 custom_action_ids.push_back(1);
404 custom_action_ids.push_back(2);
405 out_data->AddIntListAttribute(ui::AX_ATTR_CUSTOM_ACTION_IDS,
406 custom_action_ids);
407
408 std::vector<std::string> custom_action_descriptions;
409 custom_action_descriptions.push_back(std::string("Test action 1"));
410 custom_action_descriptions.push_back(std::string("Test action 2"));
411 out_data->AddStringListAttribute(ui::AX_ATTR_CUSTOM_ACTION_DESCRIPTIONS,
412 custom_action_descriptions);
400 } 413 }
401 414
402 void AXTreeSourceArc::PerformAction(const ui::AXActionData& data) { 415 void AXTreeSourceArc::PerformAction(const ui::AXActionData& data) {
403 delegate_->OnAction(data); 416 delegate_->OnAction(data);
404 } 417 }
405 418
406 void AXTreeSourceArc::Reset() { 419 void AXTreeSourceArc::Reset() {
407 tree_map_.clear(); 420 tree_map_.clear();
408 parent_map_.clear(); 421 parent_map_.clear();
409 current_tree_serializer_.reset(new AXTreeArcSerializer(this)); 422 current_tree_serializer_.reset(new AXTreeArcSerializer(this));
410 root_id_ = -1; 423 root_id_ = -1;
411 focused_node_id_ = -1; 424 focused_node_id_ = -1;
412 extensions::AutomationEventRouter* router = 425 extensions::AutomationEventRouter* router =
413 extensions::AutomationEventRouter::GetInstance(); 426 extensions::AutomationEventRouter::GetInstance();
414 if (!router) 427 if (!router)
415 return; 428 return;
416 429
417 router->DispatchTreeDestroyedEvent(tree_id(), nullptr); 430 router->DispatchTreeDestroyedEvent(tree_id(), nullptr);
418 } 431 }
419 432
420 } // namespace arc 433 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/api/automation.idl » ('j') | chrome/common/extensions/api/automation.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698