| 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/system/date/date_default_view.h" | 5 #include "ash/system/date/date_default_view.h" |
| 6 | 6 |
| 7 #include "ash/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
| 8 #include "ash/session/session_state_delegate.h" | 8 #include "ash/session/session_state_delegate.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/date/date_view.h" | 10 #include "ash/system/date/date_view.h" |
| 11 #include "ash/system/tray/special_popup_row.h" | 11 #include "ash/system/tray/special_popup_row.h" |
| 12 #include "ash/system/tray/system_tray_delegate.h" | 12 #include "ash/system/tray/system_tray_delegate.h" |
| 13 #include "ash/system/tray/tray_constants.h" | 13 #include "ash/system/tray/tray_constants.h" |
| 14 #include "ash/system/tray/tray_popup_header_button.h" | 14 #include "ash/system/tray/tray_popup_header_button.h" |
| 15 #include "ash/wm/lock_state_controller.h" | 15 #include "ash/wm/lock_state_controller.h" |
| 16 #include "base/i18n/rtl.h" |
| 16 #include "grit/ash_resources.h" | 17 #include "grit/ash_resources.h" |
| 17 #include "grit/ash_strings.h" | 18 #include "grit/ash_strings.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/views/border.h" | 20 #include "ui/views/border.h" |
| 20 #include "ui/views/controls/button/button.h" | 21 #include "ui/views/controls/button/button.h" |
| 21 #include "ui/views/layout/fill_layout.h" | 22 #include "ui/views/layout/fill_layout.h" |
| 22 #include "ui/views/view.h" | 23 #include "ui/views/view.h" |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 27 // The ISO-639 code for the Hebrew locale. The help icon asset is a '?' which is |
| 28 // not mirrored in this locale. |
| 29 const char kHebrewLocale[] = "he"; |
| 30 |
| 26 const int kPaddingVertical = 19; | 31 const int kPaddingVertical = 19; |
| 27 | 32 |
| 28 } // namespace | 33 } // namespace |
| 29 | 34 |
| 30 namespace ash { | 35 namespace ash { |
| 31 | 36 |
| 32 DateDefaultView::DateDefaultView(ash::user::LoginStatus login) | 37 DateDefaultView::DateDefaultView(ash::user::LoginStatus login) |
| 33 : help_button_(NULL), | 38 : help_button_(NULL), |
| 34 shutdown_button_(NULL), | 39 shutdown_button_(NULL), |
| 35 lock_button_(NULL), | 40 lock_button_(NULL), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 51 if (login == user::LOGGED_IN_LOCKED || | 56 if (login == user::LOGGED_IN_LOCKED || |
| 52 login == user::LOGGED_IN_NONE || userAddingRunning) | 57 login == user::LOGGED_IN_NONE || userAddingRunning) |
| 53 return; | 58 return; |
| 54 | 59 |
| 55 date_view_->SetAction(TrayDate::SHOW_DATE_SETTINGS); | 60 date_view_->SetAction(TrayDate::SHOW_DATE_SETTINGS); |
| 56 | 61 |
| 57 help_button_ = new TrayPopupHeaderButton( | 62 help_button_ = new TrayPopupHeaderButton( |
| 58 this, IDR_AURA_UBER_TRAY_HELP, IDR_AURA_UBER_TRAY_HELP, | 63 this, IDR_AURA_UBER_TRAY_HELP, IDR_AURA_UBER_TRAY_HELP, |
| 59 IDR_AURA_UBER_TRAY_HELP_HOVER, IDR_AURA_UBER_TRAY_HELP_HOVER, | 64 IDR_AURA_UBER_TRAY_HELP_HOVER, IDR_AURA_UBER_TRAY_HELP_HOVER, |
| 60 IDS_ASH_STATUS_TRAY_HELP); | 65 IDS_ASH_STATUS_TRAY_HELP); |
| 66 if (base::i18n::IsRTL() && |
| 67 base::i18n::GetConfiguredLocale() == kHebrewLocale) { |
| 68 // The asset for the help button is a question mark '?'. Normally this asset |
| 69 // is flipped in RTL locales, however Hebrew uses the LTR '?'. So the |
| 70 // flipping must be disabled. (crbug.com/475237) |
| 71 help_button_->EnableCanvasFlippingForRTLUI(false); |
| 72 } |
| 61 help_button_->SetTooltipText( | 73 help_button_->SetTooltipText( |
| 62 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP)); | 74 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP)); |
| 63 view->AddButton(help_button_); | 75 view->AddButton(help_button_); |
| 64 | 76 |
| 65 #if !defined(OS_WIN) | 77 #if !defined(OS_WIN) |
| 66 if (login != ash::user::LOGGED_IN_LOCKED) { | 78 if (login != ash::user::LOGGED_IN_LOCKED) { |
| 67 shutdown_button_ = new TrayPopupHeaderButton( | 79 shutdown_button_ = new TrayPopupHeaderButton( |
| 68 this, IDR_AURA_UBER_TRAY_SHUTDOWN, IDR_AURA_UBER_TRAY_SHUTDOWN, | 80 this, IDR_AURA_UBER_TRAY_SHUTDOWN, IDR_AURA_UBER_TRAY_SHUTDOWN, |
| 69 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, | 81 IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER, |
| 70 IDS_ASH_STATUS_TRAY_SHUTDOWN); | 82 IDS_ASH_STATUS_TRAY_SHUTDOWN); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { | 147 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { |
| 136 if (!shutdown_button_) | 148 if (!shutdown_button_) |
| 137 return; | 149 return; |
| 138 | 150 |
| 139 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( | 151 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( |
| 140 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT | 152 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT |
| 141 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); | 153 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); |
| 142 } | 154 } |
| 143 | 155 |
| 144 } // namespace ash | 156 } // namespace ash |
| OLD | NEW |