Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(634)

Side by Side Diff: ash/common/system/tiles/tiles_default_view.cc

Issue 2492063002: chromeos: Simplify ShutdownPolicyHandler
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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)
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();
(...skipping 27 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « ash/common/system/date/date_default_view.cc ('k') | ash/common/system/tray/system_tray_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698