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/solid_color_layer.h" | 7 #include "cc/layers/solid_color_layer.h" |
8 #include "cc/layers/ui_resource_layer.h" | 8 #include "cc/layers/ui_resource_layer.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/android/resources/resource_manager.h" | 10 #include "ui/android/resources/resource_manager.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 progress_layer_->SetPosition(progress_resource->padding.origin()); | 56 progress_layer_->SetPosition(progress_resource->padding.origin()); |
57 } | 57 } |
58 | 58 |
59 debug_layer_->SetBounds(resource->size); | 59 debug_layer_->SetBounds(resource->size); |
60 if (show_debug && !debug_layer_->parent()) | 60 if (show_debug && !debug_layer_->parent()) |
61 layer_->AddChild(debug_layer_); | 61 layer_->AddChild(debug_layer_); |
62 else if (!show_debug && debug_layer_->parent()) | 62 else if (!show_debug && debug_layer_->parent()) |
63 debug_layer_->RemoveFromParent(); | 63 debug_layer_->RemoveFromParent(); |
64 } | 64 } |
65 | 65 |
66 void ToolbarLayer::PushResource(ui::ResourceManager::Resource* resource, | |
67 bool anonymize, | |
68 bool anonymize_component_is_incognito, | |
69 bool show_debug) { | |
70 PushResource(resource, | |
71 nullptr, | |
72 anonymize, | |
73 anonymize_component_is_incognito, | |
74 show_debug); | |
75 } | |
76 | |
77 ToolbarLayer::ToolbarLayer() | 66 ToolbarLayer::ToolbarLayer() |
78 : layer_(cc::Layer::Create()), | 67 : layer_(cc::Layer::Create()), |
79 bitmap_layer_(cc::UIResourceLayer::Create()), | 68 bitmap_layer_(cc::UIResourceLayer::Create()), |
80 progress_layer_(cc::UIResourceLayer::Create()), | 69 progress_layer_(cc::UIResourceLayer::Create()), |
81 anonymize_layer_(cc::SolidColorLayer::Create()), | 70 anonymize_layer_(cc::SolidColorLayer::Create()), |
82 debug_layer_(cc::SolidColorLayer::Create()) { | 71 debug_layer_(cc::SolidColorLayer::Create()) { |
83 bitmap_layer_->SetIsDrawable(true); | 72 bitmap_layer_->SetIsDrawable(true); |
84 layer_->AddChild(bitmap_layer_); | 73 layer_->AddChild(bitmap_layer_); |
85 | 74 |
86 progress_layer_->SetIsDrawable(true); | 75 progress_layer_->SetIsDrawable(true); |
87 progress_layer_->SetHideLayerAndSubtree(true); | 76 progress_layer_->SetHideLayerAndSubtree(true); |
88 layer_->AddChild(progress_layer_); | 77 layer_->AddChild(progress_layer_); |
89 | 78 |
90 anonymize_layer_->SetHideLayerAndSubtree(true); | 79 anonymize_layer_->SetHideLayerAndSubtree(true); |
91 anonymize_layer_->SetIsDrawable(true); | 80 anonymize_layer_->SetIsDrawable(true); |
92 anonymize_layer_->SetBackgroundColor(kNormalAnonymizeContentColor); | 81 anonymize_layer_->SetBackgroundColor(kNormalAnonymizeContentColor); |
93 layer_->AddChild(anonymize_layer_); | 82 layer_->AddChild(anonymize_layer_); |
94 | 83 |
95 debug_layer_->SetIsDrawable(true); | 84 debug_layer_->SetIsDrawable(true); |
96 debug_layer_->SetBackgroundColor(SK_ColorGREEN); | 85 debug_layer_->SetBackgroundColor(SK_ColorGREEN); |
97 debug_layer_->SetOpacity(0.5f); | 86 debug_layer_->SetOpacity(0.5f); |
98 } | 87 } |
99 | 88 |
100 ToolbarLayer::~ToolbarLayer() { | 89 ToolbarLayer::~ToolbarLayer() { |
101 } | 90 } |
102 | 91 |
103 } // namespace android | 92 } // namespace android |
104 } // namespace chrome | 93 } // namespace chrome |
OLD | NEW |