| OLD | NEW |
| 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/tray_tiles.h" | 5 #include "ash/common/system/tiles/tray_tiles.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_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/system/tiles/tiles_default_view.h" | 9 #include "ash/common/system/tiles/tiles_default_view.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 | 13 |
| 14 TrayTiles::TrayTiles(SystemTray* system_tray) | 14 TrayTiles::TrayTiles(SystemTray* system_tray) |
| 15 : SystemTrayItem(system_tray, UMA_NOT_RECORDED), default_view_(nullptr) {} | 15 : SystemTrayItem(system_tray, UMA_NOT_RECORDED), default_view_(nullptr) {} |
| 16 | 16 |
| 17 TrayTiles::~TrayTiles() {} | 17 TrayTiles::~TrayTiles() {} |
| 18 | 18 |
| 19 views::View* TrayTiles::CreateDefaultView(LoginStatus status) { | 19 views::View* TrayTiles::CreateDefaultView(LoginStatus status) { |
| 20 WmShell* shell = WmShell::Get(); | |
| 21 const bool adding_user = | |
| 22 shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | |
| 23 | |
| 24 if (status == LoginStatus::LOCKED || status == LoginStatus::NOT_LOGGED_IN || | |
| 25 adding_user) { | |
| 26 return nullptr; | |
| 27 } | |
| 28 | |
| 29 CHECK(default_view_ == nullptr); | 20 CHECK(default_view_ == nullptr); |
| 30 default_view_ = new TilesDefaultView(this); | 21 default_view_ = new TilesDefaultView(this, status); |
| 31 default_view_->Init(); | 22 default_view_->Init(); |
| 32 | |
| 33 return default_view_; | 23 return default_view_; |
| 34 } | 24 } |
| 35 | 25 |
| 36 void TrayTiles::DestroyDefaultView() { | 26 void TrayTiles::DestroyDefaultView() { |
| 37 default_view_ = nullptr; | 27 default_view_ = nullptr; |
| 38 } | 28 } |
| 39 | 29 |
| 40 } // namespace ash | 30 } // namespace ash |
| OLD | NEW |