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

Side by Side Diff: ui/message_center/views/toast_contents_view.h

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 UI_MESSAGE_CENTER_VIEWS_TOAST_CONTENTS_VIEW_H_ 5 #ifndef UI_MESSAGE_CENTER_VIEWS_TOAST_CONTENTS_VIEW_H_
6 #define UI_MESSAGE_CENTER_VIEWS_TOAST_CONTENTS_VIEW_H_ 6 #define UI_MESSAGE_CENTER_VIEWS_TOAST_CONTENTS_VIEW_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "ui/base/animation/animation_delegate.h" 10 #include "ui/gfx/animation/animation_delegate.h"
11 #include "ui/gfx/native_widget_types.h" 11 #include "ui/gfx/native_widget_types.h"
12 #include "ui/gfx/point.h" 12 #include "ui/gfx/point.h"
13 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
14 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
15 #include "ui/views/widget/widget_delegate.h" 15 #include "ui/views/widget/widget_delegate.h"
16 16
17 namespace ui { 17 namespace gfx {
18 class Animation; 18 class Animation;
19 class SlideAnimation; 19 class SlideAnimation;
20 } 20 }
21 21
22 namespace views { 22 namespace views {
23 class View; 23 class View;
24 } 24 }
25 25
26 namespace message_center { 26 namespace message_center {
27 27
28 class MessageCenter; 28 class MessageCenter;
29 class MessagePopupCollection; 29 class MessagePopupCollection;
30 class MessageView; 30 class MessageView;
31 class Notification; 31 class Notification;
32 32
33 33
34 class ToastContentsView : public views::WidgetDelegateView, 34 class ToastContentsView : public views::WidgetDelegateView,
35 public ui::AnimationDelegate { 35 public gfx::AnimationDelegate {
36 public: 36 public:
37 ToastContentsView(const Notification* notification, 37 ToastContentsView(const Notification* notification,
38 base::WeakPtr<MessagePopupCollection> collection, 38 base::WeakPtr<MessagePopupCollection> collection,
39 MessageCenter* message_center); 39 MessageCenter* message_center);
40 virtual ~ToastContentsView(); 40 virtual ~ToastContentsView();
41 41
42 // Initialization and update. 42 // Initialization and update.
43 views::Widget* CreateWidget(gfx::NativeView parent); 43 views::Widget* CreateWidget(gfx::NativeView parent);
44 void SetContents(MessageView* view); 44 void SetContents(MessageView* view);
45 45
(...skipping 18 matching lines...) Expand all
64 static gfx::Size GetToastSizeForView(views::View* view); 64 static gfx::Size GetToastSizeForView(views::View* view);
65 65
66 // Overridden from views::View: 66 // Overridden from views::View:
67 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; 67 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
68 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; 68 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
69 virtual void Layout() OVERRIDE; 69 virtual void Layout() OVERRIDE;
70 virtual gfx::Size GetPreferredSize() OVERRIDE; 70 virtual gfx::Size GetPreferredSize() OVERRIDE;
71 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 71 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
72 72
73 private: 73 private:
74 // Overridden from ui::AnimationDelegate: 74 // Overridden from gfx::AnimationDelegate:
75 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 75 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
76 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 76 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
77 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; 77 virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE;
78 78
79 // Overridden from views::WidgetDelegate: 79 // Overridden from views::WidgetDelegate:
80 virtual views::View* GetContentsView() OVERRIDE; 80 virtual views::View* GetContentsView() OVERRIDE;
81 virtual void WindowClosing() OVERRIDE; 81 virtual void WindowClosing() OVERRIDE;
82 virtual bool CanActivate() const OVERRIDE; 82 virtual bool CanActivate() const OVERRIDE;
83 virtual void OnDisplayChanged() OVERRIDE; 83 virtual void OnDisplayChanged() OVERRIDE;
84 virtual void OnWorkAreaChanged() OVERRIDE; 84 virtual void OnWorkAreaChanged() OVERRIDE;
85 85
86 // Given the bounds of a toast on the screen, compute the bouds for that 86 // Given the bounds of a toast on the screen, compute the bouds for that
87 // toast in 'closed' state. The 'closed' state is used as origin/destination 87 // toast in 'closed' state. The 'closed' state is used as origin/destination
88 // in reveal/closing animations. 88 // in reveal/closing animations.
89 gfx::Rect GetClosedToastBounds(gfx::Rect bounds); 89 gfx::Rect GetClosedToastBounds(gfx::Rect bounds);
90 90
91 void StartFadeIn(); 91 void StartFadeIn();
92 void StartFadeOut(); // Will call Widget::Close() when animation ends. 92 void StartFadeOut(); // Will call Widget::Close() when animation ends.
93 void OnBoundsAnimationEndedOrCancelled(const ui::Animation* animation); 93 void OnBoundsAnimationEndedOrCancelled(const gfx::Animation* animation);
94 94
95 base::WeakPtr<MessagePopupCollection> collection_; 95 base::WeakPtr<MessagePopupCollection> collection_;
96 MessageCenter* message_center_; 96 MessageCenter* message_center_;
97 97
98 // Id if the corresponding Notification. 98 // Id if the corresponding Notification.
99 std::string id_; 99 std::string id_;
100 100
101 scoped_ptr<ui::SlideAnimation> bounds_animation_; 101 scoped_ptr<gfx::SlideAnimation> bounds_animation_;
102 scoped_ptr<ui::SlideAnimation> fade_animation_; 102 scoped_ptr<gfx::SlideAnimation> fade_animation_;
103 103
104 bool is_animating_bounds_; 104 bool is_animating_bounds_;
105 gfx::Rect animated_bounds_start_; 105 gfx::Rect animated_bounds_start_;
106 gfx::Rect animated_bounds_end_; 106 gfx::Rect animated_bounds_end_;
107 // Started closing animation, will close at the end. 107 // Started closing animation, will close at the end.
108 bool is_closing_; 108 bool is_closing_;
109 // Closing animation - when it ends, close the widget. Weak, only used 109 // Closing animation - when it ends, close the widget. Weak, only used
110 // for referential equality. 110 // for referential equality.
111 ui::Animation* closing_animation_; 111 gfx::Animation* closing_animation_;
112 112
113 gfx::Point origin_; 113 gfx::Point origin_;
114 gfx::Size preferred_size_; 114 gfx::Size preferred_size_;
115 115
116 DISALLOW_COPY_AND_ASSIGN(ToastContentsView); 116 DISALLOW_COPY_AND_ASSIGN(ToastContentsView);
117 }; 117 };
118 118
119 } // namespace message_center 119 } // namespace message_center
120 120
121 #endif // UI_MESSAGE_CENTER_VIEWS_TOAST_CONTENTS_VIEW_H_ 121 #endif // UI_MESSAGE_CENTER_VIEWS_TOAST_CONTENTS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/message_center/views/message_popup_collection.cc ('k') | ui/message_center/views/toast_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698