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/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 } | 79 } |
80 | 80 |
81 } // namespace | 81 } // namespace |
82 | 82 |
83 namespace tray { | 83 namespace tray { |
84 | 84 |
85 class DefaultAccessibilityView : public TrayItemMore { | 85 class DefaultAccessibilityView : public TrayItemMore { |
86 public: | 86 public: |
87 explicit DefaultAccessibilityView(SystemTrayItem* owner) | 87 explicit DefaultAccessibilityView(SystemTrayItem* owner) |
88 : TrayItemMore(owner, true) { | 88 : TrayItemMore(owner, true) { |
89 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | |
90 if (!MaterialDesignController::UseMaterialDesignSystemIcons()) { | |
91 // The icon doesn't change in non-md. | |
92 SetImage(*bundle.GetImageNamed(IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK) | |
93 .ToImageSkia()); | |
94 } | |
95 base::string16 label = | 89 base::string16 label = |
96 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY); | 90 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( |
Evan Stade
2017/02/16 19:53:14
l10n_util::GetString
tdanderson
2017/02/17 20:32:48
Done.
| |
91 IDS_ASH_STATUS_TRAY_ACCESSIBILITY); | |
97 SetLabel(label); | 92 SetLabel(label); |
98 SetAccessibleName(label); | 93 SetAccessibleName(label); |
99 set_id(test::kAccessibilityTrayItemViewId); | 94 set_id(test::kAccessibilityTrayItemViewId); |
100 } | 95 } |
101 | 96 |
102 ~DefaultAccessibilityView() override {} | 97 ~DefaultAccessibilityView() override {} |
103 | 98 |
104 protected: | 99 protected: |
105 // TrayItemMore: | 100 // TrayItemMore: |
106 void UpdateStyle() override { | 101 void UpdateStyle() override { |
107 TrayItemMore::UpdateStyle(); | 102 TrayItemMore::UpdateStyle(); |
108 | |
109 if (!UseMdMenu()) | |
110 return; | |
111 | |
112 std::unique_ptr<TrayPopupItemStyle> style = CreateStyle(); | 103 std::unique_ptr<TrayPopupItemStyle> style = CreateStyle(); |
113 SetImage(gfx::CreateVectorIcon(kSystemMenuAccessibilityIcon, | 104 SetImage(gfx::CreateVectorIcon(kSystemMenuAccessibilityIcon, |
114 style->GetIconColor())); | 105 style->GetIconColor())); |
115 } | 106 } |
116 | 107 |
117 private: | 108 private: |
118 DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView); | 109 DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView); |
119 }; | 110 }; |
120 | 111 |
121 //////////////////////////////////////////////////////////////////////////////// | 112 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 } | 333 } |
343 } | 334 } |
344 | 335 |
345 } // namespace tray | 336 } // namespace tray |
346 | 337 |
347 //////////////////////////////////////////////////////////////////////////////// | 338 //////////////////////////////////////////////////////////////////////////////// |
348 // ash::TrayAccessibility | 339 // ash::TrayAccessibility |
349 | 340 |
350 TrayAccessibility::TrayAccessibility(SystemTray* system_tray) | 341 TrayAccessibility::TrayAccessibility(SystemTray* system_tray) |
351 : TrayImageItem(system_tray, | 342 : TrayImageItem(system_tray, |
352 IDR_AURA_UBER_TRAY_ACCESSIBILITY, | 343 kSystemTrayAccessibilityIcon, |
353 UMA_ACCESSIBILITY), | 344 UMA_ACCESSIBILITY), |
354 default_(NULL), | 345 default_(NULL), |
355 detailed_popup_(NULL), | 346 detailed_popup_(NULL), |
356 detailed_menu_(NULL), | 347 detailed_menu_(NULL), |
357 request_popup_view_state_(A11Y_NONE), | 348 request_popup_view_state_(A11Y_NONE), |
358 tray_icon_visible_(false), | 349 tray_icon_visible_(false), |
359 login_(GetCurrentLoginStatus()), | 350 login_(GetCurrentLoginStatus()), |
360 previous_accessibility_state_(GetAccessibilityState()), | 351 previous_accessibility_state_(GetAccessibilityState()), |
361 show_a11y_menu_on_lock_screen_(true) { | 352 show_a11y_menu_on_lock_screen_(true) { |
362 DCHECK(system_tray); | 353 DCHECK(system_tray); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
464 if (detailed_popup_) | 455 if (detailed_popup_) |
465 detailed_popup_->GetWidget()->Close(); | 456 detailed_popup_->GetWidget()->Close(); |
466 if (detailed_menu_) | 457 if (detailed_menu_) |
467 detailed_menu_->GetWidget()->Close(); | 458 detailed_menu_->GetWidget()->Close(); |
468 } | 459 } |
469 | 460 |
470 previous_accessibility_state_ = accessibility_state; | 461 previous_accessibility_state_ = accessibility_state; |
471 } | 462 } |
472 | 463 |
473 } // namespace ash | 464 } // namespace ash |
OLD | NEW |