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

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

Issue 2657703002: Swap to foreground tab when following links that open in a new tab/window in VR Shell. (Closed)
Patch Set: Address comments Created 3 years, 11 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/vr_compositor.h ('k') | chrome/browser/android/vr_shell/vr_input_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_compositor.cc
diff --git a/chrome/browser/android/vr_shell/vr_compositor.cc b/chrome/browser/android/vr_shell/vr_compositor.cc
index 882236f53d8c54bc360732be0577f7ce87a000b4..e386d90180d14204e4ac1e80b8b90ff615f0fb42 100644
--- a/chrome/browser/android/vr_shell/vr_compositor.cc
+++ b/chrome/browser/android/vr_shell/vr_compositor.cc
@@ -20,12 +20,8 @@ VrCompositor::VrCompositor(ui::WindowAndroid* window, bool transparent)
}
VrCompositor::~VrCompositor() {
- if (layer_) {
- layer_->SetBackgroundColor(background_color_);
- if (layer_parent_) {
- layer_parent_->AddChild(layer_);
- }
- }
+ if (layer_)
+ RestoreLayer();
}
void VrCompositor::UpdateLayerTreeHost() {}
@@ -33,7 +29,8 @@ void VrCompositor::UpdateLayerTreeHost() {}
void VrCompositor::OnSwapBuffersCompleted(int pending_swap_buffers) {}
void VrCompositor::SetLayer(content::WebContents* web_contents) {
- assert(layer_ == nullptr);
+ if (layer_)
+ RestoreLayer();
ui::ViewAndroid* view_android = web_contents->GetNativeView();
// When we pass the layer for the ContentViewCore to the compositor it may be
@@ -50,6 +47,13 @@ void VrCompositor::SetLayer(content::WebContents* web_contents) {
compositor_->SetRootLayer(layer_);
}
+void VrCompositor::RestoreLayer() {
+ layer_->SetBackgroundColor(background_color_);
+ if (layer_parent_) {
+ layer_parent_->AddChild(layer_);
+ }
+}
+
void VrCompositor::SurfaceDestroyed() {
compositor_->SetSurface(nullptr);
}
« no previous file with comments | « chrome/browser/android/vr_shell/vr_compositor.h ('k') | chrome/browser/android/vr_shell/vr_input_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698