| 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/toolbar_layer.h" | 5 #include "chrome/browser/android/compositor/layer/toolbar_layer.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer_settings.h" |
| 7 #include "cc/layers/nine_patch_layer.h" | 8 #include "cc/layers/nine_patch_layer.h" |
| 8 #include "cc/layers/solid_color_layer.h" | 9 #include "cc/layers/solid_color_layer.h" |
| 9 #include "cc/layers/ui_resource_layer.h" | 10 #include "cc/layers/ui_resource_layer.h" |
| 10 #include "cc/resources/scoped_ui_resource.h" | 11 #include "cc/resources/scoped_ui_resource.h" |
| 11 #include "content/public/browser/android/compositor.h" | 12 #include "content/public/browser/android/compositor.h" |
| 12 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
| 13 #include "ui/android/resources/resource_manager.h" | 14 #include "ui/android/resources/resource_manager.h" |
| 14 | 15 |
| 15 namespace chrome { | 16 namespace chrome { |
| 16 namespace android { | 17 namespace android { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 progress_bar_layer_->SetPosition( | 143 progress_bar_layer_->SetPosition( |
| 143 gfx::PointF(progress_bar_x, progress_bar_y)); | 144 gfx::PointF(progress_bar_x, progress_bar_y)); |
| 144 progress_bar_layer_->SetBounds( | 145 progress_bar_layer_->SetBounds( |
| 145 gfx::Size(progress_bar_width, progress_bar_height)); | 146 gfx::Size(progress_bar_width, progress_bar_height)); |
| 146 progress_bar_layer_->SetBackgroundColor(progress_bar_color); | 147 progress_bar_layer_->SetBackgroundColor(progress_bar_color); |
| 147 } | 148 } |
| 148 } | 149 } |
| 149 | 150 |
| 150 ToolbarLayer::ToolbarLayer(ui::ResourceManager* resource_manager) | 151 ToolbarLayer::ToolbarLayer(ui::ResourceManager* resource_manager) |
| 151 : resource_manager_(resource_manager), | 152 : resource_manager_(resource_manager), |
| 152 layer_(cc::Layer::Create(content::Compositor::LayerSettings())), | 153 layer_(cc::Layer::Create(cc::LayerSettings())), |
| 153 toolbar_background_layer_( | 154 toolbar_background_layer_( |
| 154 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), | 155 cc::SolidColorLayer::Create(cc::LayerSettings())), |
| 155 url_bar_background_layer_( | 156 url_bar_background_layer_( |
| 156 cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), | 157 cc::NinePatchLayer::Create(cc::LayerSettings())), |
| 157 bitmap_layer_( | 158 bitmap_layer_( |
| 158 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), | 159 cc::UIResourceLayer::Create(cc::LayerSettings())), |
| 159 progress_bar_layer_( | 160 progress_bar_layer_( |
| 160 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), | 161 cc::SolidColorLayer::Create(cc::LayerSettings())), |
| 161 progress_bar_background_layer_( | 162 progress_bar_background_layer_( |
| 162 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), | 163 cc::SolidColorLayer::Create(cc::LayerSettings())), |
| 163 anonymize_layer_( | 164 anonymize_layer_( |
| 164 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), | 165 cc::SolidColorLayer::Create(cc::LayerSettings())), |
| 165 debug_layer_( | 166 debug_layer_( |
| 166 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), | 167 cc::SolidColorLayer::Create(cc::LayerSettings())), |
| 167 brightness_(1.f) { | 168 brightness_(1.f) { |
| 168 toolbar_background_layer_->SetIsDrawable(true); | 169 toolbar_background_layer_->SetIsDrawable(true); |
| 169 layer_->AddChild(toolbar_background_layer_); | 170 layer_->AddChild(toolbar_background_layer_); |
| 170 | 171 |
| 171 url_bar_background_layer_->SetIsDrawable(true); | 172 url_bar_background_layer_->SetIsDrawable(true); |
| 172 url_bar_background_layer_->SetFillCenter(true); | 173 url_bar_background_layer_->SetFillCenter(true); |
| 173 layer_->AddChild(url_bar_background_layer_); | 174 layer_->AddChild(url_bar_background_layer_); |
| 174 | 175 |
| 175 bitmap_layer_->SetIsDrawable(true); | 176 bitmap_layer_->SetIsDrawable(true); |
| 176 layer_->AddChild(bitmap_layer_); | 177 layer_->AddChild(bitmap_layer_); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 190 debug_layer_->SetIsDrawable(true); | 191 debug_layer_->SetIsDrawable(true); |
| 191 debug_layer_->SetBackgroundColor(SK_ColorGREEN); | 192 debug_layer_->SetBackgroundColor(SK_ColorGREEN); |
| 192 debug_layer_->SetOpacity(0.5f); | 193 debug_layer_->SetOpacity(0.5f); |
| 193 } | 194 } |
| 194 | 195 |
| 195 ToolbarLayer::~ToolbarLayer() { | 196 ToolbarLayer::~ToolbarLayer() { |
| 196 } | 197 } |
| 197 | 198 |
| 198 } // namespace android | 199 } // namespace android |
| 199 } // namespace chrome | 200 } // namespace chrome |
| OLD | NEW |