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 #include "chrome/browser/android/vr_shell/ui_elements/transience_manager.h" | |
| 6 | |
| 7 namespace vr_shell { | |
| 8 | |
| 9 void TransienceManager::SetEnabled(bool enabled) { | |
| 10 if (enabled_ == enabled) | |
| 11 return; | |
| 12 enabled_ = enabled; | |
| 13 if (!enabled) { | |
| 14 element_->set_visible(false); | |
| 15 visibility_timer_.Stop(); | |
| 16 return; | |
|
bshe
2017/06/27 14:57:09
no need to return
cjgrant
2017/06/28 19:00:55
Done.
| |
| 17 } | |
| 18 } | |
| 19 | |
| 20 void TransienceManager::KickVisibility() { | |
| 21 if (enabled_) { | |
| 22 element_->set_visible(true); | |
| 23 StartTimer(); | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 void TransienceManager::StartTimer() { | |
| 28 visibility_timer_.Start( | |
| 29 FROM_HERE, timeout_, | |
| 30 base::Bind(&TransienceManager::OnTimeout, base::Unretained(this))); | |
| 31 } | |
| 32 | |
| 33 void TransienceManager::OnTimeout() { | |
| 34 element_->set_visible(false); | |
| 35 } | |
| 36 | |
| 37 } // namespace vr_shell | |
| OLD | NEW |