OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_COMMON_SYSTEM_USER_USER_CARD_VIEW_H_ | |
6 #define ASH_COMMON_SYSTEM_USER_USER_CARD_VIEW_H_ | |
7 | |
8 #include "ash/common/media_controller.h" | |
9 #include "base/macros.h" | |
10 #include "ui/views/view.h" | |
11 | |
12 namespace views { | |
13 class BoxLayout; | |
14 class ImageView; | |
15 class Label; | |
16 } | |
17 | |
18 namespace ash { | |
19 | |
20 enum class LoginStatus; | |
21 | |
22 namespace tray { | |
23 | |
24 // The view displaying information about the user, such as user's avatar, email | |
25 // address, name, and more. View has no borders. | |
26 class UserCardView : public views::View, public MediaCaptureObserver { | |
27 public: | |
28 // |max_width| takes effect only if |login_status| is LOGGED_IN_PUBLIC. | |
29 UserCardView(LoginStatus login_status, int max_width, int user_index); | |
30 ~UserCardView() override; | |
31 | |
32 // View: | |
33 void PaintChildren(const ui::PaintContext& context) override; | |
34 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | |
35 | |
36 // MediaCaptureObserver: | |
37 void OnMediaCaptureChanged( | |
38 const std::vector<mojom::MediaCaptureState>& capture_states) override; | |
39 | |
40 private: | |
41 // Creates the content for the public mode. | |
42 void AddPublicModeUserContent(int max_width); | |
43 | |
44 void AddUserContent(views::BoxLayout* layout, LoginStatus login_status); | |
45 | |
46 bool is_active_user() const { return !user_index_; } | |
47 | |
48 int user_index_; | |
49 | |
50 views::Label* user_name_; | |
51 views::Label* media_capture_label_; | |
52 views::ImageView* media_capture_icon_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(UserCardView); | |
55 }; | |
56 | |
57 } // namespace tray | |
58 } // namespace ash | |
59 | |
60 #endif // ASH_COMMON_SYSTEM_USER_USER_CARD_VIEW_H_ | |
OLD | NEW |