| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/tiles/tiles_default_view.h" | 5 #include "ash/common/system/tiles/tiles_default_view.h" |
| 6 | 6 |
| 7 #include "ash/common/metrics/user_metrics_action.h" | 7 #include "ash/common/metrics/user_metrics_action.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/system/tray/system_menu_button.h" | 9 #include "ash/common/system/tray/system_menu_button.h" |
| 10 #include "ash/common/system/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); | 65 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); |
| 66 box_layout->set_cross_axis_alignment( | 66 box_layout->set_cross_axis_alignment( |
| 67 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); | 67 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); |
| 68 SetLayoutManager(box_layout); | 68 SetLayoutManager(box_layout); |
| 69 | 69 |
| 70 // Show the buttons in this row as disabled if the user is at the login | 70 // Show the buttons in this row as disabled if the user is at the login |
| 71 // screen, lock screen, or in a secondary account flow. The exception is | 71 // screen, lock screen, or in a secondary account flow. The exception is |
| 72 // |power_button_| which is always shown as enabled. | 72 // |power_button_| which is always shown as enabled. |
| 73 const bool disable_buttons = !CanOpenWebUISettings(login_); | 73 const bool disable_buttons = !CanOpenWebUISettings(login_); |
| 74 | 74 |
| 75 settings_button_ = new SystemMenuButton(this, kSystemMenuSettingsIcon, | 75 settings_button_ = new SystemMenuButton( |
| 76 IDS_ASH_STATUS_TRAY_SETTINGS); | 76 this, SystemMenuButton::InkDropStyle::FLOOD_FILL, kSystemMenuSettingsIcon, |
| 77 IDS_ASH_STATUS_TRAY_SETTINGS); |
| 77 if (disable_buttons || !shell->system_tray_delegate()->ShouldShowSettings()) | 78 if (disable_buttons || !shell->system_tray_delegate()->ShouldShowSettings()) |
| 78 settings_button_->SetState(views::Button::STATE_DISABLED); | 79 settings_button_->SetState(views::Button::STATE_DISABLED); |
| 79 AddChildView(settings_button_); | 80 AddChildView(settings_button_); |
| 80 AddSeparator(); | 81 AddSeparator(); |
| 81 | 82 |
| 82 help_button_ = | 83 help_button_ = |
| 83 new SystemMenuButton(this, kSystemMenuHelpIcon, IDS_ASH_STATUS_TRAY_HELP); | 84 new SystemMenuButton(this, SystemMenuButton::InkDropStyle::FLOOD_FILL, |
| 85 kSystemMenuHelpIcon, IDS_ASH_STATUS_TRAY_HELP); |
| 84 if (base::i18n::IsRTL() && | 86 if (base::i18n::IsRTL() && |
| 85 base::i18n::GetConfiguredLocale() == kHebrewLocale) { | 87 base::i18n::GetConfiguredLocale() == kHebrewLocale) { |
| 86 // The asset for the help button is a question mark '?'. Normally this asset | 88 // The asset for the help button is a question mark '?'. Normally this asset |
| 87 // is flipped in RTL locales, however Hebrew uses the LTR '?'. So the | 89 // is flipped in RTL locales, however Hebrew uses the LTR '?'. So the |
| 88 // flipping must be disabled. (crbug.com/475237) | 90 // flipping must be disabled. (crbug.com/475237) |
| 89 help_button_->EnableCanvasFlippingForRTLUI(false); | 91 help_button_->EnableCanvasFlippingForRTLUI(false); |
| 90 } | 92 } |
| 91 if (disable_buttons) | 93 if (disable_buttons) |
| 92 help_button_->SetState(views::Button::STATE_DISABLED); | 94 help_button_->SetState(views::Button::STATE_DISABLED); |
| 93 AddChildView(help_button_); | 95 AddChildView(help_button_); |
| 94 AddSeparator(); | 96 AddSeparator(); |
| 95 | 97 |
| 96 #if !defined(OS_WIN) | 98 #if !defined(OS_WIN) |
| 97 lock_button_ = | 99 lock_button_ = |
| 98 new SystemMenuButton(this, kSystemMenuLockIcon, IDS_ASH_STATUS_TRAY_LOCK); | 100 new SystemMenuButton(this, SystemMenuButton::InkDropStyle::FLOOD_FILL, |
| 101 kSystemMenuLockIcon, IDS_ASH_STATUS_TRAY_LOCK); |
| 99 if (disable_buttons || !shell->GetSessionStateDelegate()->CanLockScreen()) | 102 if (disable_buttons || !shell->GetSessionStateDelegate()->CanLockScreen()) |
| 100 lock_button_->SetState(views::Button::STATE_DISABLED); | 103 lock_button_->SetState(views::Button::STATE_DISABLED); |
| 101 | 104 |
| 102 AddChildView(lock_button_); | 105 AddChildView(lock_button_); |
| 103 AddSeparator(); | 106 AddSeparator(); |
| 104 | 107 |
| 105 power_button_ = new SystemMenuButton(this, kSystemMenuPowerIcon, | 108 power_button_ = |
| 106 IDS_ASH_STATUS_TRAY_SHUTDOWN); | 109 new SystemMenuButton(this, SystemMenuButton::InkDropStyle::FLOOD_FILL, |
| 110 kSystemMenuPowerIcon, IDS_ASH_STATUS_TRAY_SHUTDOWN); |
| 107 AddChildView(power_button_); | 111 AddChildView(power_button_); |
| 108 SystemTrayDelegate* system_tray_delegate = shell->system_tray_delegate(); | 112 SystemTrayDelegate* system_tray_delegate = shell->system_tray_delegate(); |
| 109 system_tray_delegate->AddShutdownPolicyObserver(this); | 113 system_tray_delegate->AddShutdownPolicyObserver(this); |
| 110 system_tray_delegate->ShouldRebootOnShutdown(base::Bind( | 114 system_tray_delegate->ShouldRebootOnShutdown(base::Bind( |
| 111 &TilesDefaultView::OnShutdownPolicyChanged, weak_factory_.GetWeakPtr())); | 115 &TilesDefaultView::OnShutdownPolicyChanged, weak_factory_.GetWeakPtr())); |
| 112 #endif // !defined(OS_WIN) | 116 #endif // !defined(OS_WIN) |
| 113 } | 117 } |
| 114 | 118 |
| 115 void TilesDefaultView::ButtonPressed(views::Button* sender, | 119 void TilesDefaultView::ButtonPressed(views::Button* sender, |
| 116 const ui::Event& event) { | 120 const ui::Event& event) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 152 |
| 149 void TilesDefaultView::AddSeparator() { | 153 void TilesDefaultView::AddSeparator() { |
| 150 views::Separator* separator = | 154 views::Separator* separator = |
| 151 new views::Separator(views::Separator::HORIZONTAL); | 155 new views::Separator(views::Separator::HORIZONTAL); |
| 152 separator->SetPreferredSize(kHorizontalSeparatorHeight); | 156 separator->SetPreferredSize(kHorizontalSeparatorHeight); |
| 153 separator->SetColor(kHorizontalSeparatorColor); | 157 separator->SetColor(kHorizontalSeparatorColor); |
| 154 AddChildView(separator); | 158 AddChildView(separator); |
| 155 } | 159 } |
| 156 | 160 |
| 157 } // namespace ash | 161 } // namespace ash |
| OLD | NEW |