| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_LOADING_INDICATOR_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_LOADING_INDICATOR_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_LOADING_INDICATOR_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_LOADING_INDICATOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "chrome/browser/android/vr_shell/ui_elements/textured_element.h" | 12 #include "chrome/browser/android/vr_shell/ui_elements/textured_element.h" |
| 13 | 13 |
| 14 namespace vr_shell { | 14 namespace vr_shell { |
| 15 | 15 |
| 16 class LoadingIndicatorTexture; | 16 class LoadingIndicatorTexture; |
| 17 | 17 |
| 18 class LoadingIndicator : public TexturedElement { | 18 class LoadingIndicator : public TexturedElement { |
| 19 public: | 19 public: |
| 20 explicit LoadingIndicator(int preferred_width); | 20 explicit LoadingIndicator(int id, int preferred_width); |
| 21 ~LoadingIndicator() override; | 21 ~LoadingIndicator() override; |
| 22 | 22 |
| 23 void SetLoading(bool loading); | 23 void SetLoading(bool loading); |
| 24 void SetLoadProgress(float progress); | 24 void SetLoadProgress(float progress); |
| 25 | 25 |
| 26 void SetEnabled(bool enabled) override; | 26 void SetEnabled(bool enabled) override; |
| 27 void OnBeginFrame(const base::TimeTicks& ticks) override; | 27 void OnBeginFrame(const base::TimeTicks& ticks) override; |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 UiTexture* GetTexture() const override; | 30 UiTexture* GetTexture() const override; |
| 31 std::unique_ptr<LoadingIndicatorTexture> texture_; | 31 std::unique_ptr<LoadingIndicatorTexture> texture_; |
| 32 | 32 |
| 33 void ResetVisibilityTimer(); | 33 void ResetVisibilityTimer(); |
| 34 void SetVisibility(); | 34 void SetVisibility(); |
| 35 | 35 |
| 36 base::OneShotTimer visibility_timer_; | 36 base::OneShotTimer visibility_timer_; |
| 37 bool enabled_ = false; | 37 bool enabled_ = false; |
| 38 bool loading_ = false; | 38 bool loading_ = false; |
| 39 | 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(LoadingIndicator); | 40 DISALLOW_COPY_AND_ASSIGN(LoadingIndicator); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace vr_shell | 43 } // namespace vr_shell |
| 44 | 44 |
| 45 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_LOADING_INDICATOR_H_ | 45 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_LOADING_INDICATOR_H_ |
| OLD | NEW |