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/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 "chrome/browser/android/compositor/layer/crushed_sprite_layer.h" | 12 #include "chrome/browser/android/compositor/layer/crushed_sprite_layer.h" |
14 #include "content/public/browser/android/compositor.h" | 13 #include "content/public/browser/android/compositor.h" |
15 #include "content/public/browser/android/content_view_core.h" | 14 #include "content/public/browser/android/content_view_core.h" |
16 #include "third_party/skia/include/core/SkColor.h" | 15 #include "third_party/skia/include/core/SkColor.h" |
17 #include "ui/android/resources/crushed_sprite_resource.h" | 16 #include "ui/android/resources/crushed_sprite_resource.h" |
18 #include "ui/android/resources/resource_manager.h" | 17 #include "ui/android/resources/resource_manager.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 progress_bar_background_->RemoveFromParent(); | 398 progress_bar_background_->RemoveFromParent(); |
400 | 399 |
401 if (progress_bar_.get() && progress_bar_->parent()) | 400 if (progress_bar_.get() && progress_bar_->parent()) |
402 progress_bar_->RemoveFromParent(); | 401 progress_bar_->RemoveFromParent(); |
403 } | 402 } |
404 } | 403 } |
405 | 404 |
406 ContextualSearchLayer::ContextualSearchLayer( | 405 ContextualSearchLayer::ContextualSearchLayer( |
407 ui::ResourceManager* resource_manager) | 406 ui::ResourceManager* resource_manager) |
408 : OverlayPanelLayer(resource_manager), | 407 : OverlayPanelLayer(resource_manager), |
409 search_context_( | 408 search_context_(cc::UIResourceLayer::Create()), |
410 cc::UIResourceLayer::Create(cc::LayerSettings())), | |
411 search_provider_icon_sprite_(CrushedSpriteLayer::Create()), | 409 search_provider_icon_sprite_(CrushedSpriteLayer::Create()), |
412 arrow_icon_( | 410 arrow_icon_(cc::UIResourceLayer::Create()), |
413 cc::UIResourceLayer::Create(cc::LayerSettings())), | 411 search_promo_(cc::UIResourceLayer::Create()), |
414 search_promo_( | 412 search_promo_container_(cc::SolidColorLayer::Create()), |
415 cc::UIResourceLayer::Create(cc::LayerSettings())), | 413 peek_promo_container_(cc::SolidColorLayer::Create()), |
416 search_promo_container_( | 414 peek_promo_ripple_(cc::NinePatchLayer::Create()), |
417 cc::SolidColorLayer::Create(cc::LayerSettings())), | 415 peek_promo_text_(cc::UIResourceLayer::Create()), |
418 peek_promo_container_( | 416 progress_bar_(cc::NinePatchLayer::Create()), |
419 cc::SolidColorLayer::Create(cc::LayerSettings())), | 417 progress_bar_background_(cc::NinePatchLayer::Create()) { |
420 peek_promo_ripple_( | |
421 cc::NinePatchLayer::Create(cc::LayerSettings())), | |
422 peek_promo_text_( | |
423 cc::UIResourceLayer::Create(cc::LayerSettings())), | |
424 progress_bar_( | |
425 cc::NinePatchLayer::Create(cc::LayerSettings())), | |
426 progress_bar_background_( | |
427 cc::NinePatchLayer::Create(cc::LayerSettings())) { | |
428 // Search Peek Promo | 418 // Search Peek Promo |
429 peek_promo_container_->SetIsDrawable(true); | 419 peek_promo_container_->SetIsDrawable(true); |
430 peek_promo_container_->SetBackgroundColor(kSearchBarBackgroundColor); | 420 peek_promo_container_->SetBackgroundColor(kSearchBarBackgroundColor); |
431 peek_promo_ripple_->SetIsDrawable(true); | 421 peek_promo_ripple_->SetIsDrawable(true); |
432 peek_promo_ripple_->SetFillCenter(true); | 422 peek_promo_ripple_->SetFillCenter(true); |
433 peek_promo_text_->SetIsDrawable(true); | 423 peek_promo_text_->SetIsDrawable(true); |
434 peek_promo_container_->AddChild(peek_promo_ripple_); | 424 peek_promo_container_->AddChild(peek_promo_ripple_); |
435 peek_promo_container_->AddChild(peek_promo_text_); | 425 peek_promo_container_->AddChild(peek_promo_text_); |
436 | 426 |
437 // Search Bar Text | 427 // Search Bar Text |
(...skipping 17 matching lines...) Expand all Loading... |
455 // Progress Bar | 445 // Progress Bar |
456 progress_bar_->SetIsDrawable(true); | 446 progress_bar_->SetIsDrawable(true); |
457 progress_bar_->SetFillCenter(true); | 447 progress_bar_->SetFillCenter(true); |
458 } | 448 } |
459 | 449 |
460 ContextualSearchLayer::~ContextualSearchLayer() { | 450 ContextualSearchLayer::~ContextualSearchLayer() { |
461 } | 451 } |
462 | 452 |
463 } // namespace android | 453 } // namespace android |
464 } // namespace chrome | 454 } // namespace chrome |
OLD | NEW |