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