| 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/system/toast/toast_overlay.h" |
| 13 #include "base/memory/singleton.h" |
| 14 #include "base/threading/thread_checker.h" |
| 15 |
| 16 namespace ash { |
| 17 |
| 18 class ASH_EXPORT ToastManager : public ToastOverlay::Delegate { |
| 19 public: |
| 20 static ToastManager* GetInstance(); |
| 21 |
| 22 void Show(const std::string& text, uint64_t duration_ms); |
| 23 |
| 24 void OnClosed() override; |
| 25 |
| 26 private: |
| 27 friend struct base::DefaultSingletonTraits<ToastManager>; |
| 28 |
| 29 ToastManager(); // private ctor |
| 30 virtual ~ToastManager(); |
| 31 |
| 32 void ShowLatest(); |
| 33 void OnDurationPassed(int toast_id); |
| 34 |
| 35 int toast_id_ = 0; |
| 36 std::queue<std::pair<std::string, uint64_t>> queue_; |
| 37 scoped_ptr<ToastOverlay> overlay_; |
| 38 |
| 39 base::ThreadChecker thread_checker_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(ToastManager); |
| 42 }; |
| 43 |
| 44 } // namespace ash |
| 45 |
| 46 #endif // ASH_SYSTEM_TOAST_TOAST_MANAGER_H_ |
| OLD | NEW |