Chromium Code Reviews| 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/tri_view.h" | 20 #include "ash/common/system/tray/tri_view.h" |
| 21 #include "ash/common/wm_shell.h" | 21 #include "ash/common/wm_shell.h" |
| 22 #include "ash/resources/vector_icons/vector_icons.h" | 22 #include "ash/resources/vector_icons/vector_icons.h" |
| 23 #include "ash/shell.h" | 23 #include "ash/shell.h" |
| 24 #include "ash/strings/grit/ash_strings.h" | 24 #include "ash/strings/grit/ash_strings.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/gfx/color_palette.h" | |
|
tdanderson
2017/04/07 20:57:32
Thanks for keeping the #includes up to date! Most
| |
| 29 #include "ui/gfx/image/image.h" | 28 #include "ui/gfx/image/image.h" |
| 30 #include "ui/gfx/paint_vector_icon.h" | 29 #include "ui/gfx/paint_vector_icon.h" |
| 31 #include "ui/resources/grit/ui_resources.h" | 30 #include "ui/resources/grit/ui_resources.h" |
| 32 #include "ui/views/background.h" | 31 #include "ui/views/background.h" |
| 33 #include "ui/views/controls/button/custom_button.h" | 32 #include "ui/views/controls/button/custom_button.h" |
| 34 #include "ui/views/controls/image_view.h" | 33 #include "ui/views/controls/image_view.h" |
| 35 #include "ui/views/controls/label.h" | 34 #include "ui/views/controls/label.h" |
| 36 #include "ui/views/controls/separator.h" | 35 #include "ui/views/controls/separator.h" |
| 37 #include "ui/views/layout/box_layout.h" | 36 #include "ui/views/layout/box_layout.h" |
| 38 #include "ui/views/layout/grid_layout.h" | 37 #include "ui/views/layout/grid_layout.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 state |= A11Y_HIGHLIGHT_MOUSE_CURSOR; | 80 state |= A11Y_HIGHLIGHT_MOUSE_CURSOR; |
| 82 if (delegate->IsFocusHighlightEnabled()) | 81 if (delegate->IsFocusHighlightEnabled()) |
| 83 state |= A11Y_HIGHLIGHT_KEYBOARD_FOCUS; | 82 state |= A11Y_HIGHLIGHT_KEYBOARD_FOCUS; |
| 84 return state; | 83 return state; |
| 85 } | 84 } |
| 86 | 85 |
| 87 LoginStatus GetCurrentLoginStatus() { | 86 LoginStatus GetCurrentLoginStatus() { |
| 88 return Shell::Get()->system_tray_delegate()->GetUserLoginStatus(); | 87 return Shell::Get()->system_tray_delegate()->GetUserLoginStatus(); |
| 89 } | 88 } |
| 90 | 89 |
| 91 void UpdateCheckMark(HoverHighlightView* container, bool checked) { | |
| 92 if (checked) { | |
| 93 gfx::ImageSkia check_mark = | |
| 94 CreateVectorIcon(kCheckCircleIcon, gfx::kGoogleGreen700); | |
| 95 container->AddRightIcon(check_mark, check_mark.width()); | |
| 96 container->SetRightViewVisible(true); | |
| 97 container->SetAccessiblityState( | |
| 98 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX); | |
| 99 } else { | |
| 100 container->SetAccessiblityState( | |
| 101 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); | |
| 102 } | |
| 103 } | |
| 104 | |
| 105 } // namespace | 90 } // namespace |
| 106 | 91 |
| 107 namespace tray { | 92 namespace tray { |
| 108 | 93 |
| 109 class DefaultAccessibilityView : public TrayItemMore { | 94 class DefaultAccessibilityView : public TrayItemMore { |
| 110 public: | 95 public: |
| 111 explicit DefaultAccessibilityView(SystemTrayItem* owner) | 96 explicit DefaultAccessibilityView(SystemTrayItem* owner) |
| 112 : TrayItemMore(owner) { | 97 : TrayItemMore(owner) { |
| 113 base::string16 label = | 98 base::string16 label = |
| 114 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY); | 99 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 } | 278 } |
| 294 } | 279 } |
| 295 | 280 |
| 296 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( | 281 HoverHighlightView* AccessibilityDetailedView::AddScrollListItem( |
| 297 const base::string16& text, | 282 const base::string16& text, |
| 298 bool checked, | 283 bool checked, |
| 299 const gfx::VectorIcon& icon) { | 284 const gfx::VectorIcon& icon) { |
| 300 HoverHighlightView* container = new HoverHighlightView(this); | 285 HoverHighlightView* container = new HoverHighlightView(this); |
| 301 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); | 286 gfx::ImageSkia image = CreateVectorIcon(icon, kMenuIconColor); |
| 302 container->AddIconAndLabel(image, text); | 287 container->AddIconAndLabel(image, text); |
| 303 UpdateCheckMark(container, checked); | 288 TrayPopupUtils::InitializeAsCheckableRow(container, checked); |
| 304 scroll_content()->AddChildView(container); | 289 scroll_content()->AddChildView(container); |
| 305 return container; | 290 return container; |
| 306 } | 291 } |
| 307 | 292 |
| 308 HoverHighlightView* AccessibilityDetailedView::AddScrollListItemWithoutIcon( | 293 HoverHighlightView* AccessibilityDetailedView::AddScrollListItemWithoutIcon( |
| 309 const base::string16& text, | 294 const base::string16& text, |
| 310 bool checked) { | 295 bool checked) { |
| 311 HoverHighlightView* container = new HoverHighlightView(this); | 296 HoverHighlightView* container = new HoverHighlightView(this); |
| 312 container->AddLabelRow(text); | 297 container->AddLabelRow(text); |
| 313 | 298 TrayPopupUtils::InitializeAsCheckableRow(container, checked); |
| 314 UpdateCheckMark(container, checked); | |
| 315 | |
| 316 scroll_content()->AddChildView(container); | 299 scroll_content()->AddChildView(container); |
| 317 return container; | 300 return container; |
| 318 } | 301 } |
| 319 | 302 |
| 320 void AccessibilityDetailedView::AddSubHeader( | 303 void AccessibilityDetailedView::AddSubHeader( |
| 321 const base::string16& header_text) { | 304 const base::string16& header_text) { |
| 322 TriView* header = TrayPopupUtils::CreateSubHeaderRowView(); | 305 TriView* header = TrayPopupUtils::CreateSubHeaderRowView(); |
| 323 TrayPopupUtils::ConfigureAsStickyHeader(header); | 306 TrayPopupUtils::ConfigureAsStickyHeader(header); |
| 324 | 307 |
| 325 views::Label* label = TrayPopupUtils::CreateDefaultLabel(); | 308 views::Label* label = TrayPopupUtils::CreateDefaultLabel(); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 550 if (detailed_popup_) | 533 if (detailed_popup_) |
| 551 detailed_popup_->GetWidget()->Close(); | 534 detailed_popup_->GetWidget()->Close(); |
| 552 if (detailed_menu_) | 535 if (detailed_menu_) |
| 553 detailed_menu_->GetWidget()->Close(); | 536 detailed_menu_->GetWidget()->Close(); |
| 554 } | 537 } |
| 555 | 538 |
| 556 previous_accessibility_state_ = accessibility_state; | 539 previous_accessibility_state_ = accessibility_state; |
| 557 } | 540 } |
| 558 | 541 |
| 559 } // namespace ash | 542 } // namespace ash |
| OLD | NEW |