Index: chrome/browser/android/compositor/compositor_view.cc |
diff --git a/chrome/browser/android/compositor/compositor_view.cc b/chrome/browser/android/compositor/compositor_view.cc |
index 98cba5074fc8eff25e6d007060c99b1b0086d594..e9c2fdc7c87e2008d5cf09d4512a03c7010dbf8d 100644 |
--- a/chrome/browser/android/compositor/compositor_view.cc |
+++ b/chrome/browser/android/compositor/compositor_view.cc |
@@ -84,7 +84,6 @@ CompositorView::CompositorView(JNIEnv* env, |
tab_content_manager_(tab_content_manager), |
root_layer_( |
cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), |
- toolbar_layer_(ToolbarLayer::Create()), |
scene_layer_(nullptr), |
current_surface_format_(0), |
content_width_(0), |
@@ -97,6 +96,8 @@ CompositorView::CompositorView(JNIEnv* env, |
obj_.Reset(env, obj); |
compositor_.reset(content::Compositor::Create(this, window_android)); |
+ toolbar_layer_ = ToolbarLayer::Create(&(compositor_->GetResourceManager())); |
+ |
root_layer_->SetIsDrawable(true); |
root_layer_->SetBackgroundColor(SK_ColorWHITE); |
@@ -249,26 +250,20 @@ void CompositorView::UpdateToolbarLayer(JNIEnv* env, |
jobject object, |
jint toolbar_resource_id, |
jint toolbar_background_color, |
+ jint url_bar_resource_id, |
+ jfloat url_bar_alpha, |
jfloat top_offset, |
jfloat brightness, |
bool visible, |
bool show_shadow) { |
- // Ensure the toolbar resource is available before making the layer visible. |
- ui::ResourceManager::Resource* resource = |
- compositor_->GetResourceManager().GetResource( |
- ui::ANDROID_RESOURCE_TYPE_DYNAMIC, toolbar_resource_id); |
- if (!resource) |
- visible = false; |
- |
toolbar_layer_->layer()->SetHideLayerAndSubtree(!visible); |
if (visible) { |
toolbar_layer_->layer()->SetPosition(gfx::PointF(0, top_offset)); |
- toolbar_layer_->PushResource(resource, toolbar_background_color, false, |
- SK_ColorWHITE, false, brightness); |
- |
// If we're at rest, hide the shadow. The Android view should be drawing. |
- toolbar_layer_->layer()->SetMasksToBounds(top_offset >= 0.f |
- && !show_shadow); |
+ bool clip_shadow = top_offset >= 0.f && !show_shadow; |
+ toolbar_layer_->PushResource(toolbar_resource_id, toolbar_background_color, |
+ false, SK_ColorWHITE, url_bar_resource_id, |
+ url_bar_alpha, false, brightness, clip_shadow); |
} |
} |