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

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

Issue 2678353005: Remove pre-MD code related to tray/menu user profiles. (Closed)
Patch Set: back out a11y changes and rebase Created 3 years, 10 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/user_card_view.cc ('k') | ash/common/system/user/user_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_COMMON_SYSTEM_USER_USER_VIEW_H_ 5 #ifndef ASH_COMMON_SYSTEM_USER_USER_VIEW_H_
6 #define ASH_COMMON_SYSTEM_USER_USER_VIEW_H_ 6 #define ASH_COMMON_SYSTEM_USER_USER_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/common/system/tray/tray_constants.h" 10 #include "ash/common/system/tray/tray_constants.h"
11 #include "ash/common/system/user/tray_user.h" 11 #include "ash/common/system/user/tray_user.h"
12 #include "ash/public/cpp/session_types.h" 12 #include "ash/public/cpp/session_types.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "ui/views/controls/button/button.h" 14 #include "ui/views/controls/button/button.h"
15 #include "ui/views/focus/focus_manager.h" 15 #include "ui/views/focus/focus_manager.h"
16 #include "ui/views/layout/box_layout.h" 16 #include "ui/views/layout/box_layout.h"
17 #include "ui/views/mouse_watcher.h"
18 #include "ui/views/view.h" 17 #include "ui/views/view.h"
19 18
20 namespace gfx { 19 namespace gfx {
21 class Rect; 20 class Rect;
22 class Size;
23 } 21 }
24 22
25 namespace views { 23 namespace views {
26 class FocusManager; 24 class FocusManager;
27 } 25 }
28 26
29 namespace ash { 27 namespace ash {
30 28
31 enum class LoginStatus; 29 enum class LoginStatus;
32 class PopupMessage; 30 class PopupMessage;
33 class SystemTrayItem; 31 class SystemTrayItem;
34 32
35 namespace tray { 33 namespace tray {
36 34
37 // The view of a user item in system tray bubble. 35 // The view of a user item in system tray bubble.
38 class UserView : public views::View, 36 class UserView : public views::View,
39 public views::ButtonListener, 37 public views::ButtonListener,
40 public views::MouseWatcherListener,
41 public views::FocusChangeListener { 38 public views::FocusChangeListener {
42 public: 39 public:
43 UserView(SystemTrayItem* owner, LoginStatus login, UserIndex index); 40 UserView(SystemTrayItem* owner, LoginStatus login, UserIndex index);
44 ~UserView() override; 41 ~UserView() override;
45 42
46 // Overridden from MouseWatcherListener:
47 void MouseMovedOutOfHost() override;
48
49 TrayUser::TestState GetStateForTest() const; 43 TrayUser::TestState GetStateForTest() const;
50 gfx::Rect GetBoundsInScreenOfUserButtonForTest(); 44 gfx::Rect GetBoundsInScreenOfUserButtonForTest();
51 45
52 views::View* user_card_view_for_test() const { return user_card_view_; } 46 views::View* user_card_view_for_test() const { return user_card_view_; }
53 47
54 private: 48 private:
55 // Retruns true if |this| view is for the currently active user, i.e. top row. 49 // Retruns true if |this| view is for the currently active user, i.e. top row.
56 bool IsActiveUser() const; 50 bool IsActiveUser() const;
57 51
58 // Overridden from views::View. 52 // Overridden from views::View.
59 gfx::Size GetPreferredSize() const override;
60 int GetHeightForWidth(int width) const override; 53 int GetHeightForWidth(int width) const override;
61 void Layout() override;
62 54
63 // Overridden from views::ButtonListener. 55 // Overridden from views::ButtonListener.
64 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 56 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
65 57
66 // Overridden from views::FocusChangeListener: 58 // Overridden from views::FocusChangeListener:
67 void OnWillChangeFocus(View* focused_before, View* focused_now) override; 59 void OnWillChangeFocus(View* focused_before, View* focused_now) override;
68 void OnDidChangeFocus(View* focused_before, View* focused_now) override; 60 void OnDidChangeFocus(View* focused_before, View* focused_now) override;
69 61
70 void AddLogoutButton(LoginStatus login); 62 void AddLogoutButton(LoginStatus login);
71 void AddUserCard(LoginStatus login); 63 void AddUserCard(LoginStatus login);
72 void AddUserCardMd(LoginStatus login);
73 64
74 // Create the menu option to add another user. If |disabled| is set the user 65 // Create the menu option to add another user. If |disabled| is set the user
75 // cannot actively click on the item. 66 // cannot actively click on the item.
76 void ToggleAddUserMenuOption(); 67 void ToggleAddUserMenuOption();
77 68
78 // Removes the add user menu option. 69 // Removes the add user menu option.
79 void RemoveAddUserMenuOption(); 70 void RemoveAddUserMenuOption();
80 71
81 const UserIndex user_index_; 72 const UserIndex user_index_;
82 views::View* user_card_view_; 73 views::View* user_card_view_;
83 74
84 // This is the owner system tray item of this view. 75 // This is the owner system tray item of this view.
85 SystemTrayItem* owner_; 76 SystemTrayItem* owner_;
86 77
87 // True if |user_card_view_| is a |ButtonFromView| - otherwise it is only 78 // True if |user_card_view_| is a |ButtonFromView| - otherwise it is only
88 // a |UserCardView|. 79 // a |UserCardView|.
89 bool is_user_card_button_; 80 bool is_user_card_button_;
90 81
91 views::View* logout_button_; 82 views::View* logout_button_;
92 std::unique_ptr<PopupMessage> popup_message_; 83 std::unique_ptr<PopupMessage> popup_message_;
93 std::unique_ptr<views::Widget> add_menu_option_; 84 std::unique_ptr<views::Widget> add_menu_option_;
94 85
95 // False when the add user panel is visible but not activatable. 86 // False when the add user panel is visible but not activatable.
96 bool add_user_enabled_; 87 bool add_user_enabled_;
97 88
98 // The mouse watcher which takes care of out of window hover events.
99 std::unique_ptr<views::MouseWatcher> mouse_watcher_;
100
101 // The focus manager which we use to detect focus changes. 89 // The focus manager which we use to detect focus changes.
102 views::FocusManager* focus_manager_; 90 views::FocusManager* focus_manager_;
103 91
104 DISALLOW_COPY_AND_ASSIGN(UserView); 92 DISALLOW_COPY_AND_ASSIGN(UserView);
105 }; 93 };
106 94
107 } // namespace tray 95 } // namespace tray
108 } // namespace ash 96 } // namespace ash
109 97
110 #endif // ASH_COMMON_SYSTEM_USER_USER_VIEW_H_ 98 #endif // ASH_COMMON_SYSTEM_USER_USER_VIEW_H_
OLDNEW
« no previous file with comments | « ash/common/system/user/user_card_view.cc ('k') | ash/common/system/user/user_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698