OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef ASH_SYSTEM_CHROMEOS_SUPERVISED_TRAY_SUPERVISED_USER_H | 5 #ifndef ASH_SYSTEM_CHROMEOS_SUPERVISED_TRAY_SUPERVISED_USER_H |
6 #define ASH_SYSTEM_CHROMEOS_SUPERVISED_TRAY_SUPERVISED_USER_H | 6 #define ASH_SYSTEM_CHROMEOS_SUPERVISED_TRAY_SUPERVISED_USER_H |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/system/chromeos/supervised/custodian_info_tray_observer.h" | 9 #include "ash/system/chromeos/supervised/custodian_info_tray_observer.h" |
10 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
11 #include "ash/system/tray/view_click_listener.h" | 11 #include "ash/system/tray/view_click_listener.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 | 13 |
14 namespace ash { | 14 namespace ash { |
15 class LabelTrayView; | 15 class LabelTrayView; |
16 class SystemTray; | 16 class SystemTray; |
17 | 17 |
18 class ASH_EXPORT TraySupervisedUser : public SystemTrayItem, | 18 class ASH_EXPORT TraySupervisedUser : public SystemTrayItem, |
19 public ViewClickListener, | 19 public ViewClickListener, |
20 public CustodianInfoTrayObserver { | 20 public CustodianInfoTrayObserver { |
21 public: | 21 public: |
22 explicit TraySupervisedUser(SystemTray* system_tray); | 22 explicit TraySupervisedUser(SystemTray* system_tray); |
23 virtual ~TraySupervisedUser(); | 23 ~TraySupervisedUser() override; |
24 | 24 |
25 // If message is not empty updates content of default view, otherwise hides | 25 // If message is not empty updates content of default view, otherwise hides |
26 // tray items. | 26 // tray items. |
27 void UpdateMessage(); | 27 void UpdateMessage(); |
28 | 28 |
29 // Overridden from SystemTrayItem. | 29 // Overridden from SystemTrayItem. |
30 virtual views::View* CreateDefaultView(user::LoginStatus status) override; | 30 views::View* CreateDefaultView(user::LoginStatus status) override; |
31 virtual void DestroyDefaultView() override; | 31 void DestroyDefaultView() override; |
32 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) override; | 32 void UpdateAfterLoginStatusChange(user::LoginStatus status) override; |
33 | 33 |
34 // Overridden from ViewClickListener. | 34 // Overridden from ViewClickListener. |
35 virtual void OnViewClicked(views::View* sender) override; | 35 void OnViewClicked(views::View* sender) override; |
36 | 36 |
37 // Overridden from CustodianInfoTrayObserver: | 37 // Overridden from CustodianInfoTrayObserver: |
38 virtual void OnCustodianInfoChanged() override; | 38 void OnCustodianInfoChanged() override; |
39 | 39 |
40 private: | 40 private: |
41 friend class TraySupervisedUserTest; | 41 friend class TraySupervisedUserTest; |
42 | 42 |
43 static const char kNotificationId[]; | 43 static const char kNotificationId[]; |
44 | 44 |
45 void CreateOrUpdateNotification(const base::string16& new_message); | 45 void CreateOrUpdateNotification(const base::string16& new_message); |
46 | 46 |
47 void CreateOrUpdateSupervisedWarningNotification(); | 47 void CreateOrUpdateSupervisedWarningNotification(); |
48 | 48 |
49 LabelTrayView* tray_view_; | 49 LabelTrayView* tray_view_; |
50 | 50 |
51 // Previous login status to avoid showing notification upon unlock. | 51 // Previous login status to avoid showing notification upon unlock. |
52 user::LoginStatus status_; | 52 user::LoginStatus status_; |
53 | 53 |
54 // Previous user supervised state to avoid showing notification upon unlock. | 54 // Previous user supervised state to avoid showing notification upon unlock. |
55 bool is_user_supervised_; | 55 bool is_user_supervised_; |
56 | 56 |
57 DISALLOW_COPY_AND_ASSIGN(TraySupervisedUser); | 57 DISALLOW_COPY_AND_ASSIGN(TraySupervisedUser); |
58 }; | 58 }; |
59 | 59 |
60 } // namespace ash | 60 } // namespace ash |
61 | 61 |
62 #endif // ASH_SYSTEM_CHROMEOS_SUPERVISED_TRAY_SUPERVISED_USER_H | 62 #endif // ASH_SYSTEM_CHROMEOS_SUPERVISED_TRAY_SUPERVISED_USER_H |
OLD | NEW |