| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_TOAST_TOAST_OVERLAY_H_ | 5 #ifndef ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_ |
| 6 #define ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_ | 6 #define ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace views { | 21 namespace views { |
| 22 class Widget; | 22 class Widget; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace ash { | 25 namespace ash { |
| 26 | 26 |
| 27 class ToastManagerTest; | 27 class ToastManagerTest; |
| 28 class ToastOverlayView; | 28 class ToastOverlayView; |
| 29 class ToastOverlayButton; | 29 class ToastOverlayButton; |
| 30 | 30 |
| 31 class ASH_EXPORT ToastOverlay : public ui::LayerAnimationObserver { | 31 class ASH_EXPORT ToastOverlay : public ui::ImplicitAnimationObserver { |
| 32 public: | 32 public: |
| 33 class ASH_EXPORT Delegate { | 33 class ASH_EXPORT Delegate { |
| 34 public: | 34 public: |
| 35 virtual ~Delegate() {} | 35 virtual ~Delegate() {} |
| 36 virtual void OnClosed() = 0; | 36 virtual void OnClosed() = 0; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 ToastOverlay(Delegate* delegate, const std::string& text); | 39 ToastOverlay(Delegate* delegate, const std::string& text); |
| 40 ~ToastOverlay() override; | 40 ~ToastOverlay() override; |
| 41 | 41 |
| 42 // Shows or hides the overlay. | 42 // Shows or hides the overlay. |
| 43 void Show(bool visible); | 43 void Show(bool visible); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 friend class ToastManagerTest; | 46 friend class ToastManagerTest; |
| 47 | 47 |
| 48 // Returns the current bounds of the overlay, which is based on visibility. | 48 // Returns the current bounds of the overlay, which is based on visibility. |
| 49 gfx::Rect CalculateOverlayBounds(); | 49 gfx::Rect CalculateOverlayBounds(); |
| 50 | 50 |
| 51 // gfx::LayerAnimationObserver overrides: | 51 void OnImplicitAnimationsScheduled() override; |
| 52 void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override; | 52 void OnImplicitAnimationsCompleted() override; |
| 53 void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override; | |
| 54 void OnLayerAnimationScheduled(ui::LayerAnimationSequence* sequence) override; | |
| 55 | 53 |
| 56 views::Widget* widget_for_testing(); | 54 views::Widget* widget_for_testing(); |
| 57 void ClickDismissButtonForTesting(const ui::Event& event); | 55 void ClickDismissButtonForTesting(const ui::Event& event); |
| 58 | 56 |
| 59 bool is_visible_ = false; | |
| 60 Delegate* const delegate_; | 57 Delegate* const delegate_; |
| 61 const std::string text_; | 58 const std::string text_; |
| 62 std::unique_ptr<views::Widget> overlay_widget_; | 59 std::unique_ptr<views::Widget> overlay_widget_; |
| 63 std::unique_ptr<ToastOverlayView> overlay_view_; | 60 std::unique_ptr<ToastOverlayView> overlay_view_; |
| 64 gfx::Size widget_size_; | 61 gfx::Size widget_size_; |
| 65 | 62 |
| 66 DISALLOW_COPY_AND_ASSIGN(ToastOverlay); | 63 DISALLOW_COPY_AND_ASSIGN(ToastOverlay); |
| 67 }; | 64 }; |
| 68 | 65 |
| 69 } // namespace ash | 66 } // namespace ash |
| 70 | 67 |
| 71 #endif // ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_ | 68 #endif // ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_ |
| OLD | NEW |