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

Unified Diff: chrome/browser/android/vr_shell/ui_scene_manager.cc

Issue 2877133002: VR: Add a loading indicator to the scene. (Closed)
Patch Set: Add units to timeout constant. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | chrome/browser/android/vr_shell/vr_gl_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/ui_scene_manager.cc
diff --git a/chrome/browser/android/vr_shell/ui_scene_manager.cc b/chrome/browser/android/vr_shell/ui_scene_manager.cc
index 857d4d2eb59e1b0d48aa790947a17793b7cbfcfe..00126b5c0080b8da814128081f95a58af4f57968 100644
--- a/chrome/browser/android/vr_shell/ui_scene_manager.cc
+++ b/chrome/browser/android/vr_shell/ui_scene_manager.cc
@@ -6,6 +6,7 @@
#include "base/memory/ptr_util.h"
#include "chrome/browser/android/vr_shell/textures/ui_texture.h"
+#include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h"
#include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning.h"
#include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning.h"
#include "chrome/browser/android/vr_shell/ui_elements/ui_element.h"
@@ -67,6 +68,8 @@ UiSceneManager::UiSceneManager(VrBrowserInterface* browser,
CreateContentQuad();
CreateSecurityWarnings();
CreateUrlBar();
+
+ ConfigureScene();
}
UiSceneManager::~UiSceneManager() {}
@@ -189,16 +192,21 @@ void UiSceneManager::CreateBackground() {
void UiSceneManager::CreateUrlBar() {
// TODO(cjgrant): Incorporate final size and position.
- // TODO(cjgrant): Add the loading progress indicator element.
- auto element = base::MakeUnique<UrlBar>(512);
- element->set_id(AllocateId());
- element->set_translation({0, -0.9, -1.8});
- element->set_size({0.9, 0, 1});
- element->SetBackButtonCallback(
+ auto url_bar = base::MakeUnique<UrlBar>(512);
+ url_bar->set_id(AllocateId());
+ url_bar->set_translation({0, -0.9, -1.8});
+ url_bar->set_size({0.9, 0, 1});
+ url_bar->SetBackButtonCallback(
base::Bind(&UiSceneManager::OnBackButtonClicked, base::Unretained(this)));
- url_bar_ = element.get();
- browser_ui_elements_.push_back(element.get());
- scene_->AddUiElement(std::move(element));
+ url_bar_ = url_bar.get();
+ scene_->AddUiElement(std::move(url_bar));
+
+ auto indicator = base::MakeUnique<LoadingIndicator>(256);
+ indicator->set_id(AllocateId());
+ indicator->set_translation({0, -0.8, -1.8});
+ indicator->set_size({0.4, 0, 1});
+ loading_indicator_ = indicator.get();
+ scene_->AddUiElement(std::move(indicator));
}
base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() {
@@ -208,13 +216,17 @@ base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() {
void UiSceneManager::SetWebVrMode(bool web_vr) {
web_vr_mode_ = web_vr;
- // Make all VR scene UI elements visible if not in WebVR.
+ ConfigureScene();
+}
+
+void UiSceneManager::ConfigureScene() {
amp 2017/05/12 18:46:44 Should we have the fullscreen changes go through h
cjgrant 2017/05/12 18:52:12 We could do that. It'd look more like the origina
cjgrant 2017/05/12 21:03:06 Done. I refactored as suggested and retested. PT
+ // Make all simple browser UI elements visible if not in WebVR.
for (UiElement* element : browser_ui_elements_) {
element->set_visible(!web_vr_mode_);
}
- url_bar_->SetEnabled(!web_vr);
- ConfigureSecurityWarnings();
+ url_bar_->SetEnabled(!web_vr_mode_);
+ loading_indicator_->SetEnabled(!web_vr_mode_);
}
void UiSceneManager::SetWebVrSecureOrigin(bool secure) {
@@ -289,9 +301,13 @@ void UiSceneManager::SetSecurityLevel(int level) {
url_bar_->SetSecurityLevel(level);
}
-void UiSceneManager::SetLoading(bool loading) {}
+void UiSceneManager::SetLoading(bool loading) {
+ loading_indicator_->SetLoading(loading);
+}
-void UiSceneManager::SetLoadProgress(double progress) {}
+void UiSceneManager::SetLoadProgress(float progress) {
+ loading_indicator_->SetLoadProgress(progress);
+}
void UiSceneManager::SetHistoryButtonsEnabled(bool can_go_back,
bool can_go_forward) {}
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | chrome/browser/android/vr_shell/vr_gl_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698