| OLD | NEW |
| 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 gfx::Point origin() { return origin_; } | 74 gfx::Point origin() { return origin_; } |
| 75 gfx::Rect bounds() { return gfx::Rect(origin_, preferred_size_); } | 75 gfx::Rect bounds() { return gfx::Rect(origin_, preferred_size_); } |
| 76 | 76 |
| 77 const std::string& id() const { return id_; } | 77 const std::string& id() const { return id_; } |
| 78 | 78 |
| 79 // Overridden from views::View: | 79 // Overridden from views::View: |
| 80 void OnMouseEntered(const ui::MouseEvent& event) override; | 80 void OnMouseEntered(const ui::MouseEvent& event) override; |
| 81 void OnMouseExited(const ui::MouseEvent& event) override; | 81 void OnMouseExited(const ui::MouseEvent& event) override; |
| 82 void Layout() override; | 82 void Layout() override; |
| 83 gfx::Size GetPreferredSize() const override; | 83 gfx::Size GetPreferredSize() const override; |
| 84 void GetAccessibleState(ui::AXViewState* state) override; | 84 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 friend class test::MessagePopupCollectionTest; | 87 friend class test::MessagePopupCollectionTest; |
| 88 | 88 |
| 89 // Overridden from MessageCenterController: | 89 // Overridden from MessageCenterController: |
| 90 void ClickOnNotification(const std::string& notification_id) override; | 90 void ClickOnNotification(const std::string& notification_id) override; |
| 91 void RemoveNotification(const std::string& notification_id, | 91 void RemoveNotification(const std::string& notification_id, |
| 92 bool by_user) override; | 92 bool by_user) override; |
| 93 std::unique_ptr<ui::MenuModel> CreateMenuModel( | 93 std::unique_ptr<ui::MenuModel> CreateMenuModel( |
| 94 const NotifierId& notifier_id, | 94 const NotifierId& notifier_id, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 111 // Recalculates preferred size from underlying view and notifies about it. | 111 // Recalculates preferred size from underlying view and notifies about it. |
| 112 void UpdatePreferredSize(); | 112 void UpdatePreferredSize(); |
| 113 | 113 |
| 114 // Initialization and update. | 114 // Initialization and update. |
| 115 void CreateWidget(PopupAlignmentDelegate* alignment_delegate); | 115 void CreateWidget(PopupAlignmentDelegate* alignment_delegate); |
| 116 | 116 |
| 117 // Immediately moves the toast without any sort of delay or animation. | 117 // Immediately moves the toast without any sort of delay or animation. |
| 118 void SetBoundsInstantly(gfx::Rect new_bounds); | 118 void SetBoundsInstantly(gfx::Rect new_bounds); |
| 119 | 119 |
| 120 // Given the bounds of a toast on the screen, compute the bouds for that | 120 // Given the bounds of a toast on the screen, compute the bouds for that |
| 121 // toast in 'closed' state. The 'closed' state is used as origin/destination | 121 // toast in 'closed' node_data. The 'closed' node_data is used as |
| 122 // origin/destination |
| 122 // in reveal/closing animations. | 123 // in reveal/closing animations. |
| 123 gfx::Rect GetClosedToastBounds(gfx::Rect bounds); | 124 gfx::Rect GetClosedToastBounds(gfx::Rect bounds); |
| 124 | 125 |
| 125 void StartFadeIn(); | 126 void StartFadeIn(); |
| 126 void StartFadeOut(); // Will call Widget::Close() when animation ends. | 127 void StartFadeOut(); // Will call Widget::Close() when animation ends. |
| 127 void OnBoundsAnimationEndedOrCancelled(const gfx::Animation* animation); | 128 void OnBoundsAnimationEndedOrCancelled(const gfx::Animation* animation); |
| 128 | 129 |
| 129 base::WeakPtr<MessagePopupCollection> collection_; | 130 base::WeakPtr<MessagePopupCollection> collection_; |
| 130 | 131 |
| 131 // Id if the corresponding Notification. | 132 // Id if the corresponding Notification. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 144 | 145 |
| 145 gfx::Point origin_; | 146 gfx::Point origin_; |
| 146 gfx::Size preferred_size_; | 147 gfx::Size preferred_size_; |
| 147 | 148 |
| 148 DISALLOW_COPY_AND_ASSIGN(ToastContentsView); | 149 DISALLOW_COPY_AND_ASSIGN(ToastContentsView); |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 } // namespace message_center | 152 } // namespace message_center |
| 152 | 153 |
| 153 #endif // UI_MESSAGE_CENTER_VIEWS_TOAST_CONTENTS_VIEW_H_ | 154 #endif // UI_MESSAGE_CENTER_VIEWS_TOAST_CONTENTS_VIEW_H_ |
| OLD | NEW |