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