| Index: ash/common/system/tiles/tiles_default_view.cc
|
| diff --git a/ash/common/system/tiles/tiles_default_view.cc b/ash/common/system/tiles/tiles_default_view.cc
|
| index f84f6dc1a22c45e8f62606921423597907f14cd7..620b210c97043d3c079953f2ce59f041c8e4c886 100644
|
| --- a/ash/common/system/tiles/tiles_default_view.cc
|
| +++ b/ash/common/system/tiles/tiles_default_view.cc
|
| @@ -12,12 +12,14 @@
|
| #include "ash/common/system/tray/system_tray_delegate.h"
|
| #include "ash/common/system/tray/system_tray_item.h"
|
| #include "ash/common/system/tray/tray_constants.h"
|
| +#include "ash/common/system/tray/tray_utils.h"
|
| #include "ash/common/wm_shell.h"
|
| #include "ash/resources/vector_icons/vector_icons.h"
|
| #include "grit/ash_strings.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "ui/gfx/geometry/insets.h"
|
| #include "ui/views/border.h"
|
| +#include "ui/views/controls/button/custom_button.h"
|
| #include "ui/views/controls/separator.h"
|
| #include "ui/views/layout/box_layout.h"
|
|
|
| @@ -36,8 +38,9 @@ const char kHebrewLocale[] = "he";
|
|
|
| namespace ash {
|
|
|
| -TilesDefaultView::TilesDefaultView(SystemTrayItem* owner)
|
| +TilesDefaultView::TilesDefaultView(SystemTrayItem* owner, LoginStatus login)
|
| : owner_(owner),
|
| + login_(login),
|
| settings_button_(nullptr),
|
| help_button_(nullptr),
|
| lock_button_(nullptr),
|
| @@ -64,12 +67,17 @@ void TilesDefaultView::Init() {
|
| views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
|
| SetLayoutManager(box_layout);
|
|
|
| - if (shell->system_tray_delegate()->ShouldShowSettings()) {
|
| - settings_button_ = new SystemMenuButton(this, kSystemMenuSettingsIcon,
|
| - IDS_ASH_STATUS_TRAY_SETTINGS);
|
| - AddChildView(settings_button_);
|
| - AddSeparator();
|
| - }
|
| + // Show the buttons in this row as disabled if the user is at the login
|
| + // screen, lock screen, or in a secondary account flow. The exception is
|
| + // |power_button_| which is always shown as enabled.
|
| + const bool disable_buttons = !CanOpenWebUISettings(login_);
|
| +
|
| + settings_button_ = new SystemMenuButton(this, kSystemMenuSettingsIcon,
|
| + IDS_ASH_STATUS_TRAY_SETTINGS);
|
| + if (disable_buttons || !shell->system_tray_delegate()->ShouldShowSettings())
|
| + settings_button_->SetState(views::Button::STATE_DISABLED);
|
| + AddChildView(settings_button_);
|
| + AddSeparator();
|
|
|
| help_button_ =
|
| new SystemMenuButton(this, kSystemMenuHelpIcon, IDS_ASH_STATUS_TRAY_HELP);
|
| @@ -80,21 +88,23 @@ void TilesDefaultView::Init() {
|
| // flipping must be disabled. (crbug.com/475237)
|
| help_button_->EnableCanvasFlippingForRTLUI(false);
|
| }
|
| + if (disable_buttons)
|
| + help_button_->SetState(views::Button::STATE_DISABLED);
|
| AddChildView(help_button_);
|
| + AddSeparator();
|
|
|
| #if !defined(OS_WIN)
|
| - if (shell->GetSessionStateDelegate()->CanLockScreen()) {
|
| - AddSeparator();
|
| - lock_button_ = new SystemMenuButton(this, kSystemMenuLockIcon,
|
| - IDS_ASH_STATUS_TRAY_LOCK);
|
| - AddChildView(lock_button_);
|
| - }
|
| + lock_button_ =
|
| + new SystemMenuButton(this, kSystemMenuLockIcon, IDS_ASH_STATUS_TRAY_LOCK);
|
| + if (disable_buttons || !shell->GetSessionStateDelegate()->CanLockScreen())
|
| + lock_button_->SetState(views::Button::STATE_DISABLED);
|
|
|
| + AddChildView(lock_button_);
|
| AddSeparator();
|
| +
|
| power_button_ = new SystemMenuButton(this, kSystemMenuPowerIcon,
|
| IDS_ASH_STATUS_TRAY_SHUTDOWN);
|
| AddChildView(power_button_);
|
| -
|
| SystemTrayDelegate* system_tray_delegate = shell->system_tray_delegate();
|
| system_tray_delegate->AddShutdownPolicyObserver(this);
|
| system_tray_delegate->ShouldRebootOnShutdown(base::Bind(
|
|
|