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

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

Issue 2066583004: mash: Move most files in //ash/system/tray to //ash/common/system/tray (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@trayupdatemove
Patch Set: rebase Created 4 years, 6 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/system/tray/tray_item_more.cc ('k') | ash/system/tray/tray_notification_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEW_H_
6 #define ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEW_H_
7
8 #include "base/macros.h"
9 #include "base/timer/timer.h"
10 #include "ui/views/controls/button/image_button.h"
11 #include "ui/views/controls/slide_out_view.h"
12
13 namespace gfx {
14 class ImageSkia;
15 }
16
17 namespace views {
18 class ImageView;
19 }
20
21 namespace ash {
22 class SystemTrayItem;
23
24 // A view for closable notification views, laid out like:
25 // -------------------
26 // | icon contents x |
27 // ----------------v--
28 // The close button will call OnClose() when clicked.
29 class TrayNotificationView : public views::SlideOutView,
30 public views::ButtonListener {
31 public:
32 // If icon_id is 0, no icon image will be set. SetIconImage can be called
33 // to later set the icon image.
34 TrayNotificationView(SystemTrayItem* owner, int icon_id);
35 ~TrayNotificationView() override;
36
37 // InitView must be called once with the contents to be displayed.
38 void InitView(views::View* contents);
39
40 // Sets/updates the icon image.
41 void SetIconImage(const gfx::ImageSkia& image);
42
43 // Replaces the contents view.
44 void UpdateView(views::View* new_contents);
45
46 // Replaces the contents view and updates the icon image.
47 void UpdateViewAndImage(views::View* new_contents,
48 const gfx::ImageSkia& image);
49
50 // Autoclose timer operations.
51 void StartAutoCloseTimer(int seconds);
52 void StopAutoCloseTimer();
53 void RestartAutoCloseTimer();
54
55 // Overridden from ButtonListener.
56 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
57
58 // Overridden from views::View.
59 bool OnMousePressed(const ui::MouseEvent& event) override;
60
61 // Overridden from ui::EventHandler.
62 void OnGestureEvent(ui::GestureEvent* event) override;
63
64 protected:
65 // Called when the close button is pressed. Does nothing by default.
66 virtual void OnClose();
67 // Called when the notification is clicked on. Does nothing by default.
68 virtual void OnClickAction();
69
70 // Overridden from views::SlideOutView.
71 void OnSlideOut() override;
72
73 SystemTrayItem* owner() { return owner_; }
74
75 private:
76 void HandleClose();
77 void HandleClickAction();
78
79 SystemTrayItem* owner_;
80 int icon_id_;
81 views::ImageView* icon_;
82
83 int autoclose_delay_;
84 base::OneShotTimer autoclose_;
85
86 DISALLOW_COPY_AND_ASSIGN(TrayNotificationView);
87 };
88
89 } // namespace ash
90
91 #endif // ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEW_H_
OLDNEW
« no previous file with comments | « ash/system/tray/tray_item_more.cc ('k') | ash/system/tray/tray_notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698