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

Unified Diff: chrome/browser/android/tab_android.cc

Issue 2279403003: blimp: Hook up the layer holding the tab content into Chrome. (Closed)
Patch Set: Addressed comments Created 4 years, 4 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 | « blimp/client/public/contents/blimp_contents.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/tab_android.cc
diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc
index 63cbe9f53e5679bef3c7a9846e7ef3c0b89e8e5a..463f277a10a7e9895fec518fca7e4d600a73be7c 100644
--- a/chrome/browser/android/tab_android.cc
+++ b/chrome/browser/android/tab_android.cc
@@ -416,7 +416,8 @@ void TabAndroid::InitWebContents(
if (instant_service)
instant_service->AddObserver(this);
- content_layer_->InsertChild(web_contents_->GetNativeView()->GetLayer(), 0);
+ if (!blimp_contents_)
+ content_layer_->InsertChild(web_contents_->GetNativeView()->GetLayer(), 0);
}
base::android::ScopedJavaLocalRef<jobject> TabAndroid::InitBlimpContents(
@@ -430,6 +431,18 @@ base::android::ScopedJavaLocalRef<jobject> TabAndroid::InitBlimpContents(
DCHECK(context);
blimp_contents_ = context->CreateBlimpContents();
DCHECK(blimp_contents_);
+
+ // Let's detach the layer from WebContents first, just to be sure.
+ if (web_contents_ && web_contents_->GetNativeView() &&
+ web_contents_->GetNativeView()->GetLayer()) {
+ cc::Layer* web_contents_layer = web_contents_->GetNativeView()->GetLayer();
+ if (web_contents_layer->parent() == content_layer_.get())
+ web_contents_layer->RemoveFromParent();
+ }
+
+ // Attach the layer holding the tab contents to the |content_layer_|.
+ content_layer_->InsertChild(blimp_contents_->GetNativeView()->GetLayer(), 0);
+
return blimp_contents_->GetJavaObject();
}
« no previous file with comments | « blimp/client/public/contents/blimp_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698