Chromium Code Reviews| Index: ash/system/overview/overview_button_tray.cc |
| diff --git a/ash/system/overview/overview_button_tray.cc b/ash/system/overview/overview_button_tray.cc |
| index 4ca41668d8f050713dab76be5f83bf45806d7add..916ee231790751f565daa7a4ec1f95d7af6c5df2 100644 |
| --- a/ash/system/overview/overview_button_tray.cc |
| +++ b/ash/system/overview/overview_button_tray.cc |
| @@ -6,6 +6,7 @@ |
| #include "ash/shelf/shelf_types.h" |
| #include "ash/shell.h" |
| +#include "ash/system/tray/system_tray_delegate.h" |
| #include "ash/system/tray/tray_utils.h" |
| #include "ash/wm/overview/window_selector_controller.h" |
| #include "grit/ash_resources.h" |
| @@ -41,7 +42,7 @@ OverviewButtonTray::OverviewButtonTray( |
| SetIconBorderForShelfAlignment(); |
| tray_container()->AddChildView(icon_); |
| - SetVisible(Shell::GetInstance()->IsMaximizeModeWindowManagerEnabled()); |
| + SetVisible(false); |
|
flackr
2014/03/26 21:00:12
Won't this fail when a display is added while in m
|
| Shell::GetInstance()->AddShellObserver(this); |
| } |
| @@ -56,7 +57,8 @@ bool OverviewButtonTray::PerformAction(const ui::Event& event) { |
| } |
| void OverviewButtonTray::OnMaximizeModeStarted() { |
| - SetVisible(true); |
| + SetVisible(ShouldBeVisibleForLoginStatus(Shell::GetInstance()-> |
| + system_tray_delegate()->GetUserLoginStatus())); |
| } |
| void OverviewButtonTray::OnMaximizeModeEnded() { |
| @@ -103,4 +105,19 @@ void OverviewButtonTray::SetIconBorderForShelfAlignment() { |
| } |
| } |
| +void OverviewButtonTray::UpdateAfterLoginStatusChange( |
| + user::LoginStatus status) { |
| + SetVisible(Shell::GetInstance()->IsMaximizeModeWindowManagerEnabled() && |
| + ShouldBeVisibleForLoginStatus(status)); |
|
flackr
2014/03/26 21:00:12
Try to avoid repeating logic like this, it makes i
jonross
2014/03/28 16:47:04
Done.
|
| +} |
| + |
| +bool OverviewButtonTray::ShouldBeVisibleForLoginStatus( |
| + user::LoginStatus status) { |
| + return status == user::LOGGED_IN_USER || |
| + status == user::LOGGED_IN_OWNER || |
| + status == user::LOGGED_IN_GUEST || |
| + status == user::LOGGED_IN_PUBLIC || |
| + status == user::LOGGED_IN_LOCALLY_MANAGED; |
|
flackr
2014/03/26 21:00:12
Can you try to unify this with https://code.google
jonross
2014/03/28 16:47:04
Done.
|
| +} |
| + |
| } // namespace ash |