OLD | NEW |
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_accessibility.h" | 5 #include "ash/common/system/tray_accessibility.h" |
6 | 6 |
7 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
8 #include "ash/common/accessibility_types.h" | 8 #include "ash/common/accessibility_types.h" |
9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
10 #include "ash/common/system/tray/hover_highlight_view.h" | 10 #include "ash/common/system/tray/hover_highlight_view.h" |
11 #include "ash/common/system/tray/system_tray.h" | 11 #include "ash/common/system/tray/system_tray.h" |
12 #include "ash/common/system/tray/system_tray_controller.h" | 12 #include "ash/common/system/tray/system_tray_controller.h" |
13 #include "ash/common/system/tray/system_tray_delegate.h" | 13 #include "ash/common/system/tray/system_tray_delegate.h" |
14 #include "ash/common/system/tray/system_tray_notifier.h" | 14 #include "ash/common/system/tray/system_tray_notifier.h" |
15 #include "ash/common/system/tray/tray_constants.h" | 15 #include "ash/common/system/tray/tray_constants.h" |
16 #include "ash/common/system/tray/tray_details_view.h" | 16 #include "ash/common/system/tray/tray_details_view.h" |
17 #include "ash/common/system/tray/tray_item_more.h" | 17 #include "ash/common/system/tray/tray_item_more.h" |
18 #include "ash/common/system/tray/tray_popup_item_style.h" | 18 #include "ash/common/system/tray/tray_popup_item_style.h" |
19 #include "ash/common/system/tray/tray_popup_utils.h" | 19 #include "ash/common/system/tray/tray_popup_utils.h" |
| 20 #include "ash/common/system/tray/tray_utils.h" |
20 #include "ash/common/system/tray/tri_view.h" | 21 #include "ash/common/system/tray/tri_view.h" |
21 #include "ash/common/wm_shell.h" | 22 #include "ash/common/wm_shell.h" |
22 #include "ash/resources/vector_icons/vector_icons.h" | 23 #include "ash/resources/vector_icons/vector_icons.h" |
23 #include "ash/shell.h" | 24 #include "ash/shell.h" |
24 #include "ash/strings/grit/ash_strings.h" | 25 #include "ash/strings/grit/ash_strings.h" |
25 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
28 #include "ui/gfx/color_palette.h" | |
29 #include "ui/gfx/image/image.h" | 29 #include "ui/gfx/image/image.h" |
30 #include "ui/gfx/paint_vector_icon.h" | 30 #include "ui/gfx/paint_vector_icon.h" |
31 #include "ui/resources/grit/ui_resources.h" | 31 #include "ui/resources/grit/ui_resources.h" |
32 #include "ui/views/background.h" | 32 #include "ui/views/background.h" |
33 #include "ui/views/controls/button/custom_button.h" | 33 #include "ui/views/controls/button/custom_button.h" |
34 #include "ui/views/controls/image_view.h" | 34 #include "ui/views/controls/image_view.h" |
35 #include "ui/views/controls/label.h" | 35 #include "ui/views/controls/label.h" |
36 #include "ui/views/controls/separator.h" | 36 #include "ui/views/controls/separator.h" |
37 #include "ui/views/layout/box_layout.h" | 37 #include "ui/views/layout/box_layout.h" |
38 #include "ui/views/layout/grid_layout.h" | 38 #include "ui/views/layout/grid_layout.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 state |= A11Y_HIGHLIGHT_MOUSE_CURSOR; | 82 state |= A11Y_HIGHLIGHT_MOUSE_CURSOR; |
83 if (delegate->IsFocusHighlightEnabled()) | 83 if (delegate->IsFocusHighlightEnabled()) |
84 state |= A11Y_HIGHLIGHT_KEYBOARD_FOCUS; | 84 state |= A11Y_HIGHLIGHT_KEYBOARD_FOCUS; |
85 return state; | 85 return state; |
86 } | 86 } |
87 | 87 |
88 LoginStatus GetCurrentLoginStatus() { | 88 LoginStatus GetCurrentLoginStatus() { |
89 return Shell::Get()->system_tray_delegate()->GetUserLoginStatus(); | 89 return Shell::Get()->system_tray_delegate()->GetUserLoginStatus(); |
90 } | 90 } |
91 | 91 |
92 void UpdateCheckMark(HoverHighlightView* container, bool checked) { | |
93 if (checked) { | |
94 gfx::ImageSkia check_mark = | |
95 CreateVectorIcon(kCheckCircleIcon, gfx::kGoogleGreen700); | |
96 container->AddRightIcon(check_mark, check_mark.width()); | |
97 container->SetRightViewVisible(true); | |
98 container->SetAccessiblityState( | |
99 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX); | |
100 } else { | |
101 container->SetAccessiblityState( | |
102 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); | |
103 } | |
104 } | |
105 | |
106 } // namespace | 92 } // namespace |
107 | 93 |
108 namespace tray { | 94 namespace tray { |
109 | 95 |
110 class DefaultAccessibilityView : public TrayItemMore { | 96 class DefaultAccessibilityView : public TrayItemMore { |
111 public: | 97 public: |
112 explicit DefaultAccessibilityView(SystemTrayItem* owner) | 98 explicit DefaultAccessibilityView(SystemTrayItem* owner) |
113 : TrayItemMore(owner) { | 99 : TrayItemMore(owner) { |
114 base::string16 label = | 100 base::string16 label = |
115 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY); | 101 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 281 } |
296 } | 282 } |
297 | 283 |
298 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( | 284 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( |
299 const base::string16& text, | 285 const base::string16& text, |
300 bool checked, | 286 bool checked, |
301 const gfx::VectorIcon& icon) { | 287 const gfx::VectorIcon& icon) { |
302 HoverHighlightView* container = new HoverHighlightView(this); | 288 HoverHighlightView* container = new HoverHighlightView(this); |
303 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); | 289 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); |
304 container->AddIconAndLabel(image, text); | 290 container->AddIconAndLabel(image, text); |
305 UpdateCheckMark(container, checked); | 291 if (checked) { |
| 292 SetCheckMarkVisible(container); |
| 293 } else { |
| 294 SetCheckMarkInvisible(container); |
| 295 } |
306 scroll_content()->AddChildView(container); | 296 scroll_content()->AddChildView(container); |
307 return container; | 297 return container; |
308 } | 298 } |
309 | 299 |
310 HoverHighlightView* AccessibilityDetailedView::AddScrollListItemWithoutIcon( | 300 HoverHighlightView* AccessibilityDetailedView::AddScrollListItemWithoutIcon( |
311 const base::string16& text, | 301 const base::string16& text, |
312 bool checked) { | 302 bool checked) { |
313 HoverHighlightView* container = new HoverHighlightView(this); | 303 HoverHighlightView* container = new HoverHighlightView(this); |
314 container->AddLabelRow(text); | 304 container->AddLabelRow(text); |
315 | 305 |
316 UpdateCheckMark(container, checked); | 306 if (checked) { |
| 307 SetCheckMarkVisible(container); |
| 308 } else { |
| 309 SetCheckMarkInvisible(container); |
| 310 } |
317 | 311 |
318 scroll_content()->AddChildView(container); | 312 scroll_content()->AddChildView(container); |
319 return container; | 313 return container; |
320 } | 314 } |
321 | 315 |
322 void AccessibilityDetailedView::AddSubHeader( | 316 void AccessibilityDetailedView::AddSubHeader( |
323 const base::string16& header_text) { | 317 const base::string16& header_text) { |
324 TriView* header = TrayPopupUtils::CreateSubHeaderRowView(); | 318 TriView* header = TrayPopupUtils::CreateSubHeaderRowView(); |
325 TrayPopupUtils::ConfigureAsStickyHeader(header); | 319 TrayPopupUtils::ConfigureAsStickyHeader(header); |
326 | 320 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 if (detailed_popup_) | 548 if (detailed_popup_) |
555 detailed_popup_->GetWidget()->Close(); | 549 detailed_popup_->GetWidget()->Close(); |
556 if (detailed_menu_) | 550 if (detailed_menu_) |
557 detailed_menu_->GetWidget()->Close(); | 551 detailed_menu_->GetWidget()->Close(); |
558 } | 552 } |
559 | 553 |
560 previous_accessibility_state_ = accessibility_state; | 554 previous_accessibility_state_ = accessibility_state; |
561 } | 555 } |
562 | 556 |
563 } // namespace ash | 557 } // namespace ash |
OLD | NEW |