1 // Copyright 2014 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.
5 #ifndef ASH_SYSTEM_CHROMEOS_SUPERVISED_TRAY_SUPERVISED_USER_H
6 #define ASH_SYSTEM_CHROMEOS_SUPERVISED_TRAY_SUPERVISED_USER_H
8 #include "ash/ash_export.h"
9 #include "ash/system/chromeos/supervised/custodian_info_tray_observer.h"
10 #include "ash/system/tray/system_tray_item.h"
11 #include "ash/system/tray/view_click_listener.h"
12 #include "base/strings/string16.h"
18 class ASH_EXPORT TraySupervisedUser
: public SystemTrayItem
,
19 public ViewClickListener
,
20 public CustodianInfoTrayObserver
{
22 explicit TraySupervisedUser(SystemTray
* system_tray
);
23 ~TraySupervisedUser() override
;
25 // If message is not empty updates content of default view, otherwise hides
29 // Overridden from SystemTrayItem.
30 views::View
* CreateDefaultView(user::LoginStatus status
) override
;
31 void DestroyDefaultView() override
;
32 void UpdateAfterLoginStatusChange(user::LoginStatus status
) override
;
34 // Overridden from ViewClickListener.
35 void OnViewClicked(views::View
* sender
) override
;
37 // Overridden from CustodianInfoTrayObserver:
38 void OnCustodianInfoChanged() override
;
41 friend class TraySupervisedUserTest
;
43 static const char kNotificationId
[];
45 void CreateOrUpdateNotification(const base::string16
& new_message
);
47 void CreateOrUpdateSupervisedWarningNotification();
49 int GetSupervisedUserIconId() const;
51 LabelTrayView
* tray_view_
;
53 // Previous login status to avoid showing notification upon unlock.
54 user::LoginStatus status_
;
56 // Previous user supervised state to avoid showing notification upon unlock.
57 bool is_user_supervised_
;
59 DISALLOW_COPY_AND_ASSIGN(TraySupervisedUser
);
64 #endif // ASH_SYSTEM_CHROMEOS_SUPERVISED_TRAY_SUPERVISED_USER_H