Chromium Code Reviews| Index: ash/system/toast/toast_manager.h |
| diff --git a/ash/system/toast/toast_manager.h b/ash/system/toast/toast_manager.h |
| index d46832d383f7a2a6cc1809283b211b5f11b9f5bc..b9d1124f079956f5fe5242741e9db08bfadd2c90 100644 |
| --- a/ash/system/toast/toast_manager.h |
| +++ b/ash/system/toast/toast_manager.h |
| @@ -5,12 +5,13 @@ |
| #ifndef ASH_SYSTEM_TOAST_TOAST_MANAGER_H_ |
| #define ASH_SYSTEM_TOAST_TOAST_MANAGER_H_ |
| +#include <list> |
| #include <memory> |
| -#include <queue> |
| #include <string> |
| #include "ash/ash_export.h" |
| #include "ash/shell_observer.h" |
| +#include "ash/system/toast/toast_data.h" |
| #include "ash/system/toast/toast_overlay.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/threading/thread_checker.h" |
| @@ -25,23 +26,29 @@ class ASH_EXPORT ToastManager : public ToastOverlay::Delegate { |
| // Show a toast. If there are queued toasts, succeeding toasts are queued as |
| // well, and are shown one by one. |
| - void Show(const std::string& text, uint64_t duration_ms); |
| + void Show(const ToastData& data); |
| + |
| + void Cancel(const std::string& id); |
| // ToastOverlay::Delegate overrides: |
| void OnClosed() override; |
| private: |
| friend class ToastManagerTest; |
| + using Queue = std::list<ToastData>; |
|
oshima
2016/05/18 16:59:44
std::vector is usually faster:
http://baptiste-wi
yoshiki
2016/05/19 09:14:12
Thank you for giving information. I use vector.
yoshiki
2016/05/20 06:57:30
Let me use std::list, since the vector doesn't hav
|
| void ShowLatest(); |
| - void OnDurationPassed(int toast_id); |
| + void OnDurationPassed(int toast_number); |
| - int toast_id_for_testing() const { return toast_id_; } |
| ToastOverlay* GetCurrentOverlayForTesting() { return overlay_.get(); } |
| - void ResetToastIdForTesting() { toast_id_ = 0; } |
| + int serial_for_testing() const { return serial_; } |
| + void ResetSerialForTesting() { serial_ = 0; } |
| + |
| + // ID of the toast which is currently shown. Empty if no toast is visible. |
| + std::string current_toast_id_; |
| - int toast_id_ = 0; |
| - std::queue<std::pair<std::string, uint64_t>> queue_; |
| + int serial_ = 0; |
| + Queue queue_; |
| std::unique_ptr<ToastOverlay> overlay_; |
| base::WeakPtrFactory<ToastManager> weak_ptr_factory_; |