| Index: chrome/browser/android/compositor/layer/toolbar_layer.cc
|
| diff --git a/chrome/browser/android/compositor/layer/toolbar_layer.cc b/chrome/browser/android/compositor/layer/toolbar_layer.cc
|
| index 37cedf4a753c2886a1bb36df2843e89c02c905f1..05e2227e349a0d8c896674afc83003f95ed56266 100644
|
| --- a/chrome/browser/android/compositor/layer/toolbar_layer.cc
|
| +++ b/chrome/browser/android/compositor/layer/toolbar_layer.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "chrome/browser/android/compositor/layer/toolbar_layer.h"
|
|
|
| +#include "cc/layers/nine_patch_layer.h"
|
| #include "cc/layers/solid_color_layer.h"
|
| #include "cc/layers/ui_resource_layer.h"
|
| #include "cc/resources/scoped_ui_resource.h"
|
| @@ -15,8 +16,9 @@ namespace chrome {
|
| namespace android {
|
|
|
| // static
|
| -scoped_refptr<ToolbarLayer> ToolbarLayer::Create() {
|
| - return make_scoped_refptr(new ToolbarLayer());
|
| +scoped_refptr<ToolbarLayer> ToolbarLayer::Create(
|
| + ui::ResourceManager* resource_manager) {
|
| + return make_scoped_refptr(new ToolbarLayer(resource_manager));
|
| }
|
|
|
| scoped_refptr<cc::Layer> ToolbarLayer::layer() {
|
| @@ -28,6 +30,8 @@ void ToolbarLayer::PushResource(
|
| int toolbar_background_color,
|
| bool anonymize,
|
| int toolbar_textbox_background_color,
|
| + int url_bar_background_resource_id,
|
| + float url_bar_alpha,
|
| bool show_debug,
|
| float brightness) {
|
| DCHECK(resource);
|
| @@ -45,6 +49,33 @@ void ToolbarLayer::PushResource(
|
| toolbar_background_layer_->SetPosition(resource->padding.origin());
|
| toolbar_background_layer_->SetBackgroundColor(toolbar_background_color);
|
|
|
| + bool url_bar_visible = (resource->aperture.width() != 0);
|
| + url_bar_background_layer_->SetHideLayerAndSubtree(!url_bar_visible);
|
| + if (url_bar_visible) {
|
| + ui::ResourceManager::Resource* url_bar_background_resource =
|
| + resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC,
|
| + url_bar_background_resource_id);
|
| + gfx::Size url_bar_size(
|
| + resource->aperture.width() + url_bar_background_resource->size.width()
|
| + - url_bar_background_resource->padding.width(),
|
| + resource->aperture.height() + url_bar_background_resource->size.height()
|
| + - url_bar_background_resource->padding.height());
|
| + gfx::Rect url_bar_border(
|
| + url_bar_background_resource->Border(url_bar_size));
|
| + gfx::PointF url_bar_position = gfx::PointF(
|
| + resource->aperture.x() - url_bar_background_resource->padding.x(),
|
| + resource->aperture.y() - url_bar_background_resource->padding.y());
|
| +
|
| + url_bar_background_layer_->SetUIResourceId(
|
| + url_bar_background_resource->ui_resource->id());
|
| + url_bar_background_layer_->SetBorder(url_bar_border);
|
| + url_bar_background_layer_->SetAperture(
|
| + url_bar_background_resource->aperture);
|
| + url_bar_background_layer_->SetBounds(url_bar_size);
|
| + url_bar_background_layer_->SetPosition(url_bar_position);
|
| + url_bar_background_layer_->SetOpacity(url_bar_alpha);
|
| + }
|
| +
|
| bitmap_layer_->SetUIResourceId(resource->ui_resource->id());
|
| bitmap_layer_->SetBounds(resource->size);
|
|
|
| @@ -105,10 +136,13 @@ void ToolbarLayer::UpdateProgressBar(int progress_bar_x,
|
| }
|
| }
|
|
|
| -ToolbarLayer::ToolbarLayer()
|
| - : layer_(cc::Layer::Create(content::Compositor::LayerSettings())),
|
| +ToolbarLayer::ToolbarLayer(ui::ResourceManager* resource_manager)
|
| + : resource_manager_(resource_manager),
|
| + layer_(cc::Layer::Create(content::Compositor::LayerSettings())),
|
| toolbar_background_layer_(
|
| cc::SolidColorLayer::Create(content::Compositor::LayerSettings())),
|
| + url_bar_background_layer_(
|
| + cc::NinePatchLayer::Create(content::Compositor::LayerSettings())),
|
| bitmap_layer_(
|
| cc::UIResourceLayer::Create(content::Compositor::LayerSettings())),
|
| progress_bar_layer_(
|
| @@ -123,6 +157,10 @@ ToolbarLayer::ToolbarLayer()
|
| toolbar_background_layer_->SetIsDrawable(true);
|
| layer_->AddChild(toolbar_background_layer_);
|
|
|
| + url_bar_background_layer_->SetIsDrawable(true);
|
| + url_bar_background_layer_->SetFillCenter(true);
|
| + layer_->AddChild(url_bar_background_layer_);
|
| +
|
| bitmap_layer_->SetIsDrawable(true);
|
| layer_->AddChild(bitmap_layer_);
|
|
|
|
|