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

Side by Side Diff: ash/common/system/tray/tray_utils.cc

Issue 2477463003: Replace ui::AXViewState with AXNodeData and AXActionData (Closed)
Patch Set: Fix test Created 4 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
« no previous file with comments | « ash/common/system/tray/tray_item_more.cc ('k') | ash/common/system/user/button_from_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/common/system/tray/tray_utils.h" 5 #include "ash/common/system/tray/tray_utils.h"
6 6
7 #include "ash/common/ash_constants.h" 7 #include "ash/common/ash_constants.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/shelf/wm_shelf_util.h" 10 #include "ash/common/shelf/wm_shelf_util.h"
11 #include "ash/common/system/tray/tray_constants.h" 11 #include "ash/common/system/tray/tray_constants.h"
12 #include "ash/common/system/tray/tray_item_view.h" 12 #include "ash/common/system/tray/tray_item_view.h"
13 #include "ash/common/system/tray/tray_popup_label_button_border.h" 13 #include "ash/common/system/tray/tray_popup_label_button_border.h"
14 #include "ash/common/wm_shell.h" 14 #include "ash/common/wm_shell.h"
15 #include "ui/accessibility/ax_view_state.h" 15 #include "ui/accessibility/ax_node_data.h"
16 #include "ui/gfx/font_list.h" 16 #include "ui/gfx/font_list.h"
17 #include "ui/gfx/geometry/vector2d.h" 17 #include "ui/gfx/geometry/vector2d.h"
18 #include "ui/views/border.h" 18 #include "ui/views/border.h"
19 #include "ui/views/controls/button/label_button.h" 19 #include "ui/views/controls/button/label_button.h"
20 #include "ui/views/controls/button/md_text_button.h" 20 #include "ui/views/controls/button/md_text_button.h"
21 #include "ui/views/controls/label.h" 21 #include "ui/views/controls/label.h"
22 #include "ui/views/controls/separator.h" 22 #include "ui/views/controls/separator.h"
23 23
24 namespace ash { 24 namespace ash {
25 25
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 2); 99 2);
100 tray_view->SetBorder(views::Border::CreateEmptyBorder( 100 tray_view->SetBorder(views::Border::CreateEmptyBorder(
101 kTrayLabelItemVerticalPaddingVerticalAlignment, horizontal_padding, 101 kTrayLabelItemVerticalPaddingVerticalAlignment, horizontal_padding,
102 kTrayLabelItemVerticalPaddingVerticalAlignment, horizontal_padding)); 102 kTrayLabelItemVerticalPaddingVerticalAlignment, horizontal_padding));
103 } 103 }
104 } 104 }
105 105
106 void GetAccessibleLabelFromDescendantViews( 106 void GetAccessibleLabelFromDescendantViews(
107 views::View* view, 107 views::View* view,
108 std::vector<base::string16>& out_labels) { 108 std::vector<base::string16>& out_labels) {
109 ui::AXViewState temp_state; 109 ui::AXNodeData temp_node_data;
110 view->GetAccessibleState(&temp_state); 110 view->GetAccessibleNodeData(&temp_node_data);
111 if (!temp_state.name.empty()) 111 if (!temp_node_data.GetStringAttribute(ui::AX_ATTR_NAME).empty())
112 out_labels.push_back(temp_state.name); 112 out_labels.push_back(temp_node_data.GetString16Attribute(ui::AX_ATTR_NAME));
113 113
114 // Do not descend into static text labels which may compute their own labels 114 // Do not descend into static text labels which may compute their own labels
115 // recursively. 115 // recursively.
116 if (temp_state.role == ui::AX_ROLE_STATIC_TEXT) 116 if (temp_node_data.role == ui::AX_ROLE_STATIC_TEXT)
117 return; 117 return;
118 118
119 for (int i = 0; i < view->child_count(); ++i) 119 for (int i = 0; i < view->child_count(); ++i)
120 GetAccessibleLabelFromDescendantViews(view->child_at(i), out_labels); 120 GetAccessibleLabelFromDescendantViews(view->child_at(i), out_labels);
121 } 121 }
122 122
123 bool CanOpenWebUISettings(LoginStatus status) { 123 bool CanOpenWebUISettings(LoginStatus status) {
124 // TODO(tdanderson): Consider moving this into WmShell, or introduce a 124 // TODO(tdanderson): Consider moving this into WmShell, or introduce a
125 // CanShowSettings() method in each delegate type that has a 125 // CanShowSettings() method in each delegate type that has a
126 // ShowSettings() method. 126 // ShowSettings() method.
127 return status != LoginStatus::NOT_LOGGED_IN && 127 return status != LoginStatus::NOT_LOGGED_IN &&
128 status != LoginStatus::LOCKED && 128 status != LoginStatus::LOCKED &&
129 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); 129 !WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen();
130 } 130 }
131 131
132 views::Separator* CreateVerticalSeparator() { 132 views::Separator* CreateVerticalSeparator() {
133 views::Separator* separator = 133 views::Separator* separator =
134 new views::Separator(views::Separator::HORIZONTAL); 134 new views::Separator(views::Separator::HORIZONTAL);
135 separator->SetPreferredSize(kHorizontalSeparatorHeight); 135 separator->SetPreferredSize(kHorizontalSeparatorHeight);
136 separator->SetColor(kHorizontalSeparatorColor); 136 separator->SetColor(kHorizontalSeparatorColor);
137 return separator; 137 return separator;
138 } 138 }
139 139
140 } // namespace ash 140 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/tray_item_more.cc ('k') | ash/common/system/user/button_from_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698