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

Side by Side Diff: ash/common/system/toast/toast_manager.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_data.cc ('k') | ash/common/system/toast/toast_manager.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_MANAGER_H_
6 #define ASH_COMMON_SYSTEM_TOAST_TOAST_MANAGER_H_
7
8 #include <deque>
9 #include <memory>
10 #include <string>
11
12 #include "ash/ash_export.h"
13 #include "ash/common/system/toast/toast_data.h"
14 #include "ash/common/system/toast/toast_overlay.h"
15 #include "base/memory/weak_ptr.h"
16
17 namespace ash {
18
19 // Class managing toast requests.
20 class ASH_EXPORT ToastManager : public ToastOverlay::Delegate {
21 public:
22 ToastManager();
23 ~ToastManager() override;
24
25 // Show a toast. If there are queued toasts, succeeding toasts are queued as
26 // well, and are shown one by one.
27 void Show(const ToastData& data);
28
29 void Cancel(const std::string& id);
30
31 // ToastOverlay::Delegate overrides:
32 void OnClosed() override;
33
34 private:
35 friend class ToastManagerTest;
36
37 void ShowLatest();
38 void OnDurationPassed(int toast_number);
39
40 ToastOverlay* GetCurrentOverlayForTesting() { return overlay_.get(); }
41 int serial_for_testing() const { return serial_; }
42 void ResetSerialForTesting() { serial_ = 0; }
43
44 // ID of the toast which is currently shown. Empty if no toast is visible.
45 std::string current_toast_id_;
46
47 int serial_ = 0;
48 std::deque<ToastData> queue_;
49 std::unique_ptr<ToastOverlay> overlay_;
50
51 base::WeakPtrFactory<ToastManager> weak_ptr_factory_;
52
53 DISALLOW_COPY_AND_ASSIGN(ToastManager);
54 };
55
56 } // namespace ash
57
58 #endif // ASH_COMMON_SYSTEM_TOAST_TOAST_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/common/system/toast/toast_data.cc ('k') | ash/common/system/toast/toast_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698