| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/compositor/layer/tab_layer.h" | 5 #include "chrome/browser/android/compositor/layer/tab_layer.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 padding_rect.y() + content_position.y()); | 90 padding_rect.y() + content_position.y()); |
| 91 transform.Translate(descaled_local_content_area.x(), | 91 transform.Translate(descaled_local_content_area.x(), |
| 92 descaled_local_content_area.y()); | 92 descaled_local_content_area.y()); |
| 93 padding_layer->SetTransformOrigin(gfx::Point3F(0.f, 0.f, 0.f)); | 93 padding_layer->SetTransformOrigin(gfx::Point3F(0.f, 0.f, 0.f)); |
| 94 padding_layer->SetTransform(transform); | 94 padding_layer->SetTransform(transform); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void TabLayer::SetProperties(int id, | 97 void TabLayer::SetProperties(int id, |
| 98 bool can_use_live_layer, | 98 bool can_use_live_layer, |
| 99 int toolbar_resource_id, | 99 int toolbar_resource_id, |
| 100 int toolbar_shadow_resource_id, |
| 100 int close_button_resource_id, | 101 int close_button_resource_id, |
| 101 int shadow_resource_id, | 102 int shadow_resource_id, |
| 102 int contour_resource_id, | 103 int contour_resource_id, |
| 103 int back_logo_resource_id, | 104 int back_logo_resource_id, |
| 104 int border_resource_id, | 105 int border_resource_id, |
| 105 int border_inner_shadow_resource_id, | 106 int border_inner_shadow_resource_id, |
| 106 int default_background_color, | 107 int default_background_color, |
| 107 int back_logo_color, | 108 int back_logo_color, |
| 108 bool is_portrait, | 109 bool is_portrait, |
| 109 float x, | 110 float x, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 137 int default_theme_color, | 138 int default_theme_color, |
| 138 int toolbar_background_color, | 139 int toolbar_background_color, |
| 139 bool anonymize_toolbar, | 140 bool anonymize_toolbar, |
| 140 int toolbar_textbox_resource_id, | 141 int toolbar_textbox_resource_id, |
| 141 int toolbar_textbox_background_color, | 142 int toolbar_textbox_background_color, |
| 142 float toolbar_textbox_alpha, | 143 float toolbar_textbox_alpha, |
| 143 float toolbar_alpha, | 144 float toolbar_alpha, |
| 144 float toolbar_y_offset, | 145 float toolbar_y_offset, |
| 145 float side_border_scale, | 146 float side_border_scale, |
| 146 bool attach_content, | 147 bool attach_content, |
| 147 bool inset_border) { | 148 bool inset_border, |
| 149 bool needs_toolbar_shadow) { |
| 148 if (alpha <= 0) { | 150 if (alpha <= 0) { |
| 149 layer_->SetHideLayerAndSubtree(true); | 151 layer_->SetHideLayerAndSubtree(true); |
| 150 return; | 152 return; |
| 151 } | 153 } |
| 152 | 154 |
| 153 layer_->SetHideLayerAndSubtree(false); | 155 layer_->SetHideLayerAndSubtree(false); |
| 154 | 156 |
| 155 // Grab required resources | 157 // Grab required resources |
| 156 ui::ResourceManager::Resource* border_resource = | 158 ui::ResourceManager::Resource* border_resource = |
| 157 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC, | 159 resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 contour_resource->size.height() - contour_padding.height()); | 226 contour_resource->size.height() - contour_padding.height()); |
| 225 | 227 |
| 226 const float close_btn_effective_width = close_btn_width * close_alpha; | 228 const float close_btn_effective_width = close_btn_width * close_alpha; |
| 227 | 229 |
| 228 //-------------------------------------------------------------------------- | 230 //-------------------------------------------------------------------------- |
| 229 // Update Resource Ids For Layers That Impact Layout | 231 // Update Resource Ids For Layers That Impact Layout |
| 230 //-------------------------------------------------------------------------- | 232 //-------------------------------------------------------------------------- |
| 231 | 233 |
| 232 // TODO(kkimlabs): Tab switcher doesn't show the progress bar. | 234 // TODO(kkimlabs): Tab switcher doesn't show the progress bar. |
| 233 toolbar_layer_->PushResource(toolbar_resource_id, | 235 toolbar_layer_->PushResource(toolbar_resource_id, |
| 236 toolbar_shadow_resource_id, |
| 234 toolbar_background_color, | 237 toolbar_background_color, |
| 235 anonymize_toolbar, | 238 anonymize_toolbar, |
| 236 toolbar_textbox_background_color, | 239 toolbar_textbox_background_color, |
| 237 toolbar_textbox_resource_id, | 240 toolbar_textbox_resource_id, |
| 238 toolbar_textbox_alpha, | 241 toolbar_textbox_alpha, |
| 239 false, | 242 false, |
| 240 false); | 243 needs_toolbar_shadow); |
| 241 toolbar_layer_->UpdateProgressBar(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | 244 toolbar_layer_->UpdateProgressBar(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
| 242 | 245 |
| 243 float toolbar_impact_height = 0; | 246 float toolbar_impact_height = 0; |
| 244 if (show_toolbar && !back_visible) | 247 if (show_toolbar && !back_visible) |
| 245 toolbar_impact_height = toolbar_layer_->layer()->bounds().height(); | 248 toolbar_impact_height = toolbar_layer_->layer()->bounds().height(); |
| 246 | 249 |
| 247 //---------------------------------------------------------------------------- | 250 //---------------------------------------------------------------------------- |
| 248 // Compute Alpha and Visibility | 251 // Compute Alpha and Visibility |
| 249 //---------------------------------------------------------------------------- | 252 //---------------------------------------------------------------------------- |
| 250 border_alpha *= alpha; | 253 border_alpha *= alpha; |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 title_->AddChild(layer); | 708 title_->AddChild(layer); |
| 706 } | 709 } |
| 707 } | 710 } |
| 708 | 711 |
| 709 if (title) | 712 if (title) |
| 710 title->SetUIResourceIds(); | 713 title->SetUIResourceIds(); |
| 711 } | 714 } |
| 712 | 715 |
| 713 } // namespace android | 716 } // namespace android |
| 714 } // namespace chrome | 717 } // namespace chrome |
| OLD | NEW |