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

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

Issue 2821363002: cros: Disable system tray help/lock buttons during supervised user creation (Closed)
Patch Set: fix browser test Created 3 years, 8 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/system/tiles/tiles_default_view.h ('k') | ash/system/tiles/tray_tiles.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/system/tiles/tiles_default_view.h" 5 #include "ash/system/tiles/tiles_default_view.h"
6 6
7 #include "ash/metrics/user_metrics_action.h" 7 #include "ash/metrics/user_metrics_action.h"
8 #include "ash/resources/vector_icons/vector_icons.h" 8 #include "ash/resources/vector_icons/vector_icons.h"
9 #include "ash/session/session_controller.h" 9 #include "ash/session/session_controller.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 19 matching lines...) Expand all
30 namespace { 30 namespace {
31 31
32 // The ISO-639 code for the Hebrew locale. The help icon asset is a '?' which is 32 // The ISO-639 code for the Hebrew locale. The help icon asset is a '?' which is
33 // not mirrored in this locale. 33 // not mirrored in this locale.
34 const char kHebrewLocale[] = "he"; 34 const char kHebrewLocale[] = "he";
35 35
36 } // namespace 36 } // namespace
37 37
38 namespace ash { 38 namespace ash {
39 39
40 TilesDefaultView::TilesDefaultView(SystemTrayItem* owner, LoginStatus login) 40 TilesDefaultView::TilesDefaultView(SystemTrayItem* owner)
41 : owner_(owner), 41 : owner_(owner),
42 login_(login),
43 settings_button_(nullptr), 42 settings_button_(nullptr),
44 help_button_(nullptr), 43 help_button_(nullptr),
45 lock_button_(nullptr), 44 lock_button_(nullptr),
46 power_button_(nullptr) {} 45 power_button_(nullptr) {
46 DCHECK(owner_);
47 }
47 48
48 TilesDefaultView::~TilesDefaultView() {} 49 TilesDefaultView::~TilesDefaultView() = default;
49 50
50 void TilesDefaultView::Init() { 51 void TilesDefaultView::Init() {
51 views::BoxLayout* box_layout = 52 views::BoxLayout* box_layout =
52 new views::BoxLayout(views::BoxLayout::kHorizontal, 4, 0, 0); 53 new views::BoxLayout(views::BoxLayout::kHorizontal, 4, 0, 0);
53 box_layout->set_main_axis_alignment( 54 box_layout->set_main_axis_alignment(
54 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); 55 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START);
55 box_layout->set_cross_axis_alignment( 56 box_layout->set_cross_axis_alignment(
56 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); 57 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
57 SetLayoutManager(box_layout); 58 SetLayoutManager(box_layout);
58 59
59 // 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
60 // 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
61 // |power_button_| which is always shown as enabled. 62 // |power_button_| which is always shown as enabled.
62 const bool disable_buttons = !TrayPopupUtils::CanOpenWebUISettings(login_); 63 const bool disable_buttons = !TrayPopupUtils::CanOpenWebUISettings();
63 64
64 settings_button_ = new SystemMenuButton( 65 settings_button_ = new SystemMenuButton(
65 this, TrayPopupInkDropStyle::HOST_CENTERED, kSystemMenuSettingsIcon, 66 this, TrayPopupInkDropStyle::HOST_CENTERED, kSystemMenuSettingsIcon,
66 IDS_ASH_STATUS_TRAY_SETTINGS); 67 IDS_ASH_STATUS_TRAY_SETTINGS);
67 if (disable_buttons || 68 if (disable_buttons)
68 !Shell::Get()->session_controller()->ShouldEnableSettings())
69 settings_button_->SetEnabled(false); 69 settings_button_->SetEnabled(false);
70 AddChildView(settings_button_); 70 AddChildView(settings_button_);
71 AddChildView(TrayPopupUtils::CreateVerticalSeparator()); 71 AddChildView(TrayPopupUtils::CreateVerticalSeparator());
72 72
73 help_button_ = 73 help_button_ =
74 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED, 74 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED,
75 kSystemMenuHelpIcon, IDS_ASH_STATUS_TRAY_HELP); 75 kSystemMenuHelpIcon, IDS_ASH_STATUS_TRAY_HELP);
76 if (base::i18n::IsRTL() && 76 if (base::i18n::IsRTL() &&
77 base::i18n::GetConfiguredLocale() == kHebrewLocale) { 77 base::i18n::GetConfiguredLocale() == kHebrewLocale) {
78 // The asset for the help button is a question mark '?'. Normally this asset 78 // The asset for the help button is a question mark '?'. Normally this asset
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 views::View* TilesDefaultView::GetHelpButtonView() const { 130 views::View* TilesDefaultView::GetHelpButtonView() const {
131 return help_button_; 131 return help_button_;
132 } 132 }
133 133
134 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest() 134 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest()
135 const { 135 const {
136 return power_button_; 136 return power_button_;
137 } 137 }
138 138
139 } // namespace ash 139 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tiles/tiles_default_view.h ('k') | ash/system/tiles/tray_tiles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698