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

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

Issue 2833773005: Pause drawing webvr when the App button is pressed (Closed)
Patch Set: make UiBrowserInterface a raw ptr Created 3 years, 8 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
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 49c45158192402d05bec125a2e4f7ef5c08e08c3..dd0db519703818d9dd0b2aee888fac4be16042a8 100644
--- a/chrome/browser/android/vr_shell/ui_scene_manager.cc
+++ b/chrome/browser/android/vr_shell/ui_scene_manager.cc
@@ -11,6 +11,8 @@
#include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning.h"
#include "chrome/browser/android/vr_shell/ui_elements/ui_element.h"
#include "chrome/browser/android/vr_shell/ui_scene.h"
+#include "chrome/browser/android/vr_shell/vr_browser_interface.h"
+#include "chrome/browser/android/vr_shell/vr_shell.h"
namespace vr_shell {
@@ -42,8 +44,8 @@ static constexpr float kTextureOffset = 0.01;
} // namespace
-UiSceneManager::UiSceneManager(UiScene* scene)
- : scene_(scene), weak_ptr_factory_(this) {
+UiSceneManager::UiSceneManager(VrBrowserInterface* browser, UiScene* scene)
+ : browser_(browser), scene_(scene), weak_ptr_factory_(this) {
std::unique_ptr<UiElement> element;
CreateBackground();
@@ -184,6 +186,14 @@ void UiSceneManager::SetWebVRSecureOrigin(bool secure) {
ConfigureSecurityWarnings();
}
+void UiSceneManager::OnAppButtonClicked() {
+ // Pressing the app button currenly pauses content rendering. Note: its still
+ // unclear what we want to do here and this will most likely change.
+ content_rendering_enabled_ = !content_rendering_enabled_;
+ scene_->SetWebVrRenderingEnabled(content_rendering_enabled_);
+ browser_->OnContentPaused(!content_rendering_enabled_);
+}
+
void UiSceneManager::ConfigureSecurityWarnings() {
bool enabled = web_vr_mode_ && !secure_origin_;
permanent_security_warning_->visible = enabled;
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698