Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: chrome/browser/android/vr_shell/ui_elements/loading_indicator.cc

Issue 2893853002: WebVR: Ensure loading indicator starts hidden. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h" 5 #include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/android/vr_shell/textures/loading_indicator_texture.h" 8 #include "chrome/browser/android/vr_shell/textures/loading_indicator_texture.h"
9 9
10 namespace vr_shell { 10 namespace vr_shell {
11 11
12 namespace { 12 namespace {
13 13
14 static constexpr int kVisibilityTimeoutMs = 200; 14 static constexpr int kVisibilityTimeoutMs = 200;
15 } 15 }
16 16
17 LoadingIndicator::LoadingIndicator(int preferred_width) 17 LoadingIndicator::LoadingIndicator(int preferred_width)
18 : TexturedElement(preferred_width), 18 : TexturedElement(preferred_width),
19 texture_(base::MakeUnique<LoadingIndicatorTexture>()) {} 19 texture_(base::MakeUnique<LoadingIndicatorTexture>()) {
20 set_visible(false);
21 }
20 22
21 LoadingIndicator::~LoadingIndicator() = default; 23 LoadingIndicator::~LoadingIndicator() = default;
22 24
23 UiTexture* LoadingIndicator::GetTexture() const { 25 UiTexture* LoadingIndicator::GetTexture() const {
24 return texture_.get(); 26 return texture_.get();
25 } 27 }
26 28
27 void LoadingIndicator::SetEnabled(bool enabled) { 29 void LoadingIndicator::SetEnabled(bool enabled) {
28 if (enabled_ == enabled) 30 if (enabled_ == enabled)
29 return; 31 return;
(...skipping 29 matching lines...) Expand all
59 void LoadingIndicator::SetVisibility() { 61 void LoadingIndicator::SetVisibility() {
60 set_visible(enabled_ && (loading_ || visibility_timer_.IsRunning())); 62 set_visible(enabled_ && (loading_ || visibility_timer_.IsRunning()));
61 } 63 }
62 64
63 void LoadingIndicator::OnBeginFrame(const base::TimeTicks& ticks) { 65 void LoadingIndicator::OnBeginFrame(const base::TimeTicks& ticks) {
64 if (enabled_ && texture_->dirty()) 66 if (enabled_ && texture_->dirty())
65 UpdateTexture(); 67 UpdateTexture();
66 } 68 }
67 69
68 } // namespace vr_shell 70 } // namespace vr_shell
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698