Chromium Code Reviews| 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/color_utils.h" | |
| 22 #include "ui/gfx/paint_vector_icon.h" | |
| 19 #include "ui/views/border.h" | 23 #include "ui/views/border.h" |
| 20 #include "ui/views/controls/button/button.h" | 24 #include "ui/views/controls/button/button.h" |
| 21 #include "ui/views/layout/fill_layout.h" | 25 #include "ui/views/layout/fill_layout.h" |
| 22 #include "ui/views/view.h" | 26 #include "ui/views/view.h" |
| 23 | 27 |
| 24 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
| 25 #include "chromeos/dbus/dbus_thread_manager.h" | 29 #include "chromeos/dbus/dbus_thread_manager.h" |
| 26 #include "chromeos/dbus/session_manager_client.h" | 30 #include "chromeos/dbus/session_manager_client.h" |
| 27 #endif | 31 #endif |
| 28 | 32 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 56 WmShell* shell = WmShell::Get(); | 60 WmShell* shell = WmShell::Get(); |
| 57 const bool adding_user = | 61 const bool adding_user = |
| 58 shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 62 shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
| 59 | 63 |
| 60 if (login == LoginStatus::LOCKED || login == LoginStatus::NOT_LOGGED_IN || | 64 if (login == LoginStatus::LOCKED || login == LoginStatus::NOT_LOGGED_IN || |
| 61 adding_user) | 65 adding_user) |
| 62 return; | 66 return; |
| 63 | 67 |
| 64 date_view_->SetAction(TrayDate::SHOW_DATE_SETTINGS); | 68 date_view_->SetAction(TrayDate::SHOW_DATE_SETTINGS); |
| 65 | 69 |
| 66 help_button_ = new TrayPopupHeaderButton( | 70 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
| 67 this, IDR_AURA_UBER_TRAY_HELP, IDR_AURA_UBER_TRAY_HELP, | 71 gfx::ImageSkia help_icon = gfx::CreateVectorIcon( |
| 68 IDR_AURA_UBER_TRAY_HELP_HOVER, IDR_AURA_UBER_TRAY_HELP_HOVER, | 72 kSystemMenuHelpIcon, |
| 69 IDS_ASH_STATUS_TRAY_HELP); | 73 color_utils::DeriveDefaultIconColor(kMenuIconColor)); |
|
tdanderson
2016/09/14 14:56:12
No need for DeriveDefaultIconColor, you can just p
mohsen
2016/09/14 22:10:50
Done.
| |
| 74 help_button_ = | |
| 75 new TrayPopupHeaderButton(this, help_icon, IDS_ASH_STATUS_TRAY_HELP); | |
| 76 } else { | |
| 77 help_button_ = new TrayPopupHeaderButton( | |
| 78 this, IDR_AURA_UBER_TRAY_HELP, IDR_AURA_UBER_TRAY_HELP, | |
| 79 IDR_AURA_UBER_TRAY_HELP_HOVER, IDR_AURA_UBER_TRAY_HELP_HOVER, | |
| 80 IDS_ASH_STATUS_TRAY_HELP); | |
| 81 } | |
| 70 if (base::i18n::IsRTL() && | 82 if (base::i18n::IsRTL() && |
|
mohsen
2016/09/13 15:39:41
still relevant?
tdanderson
2016/09/14 14:56:12
Not sure, but let's assume so.
mohsen
2016/09/14 22:10:50
Oops. That was meant to be a note to myself ;) Sor
| |
| 71 base::i18n::GetConfiguredLocale() == kHebrewLocale) { | 83 base::i18n::GetConfiguredLocale() == kHebrewLocale) { |
| 72 // The asset for the help button is a question mark '?'. Normally this asset | 84 // 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 | 85 // is flipped in RTL locales, however Hebrew uses the LTR '?'. So the |
| 74 // flipping must be disabled. (crbug.com/475237) | 86 // flipping must be disabled. (crbug.com/475237) |
| 75 help_button_->EnableCanvasFlippingForRTLUI(false); | 87 help_button_->EnableCanvasFlippingForRTLUI(false); |
| 76 } | 88 } |
| 77 help_button_->SetTooltipText( | 89 help_button_->SetTooltipText( |
| 78 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP)); | 90 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP)); |
| 79 view->AddButton(help_button_); | 91 view->AddButton(help_button_); |
| 80 | 92 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { | 166 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { |
| 155 if (!shutdown_button_) | 167 if (!shutdown_button_) |
| 156 return; | 168 return; |
| 157 | 169 |
| 158 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( | 170 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( |
| 159 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT | 171 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT |
| 160 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); | 172 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); |
| 161 } | 173 } |
| 162 | 174 |
| 163 } // namespace ash | 175 } // namespace ash |
| OLD | NEW |