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..5210a23d3c2a96ee31cec26211aeb3fc59eea9f1 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,28 @@ 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 QueueElement = std::pair<std::string, ToastData>; |
|
oshima
2016/05/16 22:37:25
toast data has id. Any particular reason to have a
yoshiki
2016/05/17 06:25:21
Done.
|
| + using Queue = std::list<QueueElement>; |
| 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; } |
| - int toast_id_ = 0; |
| - std::queue<std::pair<std::string, uint64_t>> queue_; |
| + std::string toast_id_; |
|
dcheng
2016/05/17 02:57:25
Add a comment what this is: ID of the currently di
yoshiki
2016/05/17 06:25:21
Done.
|
| + int serial_ = 0; |
| + Queue queue_; |
| std::unique_ptr<ToastOverlay> overlay_; |
| base::WeakPtrFactory<ToastManager> weak_ptr_factory_; |