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/common/system/date/date_default_view.h" | 5 #include "ash/common/system/date/date_default_view.h" |
6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" |
7 #include "ash/common/metrics/user_metrics_action.h" | 8 #include "ash/common/metrics/user_metrics_action.h" |
8 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
9 #include "ash/common/system/date/date_view.h" | 10 #include "ash/common/system/date/date_view.h" |
10 #include "ash/common/system/tray/special_popup_row.h" | 11 #include "ash/common/system/tray/special_popup_row.h" |
11 #include "ash/common/system/tray/system_tray_delegate.h" | 12 #include "ash/common/system/tray/system_tray_delegate.h" |
12 #include "ash/common/system/tray/tray_constants.h" | 13 #include "ash/common/system/tray/tray_constants.h" |
13 #include "ash/common/system/tray/tray_popup_header_button.h" | 14 #include "ash/common/system/tray/tray_popup_header_button.h" |
14 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
| 16 #include "ash/resources/vector_icons/vector_icons.h" |
15 #include "base/i18n/rtl.h" | 17 #include "base/i18n/rtl.h" |
16 #include "grit/ash_resources.h" | 18 #include "grit/ash_resources.h" |
17 #include "grit/ash_strings.h" | 19 #include "grit/ash_strings.h" |
18 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/gfx/paint_vector_icon.h" |
19 #include "ui/views/border.h" | 22 #include "ui/views/border.h" |
20 #include "ui/views/controls/button/button.h" | 23 #include "ui/views/controls/button/button.h" |
21 #include "ui/views/layout/fill_layout.h" | 24 #include "ui/views/layout/fill_layout.h" |
22 #include "ui/views/view.h" | 25 #include "ui/views/view.h" |
23 | 26 |
24 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
25 #include "chromeos/dbus/dbus_thread_manager.h" | 28 #include "chromeos/dbus/dbus_thread_manager.h" |
26 #include "chromeos/dbus/session_manager_client.h" | 29 #include "chromeos/dbus/session_manager_client.h" |
27 #endif | 30 #endif |
28 | 31 |
(...skipping 27 matching lines...) Expand all Loading... |
56 WmShell* shell = WmShell::Get(); | 59 WmShell* shell = WmShell::Get(); |
57 const bool adding_user = | 60 const bool adding_user = |
58 shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 61 shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
59 | 62 |
60 if (login == LoginStatus::LOCKED || login == LoginStatus::NOT_LOGGED_IN || | 63 if (login == LoginStatus::LOCKED || login == LoginStatus::NOT_LOGGED_IN || |
61 adding_user) | 64 adding_user) |
62 return; | 65 return; |
63 | 66 |
64 date_view_->SetAction(TrayDate::SHOW_DATE_SETTINGS); | 67 date_view_->SetAction(TrayDate::SHOW_DATE_SETTINGS); |
65 | 68 |
66 help_button_ = new TrayPopupHeaderButton( | 69 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
67 this, IDR_AURA_UBER_TRAY_HELP, IDR_AURA_UBER_TRAY_HELP, | 70 gfx::ImageSkia help_icon = |
68 IDR_AURA_UBER_TRAY_HELP_HOVER, IDR_AURA_UBER_TRAY_HELP_HOVER, | 71 gfx::CreateVectorIcon(kSystemMenuHelpIcon, kMenuIconColor); |
69 IDS_ASH_STATUS_TRAY_HELP); | 72 help_button_ = |
| 73 new TrayPopupHeaderButton(this, help_icon, IDS_ASH_STATUS_TRAY_HELP); |
| 74 } else { |
| 75 help_button_ = new TrayPopupHeaderButton( |
| 76 this, IDR_AURA_UBER_TRAY_HELP, IDR_AURA_UBER_TRAY_HELP, |
| 77 IDR_AURA_UBER_TRAY_HELP_HOVER, IDR_AURA_UBER_TRAY_HELP_HOVER, |
| 78 IDS_ASH_STATUS_TRAY_HELP); |
| 79 } |
70 if (base::i18n::IsRTL() && | 80 if (base::i18n::IsRTL() && |
71 base::i18n::GetConfiguredLocale() == kHebrewLocale) { | 81 base::i18n::GetConfiguredLocale() == kHebrewLocale) { |
72 // The asset for the help button is a question mark '?'. Normally this asset | 82 // The asset for the help button is a question mark '?'. Normally this asset |
73 // is flipped in RTL locales, however Hebrew uses the LTR '?'. So the | 83 // is flipped in RTL locales, however Hebrew uses the LTR '?'. So the |
74 // flipping must be disabled. (crbug.com/475237) | 84 // flipping must be disabled. (crbug.com/475237) |
75 help_button_->EnableCanvasFlippingForRTLUI(false); | 85 help_button_->EnableCanvasFlippingForRTLUI(false); |
76 } | 86 } |
77 help_button_->SetTooltipText( | 87 help_button_->SetTooltipText( |
78 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP)); | 88 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP)); |
79 view->AddButton(help_button_); | 89 view->AddButton(help_button_); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { | 164 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { |
155 if (!shutdown_button_) | 165 if (!shutdown_button_) |
156 return; | 166 return; |
157 | 167 |
158 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( | 168 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( |
159 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT | 169 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT |
160 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); | 170 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); |
161 } | 171 } |
162 | 172 |
163 } // namespace ash | 173 } // namespace ash |
OLD | NEW |