OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/overlay_panel_layer.h" | 5 #include "chrome/browser/android/compositor/layer/overlay_panel_layer.h" |
6 | 6 |
7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
8 #include "cc/layers/layer_settings.h" | |
9 #include "cc/layers/nine_patch_layer.h" | 8 #include "cc/layers/nine_patch_layer.h" |
10 #include "cc/layers/solid_color_layer.h" | 9 #include "cc/layers/solid_color_layer.h" |
11 #include "cc/layers/ui_resource_layer.h" | 10 #include "cc/layers/ui_resource_layer.h" |
12 #include "cc/resources/scoped_ui_resource.h" | 11 #include "cc/resources/scoped_ui_resource.h" |
13 #include "content/public/browser/android/compositor.h" | 12 #include "content/public/browser/android/compositor.h" |
14 #include "content/public/browser/android/content_view_core.h" | 13 #include "content/public/browser/android/content_view_core.h" |
15 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
16 #include "ui/android/resources/crushed_sprite_resource.h" | 15 #include "ui/android/resources/crushed_sprite_resource.h" |
17 #include "ui/android/resources/resource_manager.h" | 16 #include "ui/android/resources/resource_manager.h" |
18 #include "ui/base/l10n/l10n_util_android.h" | 17 #include "ui/base/l10n/l10n_util_android.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 float border_y = bar_bottom - bar_border_height; | 250 float border_y = bar_bottom - bar_border_height; |
252 bar_border_->SetBounds(bar_border_size); | 251 bar_border_->SetBounds(bar_border_size); |
253 bar_border_->SetPosition( | 252 bar_border_->SetPosition( |
254 gfx::PointF(0.f, border_y)); | 253 gfx::PointF(0.f, border_y)); |
255 layer_->AddChild(bar_border_); | 254 layer_->AddChild(bar_border_); |
256 } else if (bar_border_.get() && bar_border_->parent()) { | 255 } else if (bar_border_.get() && bar_border_->parent()) { |
257 bar_border_->RemoveFromParent(); | 256 bar_border_->RemoveFromParent(); |
258 } | 257 } |
259 } | 258 } |
260 | 259 |
261 OverlayPanelLayer::OverlayPanelLayer( | 260 OverlayPanelLayer::OverlayPanelLayer(ui::ResourceManager* resource_manager) |
262 ui::ResourceManager* resource_manager) | |
263 : resource_manager_(resource_manager), | 261 : resource_manager_(resource_manager), |
264 layer_(cc::Layer::Create(cc::LayerSettings())), | 262 layer_(cc::Layer::Create()), |
265 panel_shadow_( | 263 panel_shadow_(cc::NinePatchLayer::Create()), |
266 cc::NinePatchLayer::Create(cc::LayerSettings())), | 264 bar_background_(cc::SolidColorLayer::Create()), |
267 bar_background_( | 265 bar_text_(cc::UIResourceLayer::Create()), |
268 cc::SolidColorLayer::Create(cc::LayerSettings())), | 266 bar_shadow_(cc::UIResourceLayer::Create()), |
269 bar_text_( | 267 panel_icon_(cc::UIResourceLayer::Create()), |
270 cc::UIResourceLayer::Create(cc::LayerSettings())), | 268 close_icon_(cc::UIResourceLayer::Create()), |
271 bar_shadow_( | 269 content_view_container_(cc::SolidColorLayer::Create()), |
272 cc::UIResourceLayer::Create(cc::LayerSettings())), | 270 text_container_(cc::Layer::Create()), |
273 panel_icon_( | 271 bar_border_(cc::SolidColorLayer::Create()) { |
274 cc::UIResourceLayer::Create(cc::LayerSettings())), | |
275 close_icon_( | |
276 cc::UIResourceLayer::Create(cc::LayerSettings())), | |
277 content_view_container_( | |
278 cc::SolidColorLayer::Create(cc::LayerSettings())), | |
279 text_container_(cc::Layer::Create(cc::LayerSettings())), | |
280 bar_border_( | |
281 cc::SolidColorLayer::Create(cc::LayerSettings())) { | |
282 layer_->SetMasksToBounds(false); | 272 layer_->SetMasksToBounds(false); |
283 layer_->SetIsDrawable(true); | 273 layer_->SetIsDrawable(true); |
284 | 274 |
285 // Panel Shadow | 275 // Panel Shadow |
286 panel_shadow_->SetIsDrawable(true); | 276 panel_shadow_->SetIsDrawable(true); |
287 panel_shadow_->SetFillCenter(false); | 277 panel_shadow_->SetFillCenter(false); |
288 layer_->AddChild(panel_shadow_); | 278 layer_->AddChild(panel_shadow_); |
289 | 279 |
290 // Bar Background | 280 // Bar Background |
291 bar_background_->SetIsDrawable(true); | 281 bar_background_->SetIsDrawable(true); |
(...skipping 30 matching lines...) Expand all Loading... |
322 | 312 |
323 OverlayPanelLayer::~OverlayPanelLayer() { | 313 OverlayPanelLayer::~OverlayPanelLayer() { |
324 } | 314 } |
325 | 315 |
326 scoped_refptr<cc::Layer> OverlayPanelLayer::layer() { | 316 scoped_refptr<cc::Layer> OverlayPanelLayer::layer() { |
327 return layer_; | 317 return layer_; |
328 } | 318 } |
329 | 319 |
330 } // namespace android | 320 } // namespace android |
331 } // namespace chrome | 321 } // namespace chrome |
OLD | NEW |