| 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 "content/public/browser/android/compositor.h" |
| 9 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| 10 #include "ui/android/resources/resource_manager.h" | 11 #include "ui/android/resources/resource_manager.h" |
| 11 #include "ui/android/resources/ui_resource_android.h" | 12 #include "ui/android/resources/ui_resource_android.h" |
| 12 | 13 |
| 13 const SkColor kNormalAnonymizeContentColor = SK_ColorWHITE; | 14 const SkColor kNormalAnonymizeContentColor = SK_ColorWHITE; |
| 14 const SkColor kIncognitoAnonymizeContentColor = 0xFF737373; | 15 const SkColor kIncognitoAnonymizeContentColor = 0xFF737373; |
| 15 | 16 |
| 16 namespace chrome { | 17 namespace chrome { |
| 17 namespace android { | 18 namespace android { |
| 18 | 19 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 58 } |
| 58 | 59 |
| 59 debug_layer_->SetBounds(resource->size); | 60 debug_layer_->SetBounds(resource->size); |
| 60 if (show_debug && !debug_layer_->parent()) | 61 if (show_debug && !debug_layer_->parent()) |
| 61 layer_->AddChild(debug_layer_); | 62 layer_->AddChild(debug_layer_); |
| 62 else if (!show_debug && debug_layer_->parent()) | 63 else if (!show_debug && debug_layer_->parent()) |
| 63 debug_layer_->RemoveFromParent(); | 64 debug_layer_->RemoveFromParent(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 ToolbarLayer::ToolbarLayer() | 67 ToolbarLayer::ToolbarLayer() |
| 67 : layer_(cc::Layer::Create()), | 68 : layer_(cc::Layer::Create(content::Compositor::LayerSettings())), |
| 68 bitmap_layer_(cc::UIResourceLayer::Create()), | 69 bitmap_layer_( |
| 69 progress_layer_(cc::UIResourceLayer::Create()), | 70 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), |
| 70 anonymize_layer_(cc::SolidColorLayer::Create()), | 71 progress_layer_( |
| 71 debug_layer_(cc::SolidColorLayer::Create()) { | 72 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), |
| 73 anonymize_layer_( |
| 74 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), |
| 75 debug_layer_( |
| 76 cc::SolidColorLayer::Create(content::Compositor::LayerSettings())) { |
| 72 bitmap_layer_->SetIsDrawable(true); | 77 bitmap_layer_->SetIsDrawable(true); |
| 73 layer_->AddChild(bitmap_layer_); | 78 layer_->AddChild(bitmap_layer_); |
| 74 | 79 |
| 75 progress_layer_->SetIsDrawable(true); | 80 progress_layer_->SetIsDrawable(true); |
| 76 progress_layer_->SetHideLayerAndSubtree(true); | 81 progress_layer_->SetHideLayerAndSubtree(true); |
| 77 layer_->AddChild(progress_layer_); | 82 layer_->AddChild(progress_layer_); |
| 78 | 83 |
| 79 anonymize_layer_->SetHideLayerAndSubtree(true); | 84 anonymize_layer_->SetHideLayerAndSubtree(true); |
| 80 anonymize_layer_->SetIsDrawable(true); | 85 anonymize_layer_->SetIsDrawable(true); |
| 81 anonymize_layer_->SetBackgroundColor(kNormalAnonymizeContentColor); | 86 anonymize_layer_->SetBackgroundColor(kNormalAnonymizeContentColor); |
| 82 layer_->AddChild(anonymize_layer_); | 87 layer_->AddChild(anonymize_layer_); |
| 83 | 88 |
| 84 debug_layer_->SetIsDrawable(true); | 89 debug_layer_->SetIsDrawable(true); |
| 85 debug_layer_->SetBackgroundColor(SK_ColorGREEN); | 90 debug_layer_->SetBackgroundColor(SK_ColorGREEN); |
| 86 debug_layer_->SetOpacity(0.5f); | 91 debug_layer_->SetOpacity(0.5f); |
| 87 } | 92 } |
| 88 | 93 |
| 89 ToolbarLayer::~ToolbarLayer() { | 94 ToolbarLayer::~ToolbarLayer() { |
| 90 } | 95 } |
| 91 | 96 |
| 92 } // namespace android | 97 } // namespace android |
| 93 } // namespace chrome | 98 } // namespace chrome |
| OLD | NEW |