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

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

Issue 1589623002: Keep track of accessibility focus across windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 4 years, 11 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 "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/aura/window.h"
10 #include "ui/events/event_utils.h" 11 #include "ui/events/event_utils.h"
11 #include "ui/views/accessibility/ax_aura_obj_cache.h" 12 #include "ui/views/accessibility/ax_aura_obj_cache.h"
12 #include "ui/views/view.h" 13 #include "ui/views/view.h"
13 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
14 15
15 namespace views { 16 namespace views {
16 17
17 AXViewObjWrapper::AXViewObjWrapper(View* view) : view_(view) { 18 AXViewObjWrapper::AXViewObjWrapper(View* view) : view_(view) {
18 if (view->GetWidget()) 19 if (view->GetWidget())
19 AXAuraObjCache::GetInstance()->GetOrCreate(view->GetWidget()); 20 AXAuraObjCache::GetInstance()->GetOrCreate(view->GetWidget());
(...skipping 23 matching lines...) Expand all
43 } 44 }
44 45
45 void AXViewObjWrapper::Serialize(ui::AXNodeData* out_node_data) { 46 void AXViewObjWrapper::Serialize(ui::AXNodeData* out_node_data) {
46 ui::AXViewState view_data; 47 ui::AXViewState view_data;
47 view_->GetAccessibleState(&view_data); 48 view_->GetAccessibleState(&view_data);
48 49
49 out_node_data->id = GetID(); 50 out_node_data->id = GetID();
50 out_node_data->role = view_data.role; 51 out_node_data->role = view_data.role;
51 52
52 out_node_data->state = view_data.state(); 53 out_node_data->state = view_data.state();
53 if (view_->HasFocus())
54 out_node_data->state |= 1 << ui::AX_STATE_FOCUSED;
55 if (view_->IsFocusable()) 54 if (view_->IsFocusable())
56 out_node_data->state |= 1 << ui::AX_STATE_FOCUSABLE; 55 out_node_data->state |= 1 << ui::AX_STATE_FOCUSABLE;
57 if (!view_->visible()) 56 if (!view_->visible())
58 out_node_data->state |= 1 << ui::AX_STATE_INVISIBLE; 57 out_node_data->state |= 1 << ui::AX_STATE_INVISIBLE;
59 58
60 out_node_data->location = view_->GetBoundsInScreen(); 59 out_node_data->location = view_->GetBoundsInScreen();
61 60
62 out_node_data->AddStringAttribute( 61 out_node_data->AddStringAttribute(
63 ui::AX_ATTR_NAME, base::UTF16ToUTF8(view_data.name)); 62 ui::AX_ATTR_NAME, base::UTF16ToUTF8(view_data.name));
64 out_node_data->AddStringAttribute( 63 out_node_data->AddStringAttribute(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 void AXViewObjWrapper::SetSelection(int32_t start, int32_t end) { 98 void AXViewObjWrapper::SetSelection(int32_t start, int32_t end) {
100 // TODO(dtseng): Implement. 99 // TODO(dtseng): Implement.
101 } 100 }
102 101
103 void AXViewObjWrapper::ShowContextMenu() { 102 void AXViewObjWrapper::ShowContextMenu() {
104 view_->ShowContextMenu(view_->bounds().CenterPoint(), 103 view_->ShowContextMenu(view_->bounds().CenterPoint(),
105 ui::MENU_SOURCE_KEYBOARD); 104 ui::MENU_SOURCE_KEYBOARD);
106 } 105 }
107 106
108 } // namespace views 107 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698