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

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

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 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 unified diff | Download patch
« no previous file with comments | « ash/common/system/toast/toast_manager.cc ('k') | ash/common/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_COMMON_SYSTEM_TOAST_TOAST_OVERLAY_H_
6 #define ASH_COMMON_SYSTEM_TOAST_TOAST_OVERLAY_H_
7
8 #include <memory>
9
10 #include "ash/ash_export.h"
11 #include "base/optional.h"
12 #include "base/strings/string16.h"
13 #include "ui/compositor/layer_animation_observer.h"
14 #include "ui/events/event.h"
15 #include "ui/events/event_constants.h"
16 #include "ui/gfx/geometry/size.h"
17
18 namespace gfx {
19 class Rect;
20 }
21
22 namespace views {
23 class Widget;
24 }
25
26 namespace ash {
27
28 class ToastManagerTest;
29 class ToastOverlayView;
30 class ToastOverlayButton;
31
32 class ASH_EXPORT ToastOverlay : public ui::ImplicitAnimationObserver {
33 public:
34 class ASH_EXPORT Delegate {
35 public:
36 virtual ~Delegate() {}
37 virtual void OnClosed() = 0;
38 };
39
40 // Creates the Toast overlay UI. |text| is the message to be shown, and
41 // |dismiss_text| is the message for the button to dismiss the toast message.
42 // If |dismiss_text| is null, no dismiss button will be shown. If
43 // |dismiss_text| has a value but the string is empty, the default text is
44 // used.
45 ToastOverlay(Delegate* delegate,
46 const base::string16& text,
47 base::Optional<base::string16> dismiss_text);
48 ~ToastOverlay() override;
49
50 // Shows or hides the overlay.
51 void Show(bool visible);
52
53 private:
54 friend class ToastManagerTest;
55
56 // Returns the current bounds of the overlay, which is based on visibility.
57 gfx::Rect CalculateOverlayBounds();
58
59 // ui::ImplicitAnimationObserver:
60 void OnImplicitAnimationsScheduled() override;
61 void OnImplicitAnimationsCompleted() override;
62
63 views::Widget* widget_for_testing();
64 ToastOverlayButton* dismiss_button_for_testing();
65 void ClickDismissButtonForTesting(const ui::Event& event);
66
67 Delegate* const delegate_;
68 const base::string16 text_;
69 const base::Optional<base::string16> dismiss_text_;
70 std::unique_ptr<views::Widget> overlay_widget_;
71 std::unique_ptr<ToastOverlayView> overlay_view_;
72 gfx::Size widget_size_;
73
74 DISALLOW_COPY_AND_ASSIGN(ToastOverlay);
75 };
76
77 } // namespace ash
78
79 #endif // ASH_COMMON_SYSTEM_TOAST_TOAST_OVERLAY_H_
OLDNEW
« no previous file with comments | « ash/common/system/toast/toast_manager.cc ('k') | ash/common/system/toast/toast_overlay.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698