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

Side by Side Diff: ash/system/web_notification/web_notification_view.h

Issue 11229022: Move ash/system/web_notification message_center to ui/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again. Created 8 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
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_WEB_NOTIFICATION_WEB_NOTIFICATION_VIEW_H_
6 #define ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_VIEW_H_
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"
11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/view.h"
13
14 namespace views {
15 class ImageButton;
16 class ImageView;
17 class ScrollView;
18 }
19
20 namespace message_center {
21
22 // Individual notifications constants
23 const int kWebNotificationWidth = 320;
24 const int kWebNotificationButtonWidth = 32;
25 const int kWebNotificationIconSize = 40;
26
27 // The view for a notification entry (icon + message + buttons).
28 class WebNotificationView : public views::View,
29 public views::ButtonListener,
30 public ui::ImplicitAnimationObserver {
31 public:
32 WebNotificationView(WebNotificationList::Delegate* list_delegate,
33 const WebNotification& notification,
34 int scroll_bar_width);
35
36 virtual ~WebNotificationView();
37
38 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; }
39
40 // views::View overrides.
41 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
42
43 virtual ui::EventResult OnGestureEvent(
44 const ui::GestureEvent& event) OVERRIDE;
45
46 // Overridden from ButtonListener.
47 virtual void ButtonPressed(views::Button* sender,
48 const ui::Event& event) OVERRIDE;
49
50 // Overridden from ImplicitAnimationObserver.
51 virtual void OnImplicitAnimationsCompleted() OVERRIDE;
52
53 private:
54 enum SlideDirection {
55 SLIDE_LEFT,
56 SLIDE_RIGHT
57 };
58
59 // Shows the menu for the notification.
60 void ShowMenu(gfx::Point screen_location);
61
62 // Restores the transform and opacity of the view.
63 void RestoreVisualState();
64
65 // Slides the view out and closes it after the animation.
66 void SlideOutAndClose(SlideDirection direction);
67
68 WebNotificationList::Delegate* list_delegate_;
69 WebNotification notification_;
70 views::ImageView* icon_;
71 views::ImageButton* close_button_;
72
73 views::ScrollView* scroller_;
74 float gesture_scroll_amount_;
75
76 DISALLOW_COPY_AND_ASSIGN(WebNotificationView);
77 };
78
79 } // namespace message_center
80
81 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_VIEW_H_
OLDNEW
« no previous file with comments | « ash/system/web_notification/web_notification_tray_unittest.cc ('k') | ash/system/web_notification/web_notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698