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