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

Side by Side Diff: ash/common/system/user/button_from_view.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/user/button_from_view.h ('k') | ash/common/system/user/tray_user_unittest.cc » ('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 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 "ash/common/system/user/button_from_view.h" 5 #include "ash/common/system/user/button_from_view.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/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ash/common/system/tray/tray_utils.h" 10 #include "ash/common/system/tray/tray_utils.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "ui/accessibility/ax_view_state.h" 13 #include "ui/accessibility/ax_node_data.h"
14 #include "ui/gfx/canvas.h" 14 #include "ui/gfx/canvas.h"
15 #include "ui/views/background.h" 15 #include "ui/views/background.h"
16 #include "ui/views/border.h" 16 #include "ui/views/border.h"
17 #include "ui/views/layout/box_layout.h" 17 #include "ui/views/layout/box_layout.h"
18 18
19 namespace ash { 19 namespace ash {
20 20
21 namespace { 21 namespace {
22 22
23 // The border color of the user button. 23 // The border color of the user button.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Adding focus frame. 80 // Adding focus frame.
81 SchedulePaint(); 81 SchedulePaint();
82 } 82 }
83 83
84 void ButtonFromView::OnBlur() { 84 void ButtonFromView::OnBlur() {
85 View::OnBlur(); 85 View::OnBlur();
86 // Removing focus frame. 86 // Removing focus frame.
87 SchedulePaint(); 87 SchedulePaint();
88 } 88 }
89 89
90 void ButtonFromView::GetAccessibleState(ui::AXViewState* state) { 90 void ButtonFromView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
91 state->role = ui::AX_ROLE_BUTTON; 91 node_data->role = ui::AX_ROLE_BUTTON;
92 std::vector<base::string16> labels; 92 std::vector<base::string16> labels;
93 for (int i = 0; i < child_count(); ++i) 93 for (int i = 0; i < child_count(); ++i)
94 GetAccessibleLabelFromDescendantViews(child_at(i), labels); 94 GetAccessibleLabelFromDescendantViews(child_at(i), labels);
95 state->name = base::JoinString(labels, base::ASCIIToUTF16(" ")); 95 node_data->SetName(base::JoinString(labels, base::ASCIIToUTF16(" ")));
96 } 96 }
97 97
98 void ButtonFromView::ShowActive() { 98 void ButtonFromView::ShowActive() {
99 bool border_visible = 99 bool border_visible =
100 (button_hovered_ && highlight_on_hover_) || show_border_; 100 (button_hovered_ && highlight_on_hover_) || show_border_;
101 SkColor border_color = border_visible ? kBorderColor : SK_ColorTRANSPARENT; 101 SkColor border_color = border_visible ? kBorderColor : SK_ColorTRANSPARENT;
102 SetBorder(views::Border::CreateSolidBorder(1, border_color)); 102 SetBorder(views::Border::CreateSolidBorder(1, border_color));
103 if (highlight_on_hover_) { 103 if (highlight_on_hover_) {
104 SkColor background_color = 104 SkColor background_color =
105 button_hovered_ ? kHoverBackgroundColor : kBackgroundColor; 105 button_hovered_ ? kHoverBackgroundColor : kBackgroundColor;
106 content_->set_background( 106 content_->set_background(
107 views::Background::CreateSolidBackground(background_color)); 107 views::Background::CreateSolidBackground(background_color));
108 set_background(views::Background::CreateSolidBackground(background_color)); 108 set_background(views::Background::CreateSolidBackground(background_color));
109 } 109 }
110 SchedulePaint(); 110 SchedulePaint();
111 } 111 }
112 112
113 } // namespace tray 113 } // namespace tray
114 } // namespace ash 114 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/user/button_from_view.h ('k') | ash/common/system/user/tray_user_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698