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_USER_USER_VIEW_H_ | 5 #ifndef ASH_SYSTEM_USER_USER_VIEW_H_ |
6 #define ASH_SYSTEM_USER_USER_VIEW_H_ | 6 #define ASH_SYSTEM_USER_USER_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/common/session/session_types.h" | 10 #include "ash/common/session/session_types.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 class SystemTrayItem; | 33 class SystemTrayItem; |
34 | 34 |
35 namespace tray { | 35 namespace tray { |
36 | 36 |
37 // The view of a user item in system tray bubble. | 37 // The view of a user item in system tray bubble. |
38 class UserView : public views::View, | 38 class UserView : public views::View, |
39 public views::ButtonListener, | 39 public views::ButtonListener, |
40 public views::MouseWatcherListener, | 40 public views::MouseWatcherListener, |
41 public views::FocusChangeListener { | 41 public views::FocusChangeListener { |
42 public: | 42 public: |
43 UserView(SystemTrayItem* owner, | 43 UserView(SystemTrayItem* owner, LoginStatus login, UserIndex index); |
44 ash::user::LoginStatus login, | |
45 UserIndex index); | |
46 ~UserView() override; | 44 ~UserView() override; |
47 | 45 |
48 // Overridden from MouseWatcherListener: | 46 // Overridden from MouseWatcherListener: |
49 void MouseMovedOutOfHost() override; | 47 void MouseMovedOutOfHost() override; |
50 | 48 |
51 TrayUser::TestState GetStateForTest() const; | 49 TrayUser::TestState GetStateForTest() const; |
52 gfx::Rect GetBoundsInScreenOfUserButtonForTest(); | 50 gfx::Rect GetBoundsInScreenOfUserButtonForTest(); |
53 | 51 |
54 views::View* user_card_view_for_test() const { return user_card_view_; } | 52 views::View* user_card_view_for_test() const { return user_card_view_; } |
55 | 53 |
56 private: | 54 private: |
57 // Overridden from views::View. | 55 // Overridden from views::View. |
58 gfx::Size GetPreferredSize() const override; | 56 gfx::Size GetPreferredSize() const override; |
59 int GetHeightForWidth(int width) const override; | 57 int GetHeightForWidth(int width) const override; |
60 void Layout() override; | 58 void Layout() override; |
61 | 59 |
62 // Overridden from views::ButtonListener. | 60 // Overridden from views::ButtonListener. |
63 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 61 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
64 | 62 |
65 // Overridden from views::FocusChangeListener: | 63 // Overridden from views::FocusChangeListener: |
66 void OnWillChangeFocus(View* focused_before, View* focused_now) override; | 64 void OnWillChangeFocus(View* focused_before, View* focused_now) override; |
67 void OnDidChangeFocus(View* focused_before, View* focused_now) override; | 65 void OnDidChangeFocus(View* focused_before, View* focused_now) override; |
68 | 66 |
69 void AddLogoutButton(user::LoginStatus login); | 67 void AddLogoutButton(LoginStatus login); |
70 void AddUserCard(user::LoginStatus login); | 68 void AddUserCard(LoginStatus login); |
71 | 69 |
72 // Create the menu option to add another user. If |disabled| is set the user | 70 // Create the menu option to add another user. If |disabled| is set the user |
73 // cannot actively click on the item. | 71 // cannot actively click on the item. |
74 void ToggleAddUserMenuOption(); | 72 void ToggleAddUserMenuOption(); |
75 | 73 |
76 // Removes the add user menu option. | 74 // Removes the add user menu option. |
77 void RemoveAddUserMenuOption(); | 75 void RemoveAddUserMenuOption(); |
78 | 76 |
79 UserIndex user_index_; | 77 UserIndex user_index_; |
80 // The view of the user card. | 78 // The view of the user card. |
(...skipping 19 matching lines...) Expand all Loading... |
100 // The focus manager which we use to detect focus changes. | 98 // The focus manager which we use to detect focus changes. |
101 views::FocusManager* focus_manager_; | 99 views::FocusManager* focus_manager_; |
102 | 100 |
103 DISALLOW_COPY_AND_ASSIGN(UserView); | 101 DISALLOW_COPY_AND_ASSIGN(UserView); |
104 }; | 102 }; |
105 | 103 |
106 } // namespace tray | 104 } // namespace tray |
107 } // namespace ash | 105 } // namespace ash |
108 | 106 |
109 #endif // ASH_SYSTEM_USER_USER_VIEW_H_ | 107 #endif // ASH_SYSTEM_USER_USER_VIEW_H_ |
OLD | NEW |