| 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) { |
| 20 element_->set_visible(false); |
| 21 } |
| 22 |
| 23 virtual ~TransienceManager() = default; |
| 24 |
| 25 void SetEnabled(bool enabled); |
| 26 void KickVisibility(); |
| 27 void EndVisibility(); |
| 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 |