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

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

Issue 2652093002: mash: Make the power button shut the system down. (Closed)
Patch Set: add comment about CursorManager Created 3 years, 11 months 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
« no previous file with comments | « ash/common/system/date/date_default_view.cc ('k') | ash/common/wm_shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/shutdown_controller.h" 9 #include "ash/common/shutdown_controller.h"
10 #include "ash/common/system/tray/system_menu_button.h" 10 #include "ash/common/system/tray/system_menu_button.h"
11 #include "ash/common/system/tray/system_tray.h" 11 #include "ash/common/system/tray/system_tray.h"
12 #include "ash/common/system/tray/system_tray_controller.h" 12 #include "ash/common/system/tray/system_tray_controller.h"
13 #include "ash/common/system/tray/system_tray_delegate.h" 13 #include "ash/common/system/tray/system_tray_delegate.h"
14 #include "ash/common/system/tray/system_tray_item.h" 14 #include "ash/common/system/tray/system_tray_item.h"
15 #include "ash/common/system/tray/tray_constants.h" 15 #include "ash/common/system/tray/tray_constants.h"
16 #include "ash/common/system/tray/tray_popup_utils.h" 16 #include "ash/common/system/tray/tray_popup_utils.h"
17 #include "ash/common/wm_shell.h" 17 #include "ash/common/wm_shell.h"
18 #include "ash/resources/vector_icons/vector_icons.h" 18 #include "ash/resources/vector_icons/vector_icons.h"
19 #include "ash/shell.h"
20 #include "ash/wm/lock_state_controller.h"
19 #include "chromeos/dbus/dbus_thread_manager.h" 21 #include "chromeos/dbus/dbus_thread_manager.h"
20 #include "chromeos/dbus/session_manager_client.h" 22 #include "chromeos/dbus/session_manager_client.h"
21 #include "grit/ash_strings.h" 23 #include "grit/ash_strings.h"
22 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/gfx/geometry/insets.h" 25 #include "ui/gfx/geometry/insets.h"
24 #include "ui/views/border.h" 26 #include "ui/views/border.h"
25 #include "ui/views/controls/button/custom_button.h" 27 #include "ui/views/controls/button/custom_button.h"
26 #include "ui/views/controls/separator.h" 28 #include "ui/views/controls/separator.h"
27 #include "ui/views/layout/box_layout.h" 29 #include "ui/views/layout/box_layout.h"
28 30
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } else if (sender == help_button_) { 116 } else if (sender == help_button_) {
115 shell->RecordUserMetricsAction(UMA_TRAY_HELP); 117 shell->RecordUserMetricsAction(UMA_TRAY_HELP);
116 shell->system_tray_controller()->ShowHelp(); 118 shell->system_tray_controller()->ShowHelp();
117 } else if (sender == lock_button_) { 119 } else if (sender == lock_button_) {
118 shell->RecordUserMetricsAction(UMA_TRAY_LOCK_SCREEN); 120 shell->RecordUserMetricsAction(UMA_TRAY_LOCK_SCREEN);
119 chromeos::DBusThreadManager::Get() 121 chromeos::DBusThreadManager::Get()
120 ->GetSessionManagerClient() 122 ->GetSessionManagerClient()
121 ->RequestLockScreen(); 123 ->RequestLockScreen();
122 } else if (sender == power_button_) { 124 } else if (sender == power_button_) {
123 shell->RecordUserMetricsAction(UMA_TRAY_SHUT_DOWN); 125 shell->RecordUserMetricsAction(UMA_TRAY_SHUT_DOWN);
124 shell->RequestShutdown(); 126 Shell::GetInstance()->lock_state_controller()->RequestShutdown();
125 } 127 }
126 128
127 owner_->system_tray()->CloseSystemBubble(); 129 owner_->system_tray()->CloseSystemBubble();
128 } 130 }
129 131
130 views::View* TilesDefaultView::GetHelpButtonView() const { 132 views::View* TilesDefaultView::GetHelpButtonView() const {
131 return help_button_; 133 return help_button_;
132 } 134 }
133 135
134 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest() 136 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest()
135 const { 137 const {
136 return power_button_; 138 return power_button_;
137 } 139 }
138 140
139 } // namespace ash 141 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/date/date_default_view.cc ('k') | ash/common/wm_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698