OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Draws the view for the balloons. | 5 // Draws the view for the balloons. |
6 | 6 |
7 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_NOTIFICATION_PANEL_H_ | 7 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_NOTIFICATION_PANEL_H_ |
8 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_NOTIFICATION_PANEL_H_ | 8 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_NOTIFICATION_PANEL_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
| 11 #include "base/memory/weak_ptr.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/task.h" | |
13 #include "chrome/browser/chromeos/frame/panel_controller.h" | 13 #include "chrome/browser/chromeos/frame/panel_controller.h" |
14 #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h" | 14 #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
17 | 17 |
18 class Balloon; | 18 class Balloon; |
19 class Notification; | 19 class Notification; |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 class ScrollView; | 22 class ScrollView; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // | (event=expand) (event=minmize) (event=user) | 64 // | (event=expand) (event=minmize) (event=user) |
65 // | V | | | 65 // | V | | |
66 // +--(event=open)---->[ FULL ]-------------+-------------------+ | 66 // +--(event=open)---->[ FULL ]-------------+-------------------+ |
67 // | ^ | | 67 // | ^ | |
68 // (event=close) +-------(event=stale)(event=new) | 68 // (event=close) +-------(event=stale)(event=new) |
69 // | | 69 // | |
70 // [CLOSE] <------+ | 70 // [CLOSE] <------+ |
71 // | 71 // |
72 class NotificationPanel : public PanelController::Delegate, | 72 class NotificationPanel : public PanelController::Delegate, |
73 public BalloonCollectionImpl::NotificationUI, | 73 public BalloonCollectionImpl::NotificationUI, |
74 public content::NotificationObserver { | 74 public content::NotificationObserver, |
| 75 public base::SupportsWeakPtr<NotificationPanel> { |
75 public: | 76 public: |
76 enum State { | 77 enum State { |
77 FULL, // Show all notifications | 78 FULL, // Show all notifications |
78 KEEP_SIZE, // Don't change the size. | 79 KEEP_SIZE, // Don't change the size. |
79 STICKY_AND_NEW, // Show only new and sticky notifications. | 80 STICKY_AND_NEW, // Show only new and sticky notifications. |
80 MINIMIZED, // The panel is minimized. | 81 MINIMIZED, // The panel is minimized. |
81 CLOSED, // The panel is closed. | 82 CLOSED, // The panel is closed. |
82 }; | 83 }; |
83 | 84 |
84 NotificationPanel(); | 85 NotificationPanel(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // This is owned by the panel to compute the panel size before | 170 // This is owned by the panel to compute the panel size before |
170 // actually opening the panel. | 171 // actually opening the panel. |
171 scoped_ptr<PanelController> panel_controller_; | 172 scoped_ptr<PanelController> panel_controller_; |
172 | 173 |
173 // A scrollable parent of the BalloonContainer. | 174 // A scrollable parent of the BalloonContainer. |
174 scoped_ptr<views::ScrollView> scroll_view_; | 175 scoped_ptr<views::ScrollView> scroll_view_; |
175 | 176 |
176 // Panel's state. | 177 // Panel's state. |
177 State state_; | 178 State state_; |
178 | 179 |
179 ScopedRunnableMethodFactory<NotificationPanel> task_factory_; | |
180 | |
181 // The minimum size of a notification. | 180 // The minimum size of a notification. |
182 gfx::Rect min_bounds_; | 181 gfx::Rect min_bounds_; |
183 | 182 |
184 // Stale timeout. | 183 // Stale timeout. |
185 int stale_timeout_; | 184 int stale_timeout_; |
186 | 185 |
187 // A registrar to subscribe PANEL_STATE_CHANGED event. | 186 // A registrar to subscribe PANEL_STATE_CHANGED event. |
188 content::NotificationRegistrar registrar_; | 187 content::NotificationRegistrar registrar_; |
189 | 188 |
190 // The notification a mouse pointer is currently on. NULL if the mouse | 189 // The notification a mouse pointer is currently on. NULL if the mouse |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 bool IsActive(const BalloonViewImpl* view) const; | 238 bool IsActive(const BalloonViewImpl* view) const; |
240 | 239 |
241 private: | 240 private: |
242 NotificationPanel* panel_; | 241 NotificationPanel* panel_; |
243 DISALLOW_COPY_AND_ASSIGN(NotificationPanelTester); | 242 DISALLOW_COPY_AND_ASSIGN(NotificationPanelTester); |
244 }; | 243 }; |
245 | 244 |
246 } // namespace chromeos | 245 } // namespace chromeos |
247 | 246 |
248 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_NOTIFICATION_PANEL_H_ | 247 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_NOTIFICATION_PANEL_H_ |
OLD | NEW |