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/contextual_search_layer.h" | 5 #include "chrome/browser/android/compositor/layer/contextual_search_layer.h" |
6 | 6 |
7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
8 #include "cc/layers/nine_patch_layer.h" | 8 #include "cc/layers/nine_patch_layer.h" |
9 #include "cc/layers/solid_color_layer.h" | 9 #include "cc/layers/solid_color_layer.h" |
10 #include "cc/layers/ui_resource_layer.h" | 10 #include "cc/layers/ui_resource_layer.h" |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 // Search Promo Container | 448 // Search Promo Container |
449 if (search_promo_container_.get() && search_promo_container_->parent()) | 449 if (search_promo_container_.get() && search_promo_container_->parent()) |
450 search_promo_container_->RemoveFromParent(); | 450 search_promo_container_->RemoveFromParent(); |
451 } | 451 } |
452 | 452 |
453 // --------------------------------------------------------------------------- | 453 // --------------------------------------------------------------------------- |
454 // Search Content View | 454 // Search Content View |
455 // --------------------------------------------------------------------------- | 455 // --------------------------------------------------------------------------- |
456 content_view_container_->SetPosition( | 456 content_view_container_->SetPosition( |
457 gfx::PointF(0.f, search_bar_bottom + search_promo_height)); | 457 gfx::PointF(0.f, search_bar_bottom + search_promo_height)); |
| 458 content_view_container_->SetBounds( |
| 459 gfx::Size(search_panel_width, search_panel_height)); |
458 if (content_view_core && content_view_core->GetLayer().get()) { | 460 if (content_view_core && content_view_core->GetLayer().get()) { |
459 scoped_refptr<cc::Layer> content_view_layer = content_view_core->GetLayer(); | 461 scoped_refptr<cc::Layer> content_view_layer = content_view_core->GetLayer(); |
460 if (content_view_layer->parent() != content_view_container_) | 462 if (content_view_layer->parent() != content_view_container_) |
461 content_view_container_->AddChild(content_view_layer); | 463 content_view_container_->AddChild(content_view_layer); |
462 } else { | 464 } else { |
463 content_view_container_->RemoveAllChildren(); | 465 content_view_container_->RemoveAllChildren(); |
464 } | 466 } |
465 | 467 |
466 // --------------------------------------------------------------------------- | 468 // --------------------------------------------------------------------------- |
467 // Search Bar Shadow | 469 // Search Bar Shadow |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 search_bar_shadow_( | 585 search_bar_shadow_( |
584 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), | 586 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), |
585 panel_icon_( | 587 panel_icon_( |
586 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), | 588 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), |
587 search_provider_icon_sprite_(CrushedSpriteLayer::Create()), | 589 search_provider_icon_sprite_(CrushedSpriteLayer::Create()), |
588 arrow_icon_( | 590 arrow_icon_( |
589 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), | 591 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), |
590 close_icon_( | 592 close_icon_( |
591 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), | 593 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), |
592 content_view_container_( | 594 content_view_container_( |
593 cc::Layer::Create(content::Compositor::LayerSettings())), | 595 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), |
594 search_bar_border_( | 596 search_bar_border_( |
595 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), | 597 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), |
596 progress_bar_( | 598 progress_bar_( |
597 cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), | 599 cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), |
598 progress_bar_background_( | 600 progress_bar_background_( |
599 cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), | 601 cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), |
600 search_promo_( | 602 search_promo_( |
601 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), | 603 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), |
602 search_promo_container_( | 604 search_promo_container_( |
603 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), | 605 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 | 659 |
658 // Progress Bar Background | 660 // Progress Bar Background |
659 progress_bar_background_->SetIsDrawable(true); | 661 progress_bar_background_->SetIsDrawable(true); |
660 progress_bar_background_->SetFillCenter(true); | 662 progress_bar_background_->SetFillCenter(true); |
661 | 663 |
662 // Progress Bar | 664 // Progress Bar |
663 progress_bar_->SetIsDrawable(true); | 665 progress_bar_->SetIsDrawable(true); |
664 progress_bar_->SetFillCenter(true); | 666 progress_bar_->SetFillCenter(true); |
665 | 667 |
666 // Search Content View Container | 668 // Search Content View Container |
| 669 content_view_container_->SetIsDrawable(true); |
| 670 content_view_container_->SetBackgroundColor(kSearchBarBackgroundColor); |
667 layer_->AddChild(content_view_container_); | 671 layer_->AddChild(content_view_container_); |
668 | 672 |
669 // Search Bar Shadow | 673 // Search Bar Shadow |
670 search_bar_shadow_->SetIsDrawable(true); | 674 search_bar_shadow_->SetIsDrawable(true); |
671 } | 675 } |
672 | 676 |
673 ContextualSearchLayer::~ContextualSearchLayer() { | 677 ContextualSearchLayer::~ContextualSearchLayer() { |
674 } | 678 } |
675 | 679 |
676 scoped_refptr<cc::Layer> ContextualSearchLayer::layer() { | 680 scoped_refptr<cc::Layer> ContextualSearchLayer::layer() { |
677 return layer_; | 681 return layer_; |
678 } | 682 } |
679 | 683 |
680 } // namespace android | 684 } // namespace android |
681 } // namespace chrome | 685 } // namespace chrome |
OLD | NEW |