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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..061cddb5daec60443568b9a6c9ed0869ffcada39 |
| --- /dev/null |
| +++ b/ash/system/toast/toast_manager.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ASH_SYSTEM_TOAST_TOAST_MANAGER_H_ |
| +#define ASH_SYSTEM_TOAST_TOAST_MANAGER_H_ |
| + |
| +#include <queue> |
| +#include <string> |
| + |
| +#include "ash/ash_export.h" |
| +#include "ash/shell_observer.h" |
| +#include "ash/system/toast/toast_overlay.h" |
| +#include "base/memory/singleton.h" |
| +#include "base/threading/thread_checker.h" |
| + |
| +namespace ash { |
| + |
| +class ToastManagerTest; |
|
oshima
2016/03/11 09:40:24
friend class decl below should be enough.
yoshiki
2016/03/11 14:30:34
Done.
|
| + |
| +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.
|
| + public ShellObserver { |
| + public: |
| + ToastManager(); |
| + ~ToastManager() override; |
| + |
| + void Show(const std::string& text, uint64_t duration_ms); |
| + |
|
oshima
2016/03/11 09:40:24
// ToastOverlay::Delegate
yoshiki
2016/03/11 14:30:34
Done.
|
| + void OnClosed() override; |
| + |
| + private: |
| + friend struct base::DefaultSingletonTraits<ToastManager>; |
|
oshima
2016/03/11 09:40:24
remove this?
yoshiki
2016/03/11 14:30:34
Done.
|
| + friend class ToastManagerTest; |
| + |
| + void ShowLatest(); |
| + void OnDurationPassed(int toast_id); |
| + |
| + int toast_id_for_testing() const { return toast_id_; } |
| + ToastOverlay* GetCurrentOverlayForTesting() const { return overlay_.get(); } |
| + void ResetToastIdForTesting() { toast_id_ = 0; } |
| + |
| + int toast_id_ = 0; |
| + std::queue<std::pair<std::string, uint64_t>> queue_; |
| + scoped_ptr<ToastOverlay> overlay_; |
| + |
| + base::ThreadChecker thread_checker_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ToastManager); |
| +}; |
| + |
| +} // namespace ash |
| + |
| +#endif // ASH_SYSTEM_TOAST_TOAST_MANAGER_H_ |