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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 | 104 |
105 AddChildView(lock_button_); | 105 AddChildView(lock_button_); |
106 AddChildView(TrayPopupUtils::CreateVerticalSeparator()); | 106 AddChildView(TrayPopupUtils::CreateVerticalSeparator()); |
107 | 107 |
108 power_button_ = | 108 power_button_ = |
109 new SystemMenuButton(this, SystemMenuButton::InkDropStyle::FLOOD_FILL, | 109 new SystemMenuButton(this, SystemMenuButton::InkDropStyle::FLOOD_FILL, |
110 kSystemMenuPowerIcon, IDS_ASH_STATUS_TRAY_SHUTDOWN); | 110 kSystemMenuPowerIcon, IDS_ASH_STATUS_TRAY_SHUTDOWN); |
111 AddChildView(power_button_); | 111 AddChildView(power_button_); |
112 SystemTrayDelegate* system_tray_delegate = shell->system_tray_delegate(); | 112 SystemTrayDelegate* system_tray_delegate = shell->system_tray_delegate(); |
113 system_tray_delegate->AddShutdownPolicyObserver(this); | 113 system_tray_delegate->AddShutdownPolicyObserver(this); |
114 system_tray_delegate->ShouldRebootOnShutdown(base::Bind( | 114 // Will invoke OnShutdownPolicyChanged with the initial value. |
115 &TilesDefaultView::OnShutdownPolicyChanged, weak_factory_.GetWeakPtr())); | 115 system_tray_delegate->CheckIfRebootOnShutdown(); |
116 #endif // !defined(OS_WIN) | 116 #endif // !defined(OS_WIN) |
James Cook
2016/11/10 23:33:54
FYI - The above code is forked/copied because it's
| |
117 } | 117 } |
118 | 118 |
119 void TilesDefaultView::ButtonPressed(views::Button* sender, | 119 void TilesDefaultView::ButtonPressed(views::Button* sender, |
120 const ui::Event& event) { | 120 const ui::Event& event) { |
121 DCHECK(sender); | 121 DCHECK(sender); |
122 WmShell* shell = WmShell::Get(); | 122 WmShell* shell = WmShell::Get(); |
123 if (sender == settings_button_) { | 123 if (sender == settings_button_) { |
124 shell->RecordUserMetricsAction(UMA_TRAY_SETTINGS); | 124 shell->RecordUserMetricsAction(UMA_TRAY_SETTINGS); |
125 shell->system_tray_controller()->ShowSettings(); | 125 shell->system_tray_controller()->ShowSettings(); |
126 } else if (sender == help_button_) { | 126 } else if (sender == help_button_) { |
(...skipping 26 matching lines...) Expand all Loading... | |
153 views::View* TilesDefaultView::GetHelpButtonView() const { | 153 views::View* TilesDefaultView::GetHelpButtonView() const { |
154 return help_button_; | 154 return help_button_; |
155 } | 155 } |
156 | 156 |
157 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest() | 157 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest() |
158 const { | 158 const { |
159 return power_button_; | 159 return power_button_; |
160 } | 160 } |
161 | 161 |
162 } // namespace ash | 162 } // namespace ash |
OLD | NEW |