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