| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_ |
| 6 #define ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_ |
| 7 |
| 8 #include "ash/ash_export.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/compositor/layer_animation_observer.h" |
| 11 #include "ui/events/event.h" |
| 12 #include "ui/events/event_constants.h" |
| 13 #include "ui/gfx/geometry/size.h" |
| 14 |
| 15 namespace gfx { |
| 16 class Rect; |
| 17 } |
| 18 |
| 19 namespace views { |
| 20 class Widget; |
| 21 } |
| 22 |
| 23 namespace ash { |
| 24 |
| 25 class ToastManagerTest; |
| 26 class ToastOverlayView; |
| 27 class ToastOverlayButton; |
| 28 |
| 29 class ASH_EXPORT ToastOverlay : public ui::LayerAnimationObserver { |
| 30 public: |
| 31 class ASH_EXPORT Delegate { |
| 32 public: |
| 33 virtual ~Delegate() {} |
| 34 virtual void OnClosed() = 0; |
| 35 }; |
| 36 |
| 37 ToastOverlay(Delegate* delegate, const std::string& text); |
| 38 ~ToastOverlay() override; |
| 39 |
| 40 // Shows or hides the overlay. |
| 41 void Show(bool visible); |
| 42 |
| 43 private: |
| 44 friend class ToastManagerTest; |
| 45 |
| 46 // Returns the current bounds of the overlay, which is based on visibility. |
| 47 gfx::Rect CalculateOverlayBounds(); |
| 48 |
| 49 // gfx::LayerAnimationObserver overrides: |
| 50 void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override; |
| 51 void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override; |
| 52 void OnLayerAnimationScheduled(ui::LayerAnimationSequence* sequence) override; |
| 53 |
| 54 void ClickDismissButtonForTesting(const ui::Event& event); |
| 55 |
| 56 bool is_visible_ = false; |
| 57 Delegate* const delegate_; |
| 58 scoped_ptr<views::Widget> overlay_widget_; |
| 59 scoped_ptr<ToastOverlayView> overlay_view_; |
| 60 gfx::Size widget_size_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(ToastOverlay); |
| 63 }; |
| 64 |
| 65 } // namespace ash |
| 66 |
| 67 #endif // ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_ |
| OLD | NEW |