Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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 CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_TRANSIENCE_MANAGER_H_ | |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_TRANSIENCE_MANAGER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/timer/timer.h" | |
| 12 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" | |
| 13 | |
| 14 namespace vr_shell { | |
| 15 | |
| 16 class TransienceManager { | |
| 17 public: | |
| 18 TransienceManager(UiElement* element, const base::TimeDelta& timeout) | |
| 19 : element_(element), timeout_(timeout) { | |
|
bshe
2017/06/27 14:57:09
nit: move implementation to .cc file
cjgrant
2017/06/28 19:00:55
Done.
| |
| 20 element_->set_visible(false); | |
| 21 } | |
| 22 | |
| 23 virtual ~TransienceManager() = default; | |
| 24 | |
| 25 void SetEnabled(bool enabled); | |
| 26 void KickVisibility(); | |
|
bshe
2017/06/27 14:57:09
Perhaps name the function to showIfEnabled? It is
cjgrant
2017/06/28 19:00:55
Done. I use Kick instead of Show to keep the time
| |
| 27 void EndVisibility(); | |
|
bshe
2017/06/27 14:57:09
Remove this too?
cjgrant
2017/06/28 19:00:55
In this reworked version, we still need it.
| |
| 28 | |
| 29 private: | |
| 30 void StartTimer(); | |
| 31 void OnTimeout(); | |
| 32 | |
| 33 UiElement* element_; | |
| 34 base::TimeDelta timeout_; | |
| 35 bool enabled_ = false; | |
| 36 base::OneShotTimer visibility_timer_; | |
| 37 }; | |
| 38 | |
| 39 } // namespace vr_shell | |
| 40 | |
| 41 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_TRANSIENCE_MANAGER_H_ | |
| OLD | NEW |