tray_user_separator.cc revision 5c02ac1a9c1b504631c0a3d2b6e737b5d738bae1
1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ash/system/user/tray_user_separator.h"
6
7#include "ash/session/session_state_delegate.h"
8#include "ash/shell.h"
9#include "ui/views/view.h"
10
11namespace ash {
12
13TrayUserSeparator::TrayUserSeparator(SystemTray* system_tray)
14    : SystemTrayItem(system_tray),
15      separator_shown_(false) {
16}
17
18views::View* TrayUserSeparator::CreateTrayView(user::LoginStatus status) {
19  return NULL;
20}
21
22views::View* TrayUserSeparator::CreateDefaultView(user::LoginStatus status) {
23  if (status == user::LOGGED_IN_NONE)
24    return NULL;
25
26  const SessionStateDelegate* session_state_delegate =
27      Shell::GetInstance()->session_state_delegate();
28
29  // If the screen is locked, or only a single user is shown, show nothing.
30  if (session_state_delegate->IsUserSessionBlocked() ||
31      session_state_delegate->NumberOfLoggedInUsers() < 2)
32    return NULL;
33
34  separator_shown_ = true;
35  return new views::View();
36}
37
38views::View* TrayUserSeparator::CreateDetailedView(user::LoginStatus status) {
39  return NULL;
40}
41
42void TrayUserSeparator::DestroyDefaultView() {
43  separator_shown_ = false;
44}
45
46}  // namespace ash
47