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

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

Issue 2822033002: cros: Use SessionController to enable system tray settings / notifications tray (Closed)
Patch Set: 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
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"
11 #include "ash/shell_port.h" 11 #include "ash/shell_port.h"
12 #include "ash/shutdown_controller.h" 12 #include "ash/shutdown_controller.h"
13 #include "ash/strings/grit/ash_strings.h" 13 #include "ash/strings/grit/ash_strings.h"
14 #include "ash/system/tray/system_menu_button.h" 14 #include "ash/system/tray/system_menu_button.h"
15 #include "ash/system/tray/system_tray.h" 15 #include "ash/system/tray/system_tray.h"
16 #include "ash/system/tray/system_tray_controller.h" 16 #include "ash/system/tray/system_tray_controller.h"
17 #include "ash/system/tray/system_tray_delegate.h"
18 #include "ash/system/tray/system_tray_item.h" 17 #include "ash/system/tray/system_tray_item.h"
19 #include "ash/system/tray/tray_constants.h" 18 #include "ash/system/tray/tray_constants.h"
20 #include "ash/system/tray/tray_popup_utils.h" 19 #include "ash/system/tray/tray_popup_utils.h"
21 #include "ash/wm/lock_state_controller.h" 20 #include "ash/wm/lock_state_controller.h"
22 #include "chromeos/dbus/dbus_thread_manager.h" 21 #include "chromeos/dbus/dbus_thread_manager.h"
23 #include "chromeos/dbus/session_manager_client.h" 22 #include "chromeos/dbus/session_manager_client.h"
24 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/gfx/geometry/insets.h" 24 #include "ui/gfx/geometry/insets.h"
26 #include "ui/views/border.h" 25 #include "ui/views/border.h"
27 #include "ui/views/controls/button/custom_button.h" 26 #include "ui/views/controls/button/custom_button.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 58
60 // Show the buttons in this row as disabled if the user is at the login 59 // Show the buttons in this row as disabled if the user is at the login
61 // screen, lock screen, or in a secondary account flow. The exception is 60 // screen, lock screen, or in a secondary account flow. The exception is
62 // |power_button_| which is always shown as enabled. 61 // |power_button_| which is always shown as enabled.
63 const bool disable_buttons = !TrayPopupUtils::CanOpenWebUISettings(login_); 62 const bool disable_buttons = !TrayPopupUtils::CanOpenWebUISettings(login_);
64 63
65 settings_button_ = new SystemMenuButton( 64 settings_button_ = new SystemMenuButton(
66 this, TrayPopupInkDropStyle::HOST_CENTERED, kSystemMenuSettingsIcon, 65 this, TrayPopupInkDropStyle::HOST_CENTERED, kSystemMenuSettingsIcon,
67 IDS_ASH_STATUS_TRAY_SETTINGS); 66 IDS_ASH_STATUS_TRAY_SETTINGS);
68 if (disable_buttons || 67 if (disable_buttons ||
69 !Shell::Get()->system_tray_delegate()->ShouldShowSettings()) 68 !Shell::Get()->session_controller()->ShouldEnableSettings())
70 settings_button_->SetEnabled(false); 69 settings_button_->SetEnabled(false);
71 AddChildView(settings_button_); 70 AddChildView(settings_button_);
72 AddChildView(TrayPopupUtils::CreateVerticalSeparator()); 71 AddChildView(TrayPopupUtils::CreateVerticalSeparator());
73 72
74 help_button_ = 73 help_button_ =
75 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED, 74 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED,
76 kSystemMenuHelpIcon, IDS_ASH_STATUS_TRAY_HELP); 75 kSystemMenuHelpIcon, IDS_ASH_STATUS_TRAY_HELP);
77 if (base::i18n::IsRTL() && 76 if (base::i18n::IsRTL() &&
78 base::i18n::GetConfiguredLocale() == kHebrewLocale) { 77 base::i18n::GetConfiguredLocale() == kHebrewLocale) {
79 // 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
131 views::View* TilesDefaultView::GetHelpButtonView() const { 130 views::View* TilesDefaultView::GetHelpButtonView() const {
132 return help_button_; 131 return help_button_;
133 } 132 }
134 133
135 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest() 134 const views::CustomButton* TilesDefaultView::GetShutdownButtonViewForTest()
136 const { 135 const {
137 return power_button_; 136 return power_button_;
138 } 137 }
139 138
140 } // namespace ash 139 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698