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

Side by Side Diff: ash/system/user/tray_user.h

Issue 2125373002: mash: Migrate ash/system/user to ash/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. Created 4 years, 5 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
(Empty)
1 // Copyright (c) 2012 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.
4
5 #ifndef ASH_SYSTEM_USER_TRAY_USER_H_
6 #define ASH_SYSTEM_USER_TRAY_USER_H_
7
8 #include "ash/ash_export.h"
9 #include "ash/common/session/session_types.h"
10 #include "ash/common/system/tray/system_tray_item.h"
11 #include "ash/common/system/user/user_observer.h"
12 #include "base/macros.h"
13
14 namespace gfx {
15 class Rect;
16 class Size;
17 }
18
19 namespace views {
20 class ImageView;
21 class Label;
22 }
23
24 namespace ash {
25
26 namespace tray {
27 class RoundedImageView;
28 class UserView;
29 }
30
31 class ASH_EXPORT TrayUser : public SystemTrayItem, public UserObserver {
32 public:
33 // The given |index| is the user index in a multi profile scenario. Index #0
34 // is the active user, the other indices are other logged in users (if there
35 // are any). Depending on the multi user mode, there will be either one (index
36 // #0) or all users be visible in the system tray.
37 TrayUser(SystemTray* system_tray, UserIndex index);
38 ~TrayUser() override;
39
40 // Allows unit tests to see if the item was created.
41 enum TestState {
42 HIDDEN, // The item is hidden.
43 SHOWN, // The item gets presented to the user.
44 HOVERED, // The item is hovered and presented to the user.
45 ACTIVE, // The item was clicked and can add a user.
46 ACTIVE_BUT_DISABLED // The item was clicked anc cannot add a user.
47 };
48 TestState GetStateForTest() const;
49
50 // Returns the size of layout_view_.
51 gfx::Size GetLayoutSizeForTest() const;
52
53 // Returns the bounds of the user panel in screen coordinates.
54 // Note: This only works when the panel shown.
55 gfx::Rect GetUserPanelBoundsInScreenForTest() const;
56
57 // Update the TrayUser as if the current LoginStatus is |status|.
58 void UpdateAfterLoginStatusChangeForTest(LoginStatus status);
59
60 // Use for access inside of tests.
61 tray::UserView* user_view_for_test() const { return user_; }
62
63 private:
64 // Overridden from SystemTrayItem.
65 views::View* CreateTrayView(LoginStatus status) override;
66 views::View* CreateDefaultView(LoginStatus status) override;
67 void DestroyTrayView() override;
68 void DestroyDefaultView() override;
69 void UpdateAfterLoginStatusChange(LoginStatus status) override;
70 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override;
71
72 // Overridden from UserObserver.
73 void OnUserUpdate() override;
74 void OnUserAddedToSession() override;
75
76 void UpdateAvatarImage(LoginStatus status);
77
78 // Updates the layout of this item.
79 void UpdateLayoutOfItem();
80
81 // The user index to use.
82 UserIndex user_index_;
83
84 tray::UserView* user_;
85
86 // View that contains label and/or avatar.
87 views::View* layout_view_;
88 tray::RoundedImageView* avatar_;
89 views::Label* label_;
90
91 DISALLOW_COPY_AND_ASSIGN(TrayUser);
92 };
93
94 } // namespace ash
95
96 #endif // ASH_SYSTEM_USER_TRAY_USER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698