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

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

Issue 2775973002: Promotes more accessors from WmShell to Shell (Closed)
Patch Set: feedback 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 : owner_(owner), 42 : owner_(owner),
43 login_(login), 43 login_(login),
44 settings_button_(nullptr), 44 settings_button_(nullptr),
45 help_button_(nullptr), 45 help_button_(nullptr),
46 lock_button_(nullptr), 46 lock_button_(nullptr),
47 power_button_(nullptr) {} 47 power_button_(nullptr) {}
48 48
49 TilesDefaultView::~TilesDefaultView() {} 49 TilesDefaultView::~TilesDefaultView() {}
50 50
51 void TilesDefaultView::Init() { 51 void TilesDefaultView::Init() {
52 WmShell* shell = WmShell::Get();
53 views::BoxLayout* box_layout = 52 views::BoxLayout* box_layout =
54 new views::BoxLayout(views::BoxLayout::kHorizontal, 4, 0, 0); 53 new views::BoxLayout(views::BoxLayout::kHorizontal, 4, 0, 0);
55 box_layout->set_main_axis_alignment( 54 box_layout->set_main_axis_alignment(
56 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); 55 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START);
57 box_layout->set_cross_axis_alignment( 56 box_layout->set_cross_axis_alignment(
58 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); 57 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
59 SetLayoutManager(box_layout); 58 SetLayoutManager(box_layout);
60 59
61 // Show the buttons in this row as disabled if the user is at the login 60 // Show the buttons in this row as disabled if the user is at the login
62 // screen, lock screen, or in a secondary account flow. The exception is 61 // screen, lock screen, or in a secondary account flow. The exception is
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 94
96 AddChildView(lock_button_); 95 AddChildView(lock_button_);
97 AddChildView(TrayPopupUtils::CreateVerticalSeparator()); 96 AddChildView(TrayPopupUtils::CreateVerticalSeparator());
98 97
99 power_button_ = 98 power_button_ =
100 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED, 99 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED,
101 kSystemMenuPowerIcon, IDS_ASH_STATUS_TRAY_SHUTDOWN); 100 kSystemMenuPowerIcon, IDS_ASH_STATUS_TRAY_SHUTDOWN);
102 AddChildView(power_button_); 101 AddChildView(power_button_);
103 // This object is recreated every time the menu opens. Don't bother updating 102 // 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. 103 // the tooltip if the shutdown policy changes while the menu is open.
105 bool reboot = shell->shutdown_controller()->reboot_on_shutdown(); 104 bool reboot = Shell::Get()->shutdown_controller()->reboot_on_shutdown();
106 power_button_->SetTooltipText(l10n_util::GetStringUTF16( 105 power_button_->SetTooltipText(l10n_util::GetStringUTF16(
107 reboot ? IDS_ASH_STATUS_TRAY_REBOOT : IDS_ASH_STATUS_TRAY_SHUTDOWN)); 106 reboot ? IDS_ASH_STATUS_TRAY_REBOOT : IDS_ASH_STATUS_TRAY_SHUTDOWN));
108 } 107 }
109 108
110 void TilesDefaultView::ButtonPressed(views::Button* sender, 109 void TilesDefaultView::ButtonPressed(views::Button* sender,
111 const ui::Event& event) { 110 const ui::Event& event) {
112 DCHECK(sender); 111 DCHECK(sender);
113 WmShell* shell = WmShell::Get(); 112 WmShell* shell = WmShell::Get();
114 if (sender == settings_button_) { 113 if (sender == settings_button_) {
115 shell->RecordUserMetricsAction(UMA_TRAY_SETTINGS); 114 shell->RecordUserMetricsAction(UMA_TRAY_SETTINGS);
(...skipping 17 matching lines...) Expand all
133 views::View* TilesDefaultView::GetHelpButtonView() const { 132 views::View* TilesDefaultView::GetHelpButtonView() const {
134 return help_button_; 133 return help_button_;
135 } 134 }
136 135
137 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest() 136 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest()
138 const { 137 const {
139 return power_button_; 138 return power_button_;
140 } 139 }
141 140
142 } // namespace ash 141 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/overview/overview_button_tray.cc ('k') | ash/common/system/tray/system_tray_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698