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

Side by Side Diff: ash/system/toast/toast_overlay.h

Issue 2139183003: mash: Migrate //ash/system/toast to WM common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move test back Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « ash/system/toast/toast_manager_unittest.cc ('k') | ash/system/toast/toast_overlay.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 <memory>
9
10 #include "ash/ash_export.h"
11 #include "ui/compositor/layer_animation_observer.h"
12 #include "ui/events/event.h"
13 #include "ui/events/event_constants.h"
14 #include "ui/gfx/geometry/size.h"
15 #include "ui/views/view.h"
16
17 namespace gfx {
18 class Rect;
19 }
20
21 namespace views {
22 class Widget;
23 }
24
25 namespace ash {
26
27 class ToastManagerTest;
28 class ToastOverlayView;
29 class ToastOverlayButton;
30
31 class ASH_EXPORT ToastOverlay : public ui::ImplicitAnimationObserver {
32 public:
33 class ASH_EXPORT Delegate {
34 public:
35 virtual ~Delegate() {}
36 virtual void OnClosed() = 0;
37 };
38
39 // Creates the Toast overlay UI. |text| is the message to be shown, and
40 // |dismiss_text| is the message for the button to dismiss the toast message.
41 // |dismiss_text| is optional. If empty, the default text is used.
42 ToastOverlay(Delegate* delegate,
43 const std::string& text,
44 const std::string& dismiss_text);
45 ~ToastOverlay() override;
46
47 // Shows or hides the overlay.
48 void Show(bool visible);
49
50 private:
51 friend class ToastManagerTest;
52
53 // Returns the current bounds of the overlay, which is based on visibility.
54 gfx::Rect CalculateOverlayBounds();
55
56 void OnImplicitAnimationsScheduled() override;
57 void OnImplicitAnimationsCompleted() override;
58
59 views::Widget* widget_for_testing();
60 void ClickDismissButtonForTesting(const ui::Event& event);
61
62 Delegate* const delegate_;
63 const std::string text_;
64 const std::string dismiss_text_;
65 std::unique_ptr<views::Widget> overlay_widget_;
66 std::unique_ptr<ToastOverlayView> overlay_view_;
67 gfx::Size widget_size_;
68
69 DISALLOW_COPY_AND_ASSIGN(ToastOverlay);
70 };
71
72 } // namespace ash
73
74 #endif // ASH_SYSTEM_TOAST_TOAST_OVERLAY_H_
OLDNEW
« no previous file with comments | « ash/system/toast/toast_manager_unittest.cc ('k') | ash/system/toast/toast_overlay.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698