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

Side by Side Diff: ash/common/system/tray/tray_notification_view.h

Issue 2583393002: Send notification to users upon receiving sms messages (Closed)
Patch Set: update return type 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_TRAY_TRAY_NOTIFICATION_VIEW_H_ 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEW_H_
6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEW_H_ 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEW_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "ui/views/controls/button/image_button.h" 10 #include "ui/views/controls/button/image_button.h"
11 #include "ui/views/controls/slide_out_view.h" 11 #include "ui/views/controls/slide_out_view.h"
12 12
13 namespace views { 13 namespace views {
14 class ImageView; 14 class ImageView;
15 } 15 }
16 16
17 namespace ash { 17 namespace ash {
18 class SystemTrayItem;
19 18
20 // A view for closable notification views, laid out like: 19 // A view for closable notification views, laid out like:
21 // ------------------- 20 // -------------------
22 // | icon contents x | 21 // | icon contents x |
23 // ----------------v-- 22 // ----------------v--
24 // The close button will call OnClose() when clicked. 23 // The close button will call OnClose() when clicked.
25 class TrayNotificationView : public views::SlideOutView, 24 class TrayNotificationView : public views::View {
26 public views::ButtonListener {
27 public: 25 public:
28 // If icon_id is 0, no icon image will be set. 26 // If icon_id is 0, no icon image will be set.
29 TrayNotificationView(SystemTrayItem* owner, int icon_id); 27 explicit TrayNotificationView(int icon_id);
30 ~TrayNotificationView() override; 28 ~TrayNotificationView() override;
31 29
32 // InitView must be called once with the contents to be displayed. 30 // InitView must be called once with the contents to be displayed.
33 void InitView(views::View* contents); 31 void InitView(views::View* contents);
34 32
35 // Replaces the contents view.
36 void UpdateView(views::View* new_contents);
37
38 // Autoclose timer operations.
39 void StartAutoCloseTimer(int seconds);
40 void StopAutoCloseTimer();
41 void RestartAutoCloseTimer();
42
43 // Overridden from ButtonListener.
44 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
45
46 // Overridden from views::View.
47 bool OnMousePressed(const ui::MouseEvent& event) override;
48
49 // Overridden from ui::EventHandler.
50 void OnGestureEvent(ui::GestureEvent* event) override;
51
52 protected:
53 // Called when the close button is pressed. Does nothing by default.
54 virtual void OnClose();
55 // Called when the notification is clicked on. Does nothing by default.
56 virtual void OnClickAction();
57
58 // Overridden from views::SlideOutView.
59 void OnSlideOut() override;
60
61 SystemTrayItem* owner() { return owner_; }
62
63 private: 33 private:
64 void HandleClose();
65 void HandleClickAction();
66
67 SystemTrayItem* owner_;
68 int icon_id_; 34 int icon_id_;
69 views::ImageView* icon_; 35 views::ImageView* icon_;
70 36
71 int autoclose_delay_;
72 base::OneShotTimer autoclose_;
73
74 DISALLOW_COPY_AND_ASSIGN(TrayNotificationView); 37 DISALLOW_COPY_AND_ASSIGN(TrayNotificationView);
75 }; 38 };
76 39
77 } // namespace ash 40 } // namespace ash
78 41
79 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEW_H_ 42 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEW_H_
OLDNEW
« no previous file with comments | « ash/common/system/tray/system_tray_unittest.cc ('k') | ash/common/system/tray/tray_notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698