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

Unified Diff: chrome/browser/android/compositor/layer/toolbar_layer.cc

Issue 986683002: [Android] Allow specifying the progress component of the toolbar as a separate texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Javadoc fix Created 5 years, 9 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
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 2fd0173ce4074153a44add0374368304aab5a0a6..658fd9c9a74f0b7a790ef2a3bafb27be1f2a1ef9 100644
--- a/chrome/browser/android/compositor/layer/toolbar_layer.cc
+++ b/chrome/browser/android/compositor/layer/toolbar_layer.cc
@@ -25,10 +25,12 @@ scoped_refptr<cc::Layer> ToolbarLayer::layer() {
return layer_;
}
-void ToolbarLayer::PushResource(ui::ResourceManager::Resource* resource,
- bool anonymize,
- bool anonymize_component_is_incognito,
- bool show_debug) {
+void ToolbarLayer::PushResource(
+ ui::ResourceManager::Resource* resource,
+ ui::ResourceManager::Resource* progress_resource,
+ bool anonymize,
+ bool anonymize_component_is_incognito,
+ bool show_debug) {
DCHECK(resource);
// This layer effectively draws over the space it takes for shadows. Set the
@@ -47,6 +49,13 @@ void ToolbarLayer::PushResource(ui::ResourceManager::Resource* resource,
: kNormalAnonymizeContentColor);
}
+ progress_layer_->SetHideLayerAndSubtree(!progress_resource);
+ if (progress_resource) {
+ progress_layer_->SetUIResourceId(progress_resource->ui_resource->id());
+ progress_layer_->SetBounds(progress_resource->size);
+ progress_layer_->SetPosition(progress_resource->padding.origin());
+ }
+
debug_layer_->SetBounds(resource->size);
if (show_debug && !debug_layer_->parent())
layer_->AddChild(debug_layer_);
@@ -54,14 +63,30 @@ void ToolbarLayer::PushResource(ui::ResourceManager::Resource* resource,
debug_layer_->RemoveFromParent();
}
+void ToolbarLayer::PushResource(ui::ResourceManager::Resource* resource,
+ bool anonymize,
+ bool anonymize_component_is_incognito,
+ bool show_debug) {
+ PushResource(resource,
+ nullptr,
+ anonymize,
+ anonymize_component_is_incognito,
+ show_debug);
+}
+
ToolbarLayer::ToolbarLayer()
: layer_(cc::Layer::Create()),
bitmap_layer_(cc::UIResourceLayer::Create()),
+ progress_layer_(cc::UIResourceLayer::Create()),
anonymize_layer_(cc::SolidColorLayer::Create()),
debug_layer_(cc::SolidColorLayer::Create()) {
bitmap_layer_->SetIsDrawable(true);
layer_->AddChild(bitmap_layer_);
+ progress_layer_->SetIsDrawable(true);
+ progress_layer_->SetHideLayerAndSubtree(true);
+ layer_->AddChild(progress_layer_);
+
anonymize_layer_->SetHideLayerAndSubtree(true);
anonymize_layer_->SetIsDrawable(true);
anonymize_layer_->SetBackgroundColor(kNormalAnonymizeContentColor);

Powered by Google App Engine
This is Rietveld 408576698