Chromium Code Reviews| 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_MANAGER_H_ | |
| 6 #define ASH_SYSTEM_TOAST_TOAST_MANAGER_H_ | |
| 7 | |
| 8 #include <queue> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "ash/ash_export.h" | |
| 12 #include "ash/shell_observer.h" | |
| 13 #include "ash/system/toast/toast_overlay.h" | |
| 14 #include "base/memory/singleton.h" | |
| 15 #include "base/threading/thread_checker.h" | |
| 16 | |
| 17 namespace ash { | |
| 18 | |
| 19 class ToastManagerTest; | |
|
oshima
2016/03/11 09:40:24
friend class decl below should be enough.
yoshiki
2016/03/11 14:30:34
Done.
| |
| 20 | |
| 21 class ASH_EXPORT ToastManager : public ToastOverlay::Delegate, | |
|
oshima
2016/03/11 09:40:24
document the class (explain Show will queue the te
yoshiki
2016/03/11 14:30:34
Done.
| |
| 22 public ShellObserver { | |
| 23 public: | |
| 24 ToastManager(); | |
| 25 ~ToastManager() override; | |
| 26 | |
| 27 void Show(const std::string& text, uint64_t duration_ms); | |
| 28 | |
|
oshima
2016/03/11 09:40:24
// ToastOverlay::Delegate
yoshiki
2016/03/11 14:30:34
Done.
| |
| 29 void OnClosed() override; | |
| 30 | |
| 31 private: | |
| 32 friend struct base::DefaultSingletonTraits<ToastManager>; | |
|
oshima
2016/03/11 09:40:24
remove this?
yoshiki
2016/03/11 14:30:34
Done.
| |
| 33 friend class ToastManagerTest; | |
| 34 | |
| 35 void ShowLatest(); | |
| 36 void OnDurationPassed(int toast_id); | |
| 37 | |
| 38 int toast_id_for_testing() const { return toast_id_; } | |
| 39 ToastOverlay* GetCurrentOverlayForTesting() const { return overlay_.get(); } | |
| 40 void ResetToastIdForTesting() { toast_id_ = 0; } | |
| 41 | |
| 42 int toast_id_ = 0; | |
| 43 std::queue<std::pair<std::string, uint64_t>> queue_; | |
| 44 scoped_ptr<ToastOverlay> overlay_; | |
| 45 | |
| 46 base::ThreadChecker thread_checker_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(ToastManager); | |
| 49 }; | |
| 50 | |
| 51 } // namespace ash | |
| 52 | |
| 53 #endif // ASH_SYSTEM_TOAST_TOAST_MANAGER_H_ | |
| OLD | NEW |