tray_user_separator.cc revision f2477e01787aa58f445919b809d89e252beef54f
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_state_delegate.h"
8#include "ash/shell.h"
9#include "ui/views/view.h"
10
11namespace ash {
12namespace internal {
13
14TrayUserSeparator::TrayUserSeparator(SystemTray* system_tray)
15    : SystemTrayItem(system_tray),
16      separator_shown_(false) {
17}
18
19views::View* TrayUserSeparator::CreateTrayView(user::LoginStatus status) {
20  return NULL;
21}
22
23views::View* TrayUserSeparator::CreateDefaultView(user::LoginStatus status) {
24  if (status == user::LOGGED_IN_NONE)
25    return NULL;
26
27  const SessionStateDelegate* session_state_delegate =
28      Shell::GetInstance()->session_state_delegate();
29
30  // If the screen is locked, or only a single user is shown, show nothing.
31  if (session_state_delegate->IsUserSessionBlocked() ||
32      session_state_delegate->NumberOfLoggedInUsers() < 2)
33    return NULL;
34
35  separator_shown_ = true;
36  return new views::View();
37}
38
39views::View* TrayUserSeparator::CreateDetailedView(user::LoginStatus status) {
40  return NULL;
41}
42
43void TrayUserSeparator::DestroyDefaultView() {
44  separator_shown_ = false;
45}
46
47}  // namespace internal
48}  // namespace ash
49