Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Side by Side Diff: ash/system/supervised/tray_supervised_user.h

Issue 2832903002: cros: Remove supervised user methods from SystemTrayDelegate (Closed)
Patch Set: ready Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_SUPERVISED_TRAY_SUPERVISED_USER_H_ 5 #ifndef ASH_SYSTEM_SUPERVISED_TRAY_SUPERVISED_USER_H_
6 #define ASH_SYSTEM_SUPERVISED_TRAY_SUPERVISED_USER_H_ 6 #define ASH_SYSTEM_SUPERVISED_TRAY_SUPERVISED_USER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/system/supervised/custodian_info_tray_observer.h" 9 #include "ash/session/session_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"
12 #include "base/macros.h" 11 #include "base/macros.h"
13 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
14 13
15 namespace gfx { 14 namespace ash {
16 struct VectorIcon;
17 } // namespace gfx
18 15
19 namespace ash {
20 class LabelTrayView;
21 class SystemTray; 16 class SystemTray;
22 17
18 // System tray item that shows a message if the user is supervised or a child.
19 // Also shows a notification on login if the user is supervised. Shows a new
20 // notification if the user manager/custodian changes.
23 class ASH_EXPORT TraySupervisedUser : public SystemTrayItem, 21 class ASH_EXPORT TraySupervisedUser : public SystemTrayItem,
24 public ViewClickListener, 22 public SessionObserver {
25 public CustodianInfoTrayObserver {
26 public: 23 public:
27 explicit TraySupervisedUser(SystemTray* system_tray); 24 explicit TraySupervisedUser(SystemTray* system_tray);
28 ~TraySupervisedUser() override; 25 ~TraySupervisedUser() override;
29 26
30 // If message is not empty updates content of default view, otherwise hides 27 // SystemTrayItem:
31 // tray items. 28 views::View* CreateDefaultView(LoginStatus status) override;
32 void UpdateMessage();
33 29
34 // Overridden from SystemTrayItem. 30 // SessionObserver:
35 views::View* CreateDefaultView(LoginStatus status) override; 31 void OnUserSessionUpdated(const AccountId& account_id) override;
36 void DestroyDefaultView() override;
37 void UpdateAfterLoginStatusChange(LoginStatus status) override;
38
39 // Overridden from ViewClickListener.
40 void OnViewClicked(views::View* sender) override;
41
42 // Overridden from CustodianInfoTrayObserver:
43 void OnCustodianInfoChanged() override;
44 32
45 private: 33 private:
46 friend class TraySupervisedUserTest; 34 friend class TraySupervisedUserTest;
47 35
48 static const char kNotificationId[]; 36 static const char kNotificationId[];
49 37
50 void CreateOrUpdateNotification(const base::string16& new_message); 38 void CreateOrUpdateNotification();
51 39
52 void CreateOrUpdateSupervisedWarningNotification(); 40 base::string16 GetSupervisedUserMessage() const;
53 41
54 const gfx::VectorIcon& GetSupervisedUserIcon() const; 42 std::string custodian_email_;
43 std::string second_custodian_email_;
55 44
56 LabelTrayView* tray_view_; 45 ScopedSessionObserver scoped_session_observer_;
57
58 // Previous login status to avoid showing notification upon unlock.
59 LoginStatus status_;
60
61 // Previous user supervised state to avoid showing notification upon unlock.
62 bool is_user_supervised_;
63 46
64 DISALLOW_COPY_AND_ASSIGN(TraySupervisedUser); 47 DISALLOW_COPY_AND_ASSIGN(TraySupervisedUser);
65 }; 48 };
66 49
67 } // namespace ash 50 } // namespace ash
68 51
69 #endif // ASH_SYSTEM_SUPERVISED_TRAY_SUPERVISED_USER_H_ 52 #endif // ASH_SYSTEM_SUPERVISED_TRAY_SUPERVISED_USER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698