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

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

Issue 2761373002: Move yet more from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 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
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_controller.h" 8 #include "ash/common/session/session_controller.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"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 help_button_->EnableCanvasFlippingForRTLUI(false); 83 help_button_->EnableCanvasFlippingForRTLUI(false);
84 } 84 }
85 if (disable_buttons) 85 if (disable_buttons)
86 help_button_->SetEnabled(false); 86 help_button_->SetEnabled(false);
87 AddChildView(help_button_); 87 AddChildView(help_button_);
88 AddChildView(TrayPopupUtils::CreateVerticalSeparator()); 88 AddChildView(TrayPopupUtils::CreateVerticalSeparator());
89 89
90 lock_button_ = 90 lock_button_ =
91 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED, 91 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED,
92 kSystemMenuLockIcon, IDS_ASH_STATUS_TRAY_LOCK); 92 kSystemMenuLockIcon, IDS_ASH_STATUS_TRAY_LOCK);
93 if (disable_buttons || !shell->session_controller()->CanLockScreen()) 93 if (disable_buttons || !Shell::Get()->session_controller()->CanLockScreen())
94 lock_button_->SetEnabled(false); 94 lock_button_->SetEnabled(false);
95 95
96 AddChildView(lock_button_); 96 AddChildView(lock_button_);
97 AddChildView(TrayPopupUtils::CreateVerticalSeparator()); 97 AddChildView(TrayPopupUtils::CreateVerticalSeparator());
98 98
99 power_button_ = 99 power_button_ =
100 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED, 100 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED,
101 kSystemMenuPowerIcon, IDS_ASH_STATUS_TRAY_SHUTDOWN); 101 kSystemMenuPowerIcon, IDS_ASH_STATUS_TRAY_SHUTDOWN);
102 AddChildView(power_button_); 102 AddChildView(power_button_);
103 // This object is recreated every time the menu opens. Don't bother updating 103 // This object is recreated every time the menu opens. Don't bother updating
104 // the tooltip if the shutdown policy changes while the menu is open. 104 // the tooltip if the shutdown policy changes while the menu is open.
105 bool reboot = WmShell::Get()->shutdown_controller()->reboot_on_shutdown(); 105 bool reboot = shell->shutdown_controller()->reboot_on_shutdown();
106 power_button_->SetTooltipText(l10n_util::GetStringUTF16( 106 power_button_->SetTooltipText(l10n_util::GetStringUTF16(
107 reboot ? IDS_ASH_STATUS_TRAY_REBOOT : IDS_ASH_STATUS_TRAY_SHUTDOWN)); 107 reboot ? IDS_ASH_STATUS_TRAY_REBOOT : IDS_ASH_STATUS_TRAY_SHUTDOWN));
108 } 108 }
109 109
110 void TilesDefaultView::ButtonPressed(views::Button* sender, 110 void TilesDefaultView::ButtonPressed(views::Button* sender,
111 const ui::Event& event) { 111 const ui::Event& event) {
112 DCHECK(sender); 112 DCHECK(sender);
113 WmShell* shell = WmShell::Get(); 113 WmShell* shell = WmShell::Get();
114 if (sender == settings_button_) { 114 if (sender == settings_button_) {
115 shell->RecordUserMetricsAction(UMA_TRAY_SETTINGS); 115 shell->RecordUserMetricsAction(UMA_TRAY_SETTINGS);
(...skipping 17 matching lines...) Expand all
133 views::View* TilesDefaultView::GetHelpButtonView() const { 133 views::View* TilesDefaultView::GetHelpButtonView() const {
134 return help_button_; 134 return help_button_;
135 } 135 }
136 136
137 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest() 137 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest()
138 const { 138 const {
139 return power_button_; 139 return power_button_;
140 } 140 }
141 141
142 } // namespace ash 142 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/overview/overview_button_tray.cc ('k') | ash/common/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698