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

Side by Side Diff: ash/system/chromeos/screen_security/screen_tray_item.h

Issue 2109613005: mash: Move system tray cast code into //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forward decl 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 2013 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_CHROMEOS_SCREEN_TRAY_ITEM_H_
6 #define ASH_SYSTEM_CHROMEOS_SCREEN_TRAY_ITEM_H_
7
8 #include "ash/common/system/tray/system_tray_item.h"
9 #include "ash/common/system/tray/tray_item_view.h"
10 #include "ash/common/system/tray/tray_notification_view.h"
11 #include "ash/common/system/tray/tray_popup_label_button.h"
12 #include "ash/system/tray/system_tray.h"
13 #include "base/macros.h"
14 #include "ui/message_center/notification_delegate.h"
15 #include "ui/views/controls/button/button.h"
16 #include "ui/views/controls/image_view.h"
17
18 namespace views {
19 class View;
20 }
21
22 namespace ash {
23 class ScreenTrayItem;
24
25 namespace tray {
26
27 class ScreenTrayView : public TrayItemView {
28 public:
29 ScreenTrayView(ScreenTrayItem* screen_tray_item, int icon_id);
30 ~ScreenTrayView() override;
31
32 void Update();
33
34 private:
35 ScreenTrayItem* screen_tray_item_;
36
37 DISALLOW_COPY_AND_ASSIGN(ScreenTrayView);
38 };
39
40 class ScreenStatusView : public views::View, public views::ButtonListener {
41 public:
42 ScreenStatusView(ScreenTrayItem* screen_tray_item,
43 int icon_id,
44 const base::string16& label_text,
45 const base::string16& stop_button_text);
46 ~ScreenStatusView() override;
47
48 // Overridden from views::View.
49 void Layout() override;
50
51 // Overridden from views::ButtonListener.
52 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
53
54 void CreateItems();
55 void Update();
56
57 private:
58 ScreenTrayItem* screen_tray_item_;
59 views::ImageView* icon_;
60 views::Label* label_;
61 TrayPopupLabelButton* stop_button_;
62 int icon_id_;
63 base::string16 label_text_;
64 base::string16 stop_button_text_;
65
66 DISALLOW_COPY_AND_ASSIGN(ScreenStatusView);
67 };
68
69 class ScreenNotificationDelegate : public message_center::NotificationDelegate {
70 public:
71 explicit ScreenNotificationDelegate(ScreenTrayItem* screen_tray);
72
73 // message_center::NotificationDelegate overrides:
74 void ButtonClick(int button_index) override;
75
76 protected:
77 ~ScreenNotificationDelegate() override;
78
79 private:
80 ScreenTrayItem* screen_tray_;
81
82 DISALLOW_COPY_AND_ASSIGN(ScreenNotificationDelegate);
83 };
84
85 } // namespace tray
86
87 // The base tray item for screen capture and screen sharing. The
88 // Start method brings up a notification and a tray item, and the user
89 // can stop the screen capture/sharing by pressing the stop button.
90 class ASH_EXPORT ScreenTrayItem : public SystemTrayItem {
91 public:
92 explicit ScreenTrayItem(SystemTray* system_tray);
93 ~ScreenTrayItem() override;
94
95 tray::ScreenTrayView* tray_view() { return tray_view_; }
96 void set_tray_view(tray::ScreenTrayView* tray_view) {
97 tray_view_ = tray_view;
98 }
99
100 tray::ScreenStatusView* default_view() { return default_view_; }
101 void set_default_view(tray::ScreenStatusView* default_view) {
102 default_view_ = default_view;
103 }
104
105 bool is_started() const { return is_started_; }
106 void set_is_started(bool is_started) { is_started_ = is_started; }
107
108 void Update();
109 void Start(const base::Closure& stop_callback);
110 void Stop();
111
112 // Creates or updates the notification for the tray item.
113 virtual void CreateOrUpdateNotification() = 0;
114
115 // Returns the id of the notification for the tray item.
116 virtual std::string GetNotificationId() = 0;
117
118 // Overridden from SystemTrayItem.
119 views::View* CreateTrayView(LoginStatus status) override = 0;
120 views::View* CreateDefaultView(LoginStatus status) override = 0;
121 void DestroyTrayView() override;
122 void DestroyDefaultView() override;
123 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override;
124
125 private:
126 tray::ScreenTrayView* tray_view_;
127 tray::ScreenStatusView* default_view_;
128 bool is_started_;
129 base::Closure stop_callback_;
130
131 DISALLOW_COPY_AND_ASSIGN(ScreenTrayItem);
132 };
133
134 } // namespace ash
135
136 #endif // ASH_SYSTEM_CHROMEOS_SCREEN_TRAY_ITEM_H_
OLDNEW
« no previous file with comments | « ash/system/chromeos/screen_security/screen_share_tray_item.cc ('k') | ash/system/chromeos/screen_security/screen_tray_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698