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

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

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

Powered by Google App Engine
This is Rietveld 408576698