summaryrefslogtreecommitdiffstats
path: root/ash/system/user/tray_user_separator.cc
blob: dd60f6ba4e9be802276016daa78c94446d613581 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/system/user/tray_user_separator.h"

#include "ash/session_state_delegate.h"
#include "ash/shell.h"
#include "ui/views/view.h"

namespace ash {

TrayUserSeparator::TrayUserSeparator(SystemTray* system_tray)
    : SystemTrayItem(system_tray),
      separator_shown_(false) {
}

views::View* TrayUserSeparator::CreateTrayView(user::LoginStatus status) {
  return NULL;
}

views::View* TrayUserSeparator::CreateDefaultView(user::LoginStatus status) {
  if (status == user::LOGGED_IN_NONE)
    return NULL;

  const SessionStateDelegate* session_state_delegate =
      Shell::GetInstance()->session_state_delegate();

  // If the screen is locked, or only a single user is shown, show nothing.
  if (session_state_delegate->IsUserSessionBlocked() ||
      session_state_delegate->NumberOfLoggedInUsers() < 2)
    return NULL;

  separator_shown_ = true;
  return new views::View();
}

views::View* TrayUserSeparator::CreateDetailedView(user::LoginStatus status) {
  return NULL;
}

void TrayUserSeparator::DestroyDefaultView() {
  separator_shown_ = false;
}

}  // namespace ash