Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Unified Diff: ash/system/toast/toast_overlay.h

Issue 1782793002: Ash: Implement Toasts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/system/toast/toast_overlay.h
diff --git a/ash/system/toast/toast_overlay.h b/ash/system/toast/toast_overlay.h
new file mode 100644
index 0000000000000000000000000000000000000000..38cbfc4751e9ccce8f77f65d625ce448e56cea42
--- /dev/null
+++ b/ash/system/toast/toast_overlay.h
@@ -0,0 +1,67 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_
+#define ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_
+
+#include "ash/ash_export.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/compositor/layer_animation_observer.h"
+#include "ui/events/event.h"
+#include "ui/events/event_constants.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace gfx {
+class Rect;
+}
+
+namespace views {
+class Widget;
+}
+
+namespace ash {
+
+class ToastManagerTest;
+class ToastOverlayView;
+class ToastOverlayButton;
+
+class ASH_EXPORT ToastOverlay : public ui::LayerAnimationObserver {
+ public:
+ class ASH_EXPORT Delegate {
+ public:
+ virtual ~Delegate() {}
+ virtual void OnClosed() = 0;
+ };
+
+ ToastOverlay(Delegate* delegate, const std::string& text);
+ ~ToastOverlay() override;
+
+ // Shows or hides the overlay.
+ void Show(bool visible);
+
+ private:
+ friend class ToastManagerTest;
+
+ // Returns the current bounds of the overlay, which is based on visibility.
+ gfx::Rect CalculateOverlayBounds();
+
+ // gfx::LayerAnimationObserver overrides:
+ void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override;
+ void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override;
+ void OnLayerAnimationScheduled(ui::LayerAnimationSequence* sequence) override;
+
+ void ClickDismissButtonForTesting(const ui::Event& event);
+
+ bool is_visible_ = false;
+ Delegate* const delegate_;
+ scoped_ptr<views::Widget> overlay_widget_;
+ scoped_ptr<ToastOverlayView> overlay_view_;
+ gfx::Size widget_size_;
+
+ DISALLOW_COPY_AND_ASSIGN(ToastOverlay);
+};
+
+} // namespace ash
+
+#endif // ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_

Powered by Google App Engine
This is Rietveld 408576698