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

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: refactor 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 29434a3931c9b8d6cd332c116915be46fc4428a8..1fb09bfc1d2ad922588f7337c37fad60a367fc9d 100644
--- a/chrome/browser/android/vr_shell/ui_scene_manager.cc
+++ b/chrome/browser/android/vr_shell/ui_scene_manager.cc
@@ -11,6 +11,9 @@
#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_gl_thread.h"
cjgrant 2017/05/02 18:07:05 Is the thread header needed?
ymalik 2017/05/02 20:28:39 Totally not. thanks!
+#include "chrome/browser/android/vr_shell/vr_shell.h"
namespace vr_shell {
@@ -32,8 +35,12 @@ static constexpr float kContentVerticalOffset = -0.26;
} // namespace
-UiSceneManager::UiSceneManager(UiScene* scene)
- : scene_(scene), weak_ptr_factory_(this) {
+UiSceneManager::UiSceneManager(
+ const base::WeakPtr<VrBrowserInterface>& weak_browser_interface,
+ UiScene* scene)
+ : weak_browser_interface_(weak_browser_interface),
cjgrant 2017/05/02 18:07:06 s/weak_browser_interface_/browser_/ or /shell_/? I
ymalik 2017/05/02 20:28:39 Done here and VrShellGl
+ scene_(scene),
+ weak_ptr_factory_(this) {
std::unique_ptr<UiElement> element;
// For now, use an ID range that does not conflict with the HTML UI.
@@ -100,6 +107,14 @@ void UiSceneManager::SetWebVRSecureOrigin(bool secure) {
ConfigureSecurityWarnings();
}
+void UiSceneManager::AppButtonPressed() {
+ // 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_);
+ weak_browser_interface_->OnContentPaused(content_rendering_enabled_);
+}
+
void UiSceneManager::ConfigureSecurityWarnings() {
bool enabled = web_vr_mode_ && !secure_origin_;
permanent_security_warning_->visible = enabled;

Powered by Google App Engine
This is Rietveld 408576698