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

Side by Side Diff: chrome/browser/notifications/balloon.h

Issue 363003: Implement cancel() API on a Notification object so that script can cancel or ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/notifications/balloon.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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // Handles the visible notification (or balloons). 5 // Handles the visible notification (or balloons).
6 6
7 #ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_H_ 7 #ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_H_
8 #define CHROME_BROWSER_NOTIFICATIONS_BALLOON_H_ 8 #define CHROME_BROWSER_NOTIFICATIONS_BALLOON_H_
9 9
10 #include <vector> 10 #include <vector>
(...skipping 14 matching lines...) Expand all
25 public: 25 public:
26 virtual ~BalloonView() { } 26 virtual ~BalloonView() { }
27 27
28 // Show the view on the screen. 28 // Show the view on the screen.
29 virtual void Show(Balloon* balloon) = 0; 29 virtual void Show(Balloon* balloon) = 0;
30 30
31 // Reposition the view to match the position of its balloon. 31 // Reposition the view to match the position of its balloon.
32 virtual void RepositionToBalloon() = 0; 32 virtual void RepositionToBalloon() = 0;
33 33
34 // Close the view. 34 // Close the view.
35 virtual void Close() = 0; 35 virtual void Close(bool by_user) = 0;
36 }; 36 };
37 37
38 // Represents a Notification on the screen. 38 // Represents a Notification on the screen.
39 class Balloon { 39 class Balloon {
40 public: 40 public:
41 class BalloonCloseListener { 41 class BalloonCloseListener {
42 public: 42 public:
43 virtual ~BalloonCloseListener() {} 43 virtual ~BalloonCloseListener() {}
44 44
45 // Called when a balloon is closed. 45 // Called when a balloon is closed.
(...skipping 12 matching lines...) Expand all
58 const gfx::Point& position() const { return position_; } 58 const gfx::Point& position() const { return position_; }
59 void SetPosition(const gfx::Point& upper_left, bool reposition); 59 void SetPosition(const gfx::Point& upper_left, bool reposition);
60 60
61 const gfx::Size& size() const { return size_; } 61 const gfx::Size& size() const { return size_; }
62 void set_size(const gfx::Size& size) { size_ = size; } 62 void set_size(const gfx::Size& size) { size_ = size; }
63 63
64 // Provides a view for this balloon. Ownership transfers 64 // Provides a view for this balloon. Ownership transfers
65 // to this object. 65 // to this object.
66 void set_view(BalloonView* balloon_view); 66 void set_view(BalloonView* balloon_view);
67 67
68 // Shows the balloon.
68 virtual void Show(); 69 virtual void Show();
69 virtual void Close(bool by_user); 70
71 // Called when the balloon is closed, either by user (through the UI)
72 // or by a script.
73 virtual void OnClose(bool by_user);
74
75 // Called by script to cause the balloon to close.
76 virtual void CloseByScript();
70 77
71 private: 78 private:
72 // Non-owned pointer to the profile. 79 // Non-owned pointer to the profile.
73 Profile* profile_; 80 Profile* profile_;
74 81
75 // The notification being shown in this balloon. 82 // The notification being shown in this balloon.
76 Notification notification_; 83 Notification notification_;
77 84
78 // A listener to be called when the balloon closes. 85 // A listener to be called when the balloon closes.
79 BalloonCloseListener* close_listener_; 86 BalloonCloseListener* close_listener_;
80 87
81 // The actual UI element for the balloon. 88 // The actual UI element for the balloon.
82 scoped_ptr<BalloonView> balloon_view_; 89 scoped_ptr<BalloonView> balloon_view_;
83 90
84 // Position and size of the balloon on the screen. 91 // Position and size of the balloon on the screen.
85 gfx::Point position_; 92 gfx::Point position_;
86 gfx::Size size_; 93 gfx::Size size_;
87 94
88 DISALLOW_COPY_AND_ASSIGN(Balloon); 95 DISALLOW_COPY_AND_ASSIGN(Balloon);
89 }; 96 };
90 97
91 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_H_ 98 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/notifications/balloon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698