OLD | NEW |
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_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ |
6 #define ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ |
7 | 7 |
8 #include "ash/system/web_notification/web_notification.h" | |
9 #include "ash/system/web_notification/web_notification_list.h" | |
10 #include "ui/compositor/layer_animation_observer.h" | 8 #include "ui/compositor/layer_animation_observer.h" |
| 9 #include "ui/message_center/notification_list.h" |
11 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
12 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
13 | 12 |
14 namespace views { | 13 namespace views { |
15 class ImageButton; | 14 class ImageButton; |
16 class ImageView; | 15 class ImageView; |
17 class ScrollView; | 16 class ScrollView; |
18 } | 17 } |
19 | 18 |
20 namespace message_center { | 19 namespace message_center { |
21 | 20 |
22 // Individual notifications constants | 21 // Individual notifications constants |
23 const int kWebNotificationWidth = 320; | 22 const int kWebNotificationWidth = 320; |
24 const int kWebNotificationButtonWidth = 32; | 23 const int kWebNotificationButtonWidth = 32; |
25 const int kWebNotificationIconSize = 40; | 24 const int kWebNotificationIconSize = 40; |
26 | 25 |
27 // The view for a notification entry (icon + message + buttons). | 26 // The view for a notification entry (icon + message + buttons). |
28 class WebNotificationView : public views::View, | 27 class MessageView : public views::View, |
29 public views::ButtonListener, | 28 public views::ButtonListener, |
30 public ui::ImplicitAnimationObserver { | 29 public ui::ImplicitAnimationObserver { |
31 public: | 30 public: |
32 WebNotificationView(WebNotificationList::Delegate* list_delegate, | 31 MessageView(NotificationList::Delegate* list_delegate, |
33 const WebNotification& notification, | 32 const NotificationList::Notification& notification, |
34 int scroll_bar_width); | 33 int scroll_bar_width); |
35 | 34 |
36 virtual ~WebNotificationView(); | 35 virtual ~MessageView(); |
37 | 36 |
38 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } | 37 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } |
39 | 38 |
40 // views::View overrides. | 39 // views::View overrides. |
41 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 40 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
42 | 41 |
43 virtual ui::EventResult OnGestureEvent( | 42 virtual ui::EventResult OnGestureEvent( |
44 const ui::GestureEvent& event) OVERRIDE; | 43 const ui::GestureEvent& event) OVERRIDE; |
45 | 44 |
46 // Overridden from ButtonListener. | 45 // Overridden from ButtonListener. |
(...skipping 11 matching lines...) Expand all Loading... |
58 | 57 |
59 // Shows the menu for the notification. | 58 // Shows the menu for the notification. |
60 void ShowMenu(gfx::Point screen_location); | 59 void ShowMenu(gfx::Point screen_location); |
61 | 60 |
62 // Restores the transform and opacity of the view. | 61 // Restores the transform and opacity of the view. |
63 void RestoreVisualState(); | 62 void RestoreVisualState(); |
64 | 63 |
65 // Slides the view out and closes it after the animation. | 64 // Slides the view out and closes it after the animation. |
66 void SlideOutAndClose(SlideDirection direction); | 65 void SlideOutAndClose(SlideDirection direction); |
67 | 66 |
68 WebNotificationList::Delegate* list_delegate_; | 67 NotificationList::Delegate* list_delegate_; |
69 WebNotification notification_; | 68 NotificationList::Notification notification_; |
70 views::ImageView* icon_; | 69 views::ImageView* icon_; |
71 views::ImageButton* close_button_; | 70 views::ImageButton* close_button_; |
72 | 71 |
73 views::ScrollView* scroller_; | 72 views::ScrollView* scroller_; |
74 float gesture_scroll_amount_; | 73 float gesture_scroll_amount_; |
75 | 74 |
76 DISALLOW_COPY_AND_ASSIGN(WebNotificationView); | 75 DISALLOW_COPY_AND_ASSIGN(MessageView); |
77 }; | 76 }; |
78 | 77 |
79 } // namespace message_center | 78 } // namespace message_center |
80 | 79 |
81 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_VIEW_H_ | 80 #endif // UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ |
OLD | NEW |