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" |
11 #include "ash/common/system/tray/hover_highlight_view.h" | 11 #include "ash/common/system/tray/hover_highlight_view.h" |
12 #include "ash/common/system/tray/system_tray.h" | 12 #include "ash/common/system/tray/system_tray.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_label_button.h" | 19 #include "ash/common/system/tray/tray_popup_label_button.h" |
19 #include "ash/common/wm_shell.h" | 20 #include "ash/common/wm_shell.h" |
20 #include "ash/resources/vector_icons/vector_icons.h" | 21 #include "ash/resources/vector_icons/vector_icons.h" |
21 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
22 #include "grit/ash_resources.h" | 23 #include "grit/ash_resources.h" |
23 #include "grit/ash_strings.h" | 24 #include "grit/ash_strings.h" |
24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
25 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
26 #include "ui/gfx/image/image.h" | 27 #include "ui/gfx/image/image.h" |
27 #include "ui/gfx/paint_vector_icon.h" | 28 #include "ui/gfx/paint_vector_icon.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 71 |
71 } // namespace | 72 } // namespace |
72 | 73 |
73 namespace tray { | 74 namespace tray { |
74 | 75 |
75 class DefaultAccessibilityView : public TrayItemMore { | 76 class DefaultAccessibilityView : public TrayItemMore { |
76 public: | 77 public: |
77 explicit DefaultAccessibilityView(SystemTrayItem* owner) | 78 explicit DefaultAccessibilityView(SystemTrayItem* owner) |
78 : TrayItemMore(owner, true) { | 79 : TrayItemMore(owner, true) { |
79 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 80 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
80 if (MaterialDesignController::UseMaterialDesignSystemIcons()) { | 81 if (!MaterialDesignController::UseMaterialDesignSystemIcons()) { |
81 SetImage( | 82 // The icon doesn't change in non-md. |
82 gfx::CreateVectorIcon(kSystemMenuAccessibilityIcon, kMenuIconColor)); | |
83 } else { | |
84 SetImage(*bundle.GetImageNamed(IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK) | 83 SetImage(*bundle.GetImageNamed(IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK) |
85 .ToImageSkia()); | 84 .ToImageSkia()); |
86 } | 85 } |
87 base::string16 label = | 86 base::string16 label = |
88 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY); | 87 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_ACCESSIBILITY); |
89 SetLabel(label); | 88 SetLabel(label); |
90 SetAccessibleName(label); | 89 SetAccessibleName(label); |
91 set_id(test::kAccessibilityTrayItemViewId); | 90 set_id(test::kAccessibilityTrayItemViewId); |
92 } | 91 } |
93 | 92 |
94 ~DefaultAccessibilityView() override {} | 93 ~DefaultAccessibilityView() override {} |
95 | 94 |
| 95 protected: |
| 96 // TrayItemMore: |
| 97 void UpdateStyle() override { |
| 98 TrayItemMore::UpdateStyle(); |
| 99 |
| 100 if (!MaterialDesignController::IsSystemTrayMenuMaterial()) |
| 101 return; |
| 102 |
| 103 std::unique_ptr<TrayPopupItemStyle> style = CreateStyle(); |
| 104 SetImage(gfx::CreateVectorIcon(kSystemMenuAccessibilityIcon, |
| 105 style->GetForegroundColor())); |
| 106 } |
| 107 |
96 private: | 108 private: |
97 DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView); | 109 DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView); |
98 }; | 110 }; |
99 | 111 |
100 //////////////////////////////////////////////////////////////////////////////// | 112 //////////////////////////////////////////////////////////////////////////////// |
101 // ash::tray::AccessibilityPopupView | 113 // ash::tray::AccessibilityPopupView |
102 | 114 |
103 AccessibilityPopupView::AccessibilityPopupView(SystemTrayItem* owner, | 115 AccessibilityPopupView::AccessibilityPopupView(SystemTrayItem* owner, |
104 uint32_t enabled_state_bits) | 116 uint32_t enabled_state_bits) |
105 : TrayNotificationView(owner, IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK), | 117 : TrayNotificationView(owner, IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK), |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 if (detailed_popup_) | 427 if (detailed_popup_) |
416 detailed_popup_->GetWidget()->Close(); | 428 detailed_popup_->GetWidget()->Close(); |
417 if (detailed_menu_) | 429 if (detailed_menu_) |
418 detailed_menu_->GetWidget()->Close(); | 430 detailed_menu_->GetWidget()->Close(); |
419 } | 431 } |
420 | 432 |
421 previous_accessibility_state_ = accessibility_state; | 433 previous_accessibility_state_ = accessibility_state; |
422 } | 434 } |
423 | 435 |
424 } // namespace ash | 436 } // namespace ash |
OLD | NEW |