Chromium Code Reviews| Index: chrome/browser/android/compositor/layer/contextual_search_layer.cc |
| diff --git a/chrome/browser/android/compositor/layer/contextual_search_layer.cc b/chrome/browser/android/compositor/layer/contextual_search_layer.cc |
| index ad18013c281dc04a9474f72f07eb9143e6858c11..3a1c815c6f4c26a9801b14fdaebb5cce61e2cbed 100644 |
| --- a/chrome/browser/android/compositor/layer/contextual_search_layer.cc |
| +++ b/chrome/browser/android/compositor/layer/contextual_search_layer.cc |
| @@ -141,6 +141,7 @@ void ContextualSearchLayer::SetProperties( |
| // --------------------------------------------------------------------------- |
| // Search Promo |
| // --------------------------------------------------------------------------- |
| + bool is_search_promo_resource_ready = false; |
| if (search_promo_visible) { |
| // Grab the Search Opt Out Promo resource. |
| ui::ResourceManager::Resource* search_promo_resource = |
| @@ -148,6 +149,8 @@ void ContextualSearchLayer::SetProperties( |
| search_promo_resource_id); |
| if (search_promo_resource) { |
| + is_search_promo_resource_ready = true; |
| + |
| // Search Promo Container |
| if (search_promo_container_->parent() != layer_) |
| layer_->AddChild(search_promo_container_); |
| @@ -195,7 +198,12 @@ void ContextualSearchLayer::SetProperties( |
| // --------------------------------------------------------------------------- |
| // Search Bar Shadow |
| // --------------------------------------------------------------------------- |
| - if (search_bar_shadow_visible) { |
| + // NOTE(pedrosimonetti): Since the Promo resource is a dynamic one (it will |
| + // take a snapshot of the Promo View) it will always be available before |
|
Donn Denman
2015/04/14 23:50:04
This is confusing to me. If the promo will always
pedro (no code reviews)
2015/04/16 19:05:29
It was supposed to read: "it will NOT always be av
|
| + // the Shadow resource. Therefore, we need to confirm that the Promo resource |
| + // is ready before adding the Shadow layer, otherwise the Promo layer will |
| + // be placed over the Shadow layer, making it not visible. |
|
David Trainor- moved to gerrit
2015/04/15 07:36:15
You can insert children at specific points in the
pedro (no code reviews)
2015/04/16 19:05:29
Good idea. I'm using InsertChild() now.
On the ot
David Trainor- moved to gerrit
2015/04/16 20:51:45
Yeah, I wonder if we could make that public. I do
|
| + if (is_search_promo_resource_ready && search_bar_shadow_visible) { |
| ui::ResourceManager::Resource* search_bar_shadow_resource = |
| resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC, |
| search_bar_shadow_resource_id); |
| @@ -203,16 +211,16 @@ void ContextualSearchLayer::SetProperties( |
| if (search_bar_shadow_resource) { |
| if (search_bar_shadow_->parent() != layer_) |
| layer_->AddChild(search_bar_shadow_); |
| - } |
| - int shadow_height = search_bar_shadow_resource->size.height(); |
| - gfx::Size shadow_size(search_panel_width, shadow_height); |
| + int shadow_height = search_bar_shadow_resource->size.height(); |
| + gfx::Size shadow_size(search_panel_width, shadow_height); |
| - search_bar_shadow_->SetUIResourceId( |
| - search_bar_shadow_resource->ui_resource->id()); |
| - search_bar_shadow_->SetBounds(shadow_size); |
| - search_bar_shadow_->SetPosition(gfx::PointF(0.f, search_bar_height)); |
| - search_bar_shadow_->SetOpacity(search_bar_shadow_opacity); |
| + search_bar_shadow_->SetUIResourceId( |
| + search_bar_shadow_resource->ui_resource->id()); |
| + search_bar_shadow_->SetBounds(shadow_size); |
| + search_bar_shadow_->SetPosition(gfx::PointF(0.f, search_bar_height)); |
| + search_bar_shadow_->SetOpacity(search_bar_shadow_opacity); |
| + } |
| } else { |
| if (search_bar_shadow_.get() && search_bar_shadow_->parent()) |
| search_bar_shadow_->RemoveFromParent(); |