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

Side by Side Diff: ui/views/accessibility/ax_view_obj_wrapper.cc

Issue 667713006: Implement automatic load of composed/embedded automation trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Fix UAF Created 6 years, 1 month 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 "ui/views/accessibility/ax_view_obj_wrapper.h" 5 #include "ui/views/accessibility/ax_view_obj_wrapper.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/accessibility/ax_node_data.h" 8 #include "ui/accessibility/ax_node_data.h"
9 #include "ui/accessibility/ax_view_state.h" 9 #include "ui/accessibility/ax_view_state.h"
10 #include "ui/views/accessibility/ax_aura_obj_cache.h" 10 #include "ui/views/accessibility/ax_aura_obj_cache.h"
(...skipping 24 matching lines...) Expand all
35 for (int i = 0; i < view_->child_count(); ++i) { 35 for (int i = 0; i < view_->child_count(); ++i) {
36 AXAuraObjWrapper* child = 36 AXAuraObjWrapper* child =
37 AXAuraObjCache::GetInstance()->GetOrCreate(view_->child_at(i)); 37 AXAuraObjCache::GetInstance()->GetOrCreate(view_->child_at(i));
38 out_children->push_back(child); 38 out_children->push_back(child);
39 } 39 }
40 } 40 }
41 41
42 void AXViewObjWrapper::Serialize(ui::AXNodeData* out_node_data) { 42 void AXViewObjWrapper::Serialize(ui::AXNodeData* out_node_data) {
43 ui::AXViewState view_data; 43 ui::AXViewState view_data;
44 view_->GetAccessibleState(&view_data); 44 view_->GetAccessibleState(&view_data);
45
45 out_node_data->id = GetID(); 46 out_node_data->id = GetID();
46 out_node_data->role = view_data.role; 47 out_node_data->role = view_data.role;
47 48
48 out_node_data->state = view_data.state(); 49 out_node_data->state = view_data.state();
49 if (view_->HasFocus()) 50 if (view_->HasFocus())
50 out_node_data->state |= 1 << ui::AX_STATE_FOCUSED; 51 out_node_data->state |= 1 << ui::AX_STATE_FOCUSED;
51 if (view_->IsFocusable()) 52 if (view_->IsFocusable())
52 out_node_data->state |= 1 << ui::AX_STATE_FOCUSABLE; 53 out_node_data->state |= 1 << ui::AX_STATE_FOCUSABLE;
53 54
54 out_node_data->location = view_->GetBoundsInScreen(); 55 out_node_data->location = view_->GetBoundsInScreen();
55 56
56 out_node_data->AddStringAttribute( 57 out_node_data->AddStringAttribute(
57 ui::AX_ATTR_NAME, base::UTF16ToUTF8(view_data.name)); 58 ui::AX_ATTR_NAME, base::UTF16ToUTF8(view_data.name));
58 out_node_data->AddStringAttribute( 59 out_node_data->AddStringAttribute(
59 ui::AX_ATTR_VALUE, base::UTF16ToUTF8(view_data.value)); 60 ui::AX_ATTR_VALUE, base::UTF16ToUTF8(view_data.value));
60 61
61 out_node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, 62 if (view_data.selection_start > -1 && view_data.selection_end > -1) {
62 view_data.selection_start); 63 out_node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START,
63 out_node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, 64 view_data.selection_start);
64 view_data.selection_end); 65
66 out_node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END,
67 view_data.selection_end);
68 }
65 } 69 }
66 70
67 int32 AXViewObjWrapper::GetID() { 71 int32 AXViewObjWrapper::GetID() {
68 return AXAuraObjCache::GetInstance()->GetID(view_); 72 return AXAuraObjCache::GetInstance()->GetID(view_);
69 } 73 }
70 74
71 void AXViewObjWrapper::DoDefault() { 75 void AXViewObjWrapper::DoDefault() {
72 gfx::Rect rect = view_->GetBoundsInScreen(); 76 gfx::Rect rect = view_->GetBoundsInScreen();
73 gfx::Point center = rect.CenterPoint(); 77 gfx::Point center = rect.CenterPoint();
74 view_->OnMousePressed(ui::MouseEvent(ui::ET_MOUSE_PRESSED, center, center, 78 view_->OnMousePressed(ui::MouseEvent(ui::ET_MOUSE_PRESSED, center, center,
75 ui::EF_LEFT_MOUSE_BUTTON, 79 ui::EF_LEFT_MOUSE_BUTTON,
76 ui::EF_LEFT_MOUSE_BUTTON)); 80 ui::EF_LEFT_MOUSE_BUTTON));
77 } 81 }
78 82
79 void AXViewObjWrapper::Focus() { 83 void AXViewObjWrapper::Focus() {
80 view_->RequestFocus(); 84 view_->RequestFocus();
81 } 85 }
82 86
83 void AXViewObjWrapper::MakeVisible() { 87 void AXViewObjWrapper::MakeVisible() {
84 // TODO(dtseng): Implement. 88 // TODO(dtseng): Implement.
85 } 89 }
86 90
87 void AXViewObjWrapper::SetSelection(int32 start, int32 end) { 91 void AXViewObjWrapper::SetSelection(int32 start, int32 end) {
88 // TODO(dtseng): Implement. 92 // TODO(dtseng): Implement.
89 } 93 }
90 94
91 } // namespace views 95 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/accessibility/ax_view_obj_wrapper.h ('k') | ui/views/accessibility/native_view_accessibility_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698