OLD | NEW |
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/system/user/button_from_view.h" | 5 #include "ash/system/user/button_from_view.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
8 #include "ash/system/tray/tray_constants.h" | 8 #include "ash/system/tray/tray_constants.h" |
9 #include "ash/system/tray/tray_utils.h" | 9 #include "ash/system/tray/tray_utils.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 View::OnBlur(); | 82 View::OnBlur(); |
83 // Removing focus frame. | 83 // Removing focus frame. |
84 SchedulePaint(); | 84 SchedulePaint(); |
85 } | 85 } |
86 | 86 |
87 void ButtonFromView::GetAccessibleState(ui::AXViewState* state) { | 87 void ButtonFromView::GetAccessibleState(ui::AXViewState* state) { |
88 state->role = ui::AX_ROLE_BUTTON; | 88 state->role = ui::AX_ROLE_BUTTON; |
89 std::vector<base::string16> labels; | 89 std::vector<base::string16> labels; |
90 for (int i = 0; i < child_count(); ++i) | 90 for (int i = 0; i < child_count(); ++i) |
91 GetAccessibleLabelFromDescendantViews(child_at(i), labels); | 91 GetAccessibleLabelFromDescendantViews(child_at(i), labels); |
92 state->name = JoinString(labels, base::ASCIIToUTF16(" ")); | 92 state->name = base::JoinString(labels, base::ASCIIToUTF16(" ")); |
93 } | 93 } |
94 | 94 |
95 void ButtonFromView::ShowActive() { | 95 void ButtonFromView::ShowActive() { |
96 bool border_visible = | 96 bool border_visible = |
97 (button_hovered_ && highlight_on_hover_) || show_border_; | 97 (button_hovered_ && highlight_on_hover_) || show_border_; |
98 SkColor border_color = border_visible ? kBorderColor : SK_ColorTRANSPARENT; | 98 SkColor border_color = border_visible ? kBorderColor : SK_ColorTRANSPARENT; |
99 SetBorder(views::Border::CreateSolidBorder(1, border_color)); | 99 SetBorder(views::Border::CreateSolidBorder(1, border_color)); |
100 if (highlight_on_hover_) { | 100 if (highlight_on_hover_) { |
101 SkColor background_color = | 101 SkColor background_color = |
102 button_hovered_ ? kHoverBackgroundColor : kBackgroundColor; | 102 button_hovered_ ? kHoverBackgroundColor : kBackgroundColor; |
103 content_->set_background( | 103 content_->set_background( |
104 views::Background::CreateSolidBackground(background_color)); | 104 views::Background::CreateSolidBackground(background_color)); |
105 set_background(views::Background::CreateSolidBackground(background_color)); | 105 set_background(views::Background::CreateSolidBackground(background_color)); |
106 } | 106 } |
107 SchedulePaint(); | 107 SchedulePaint(); |
108 } | 108 } |
109 | 109 |
110 } // namespace tray | 110 } // namespace tray |
111 } // namespace ash | 111 } // namespace ash |
OLD | NEW |