OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/android/edge_effect.h" | 5 #include "ui/android/edge_effect.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "cc/layers/layer_settings.h" | |
10 #include "cc/layers/ui_resource_layer.h" | 9 #include "cc/layers/ui_resource_layer.h" |
11 #include "ui/android/animation_utils.h" | 10 #include "ui/android/animation_utils.h" |
12 #include "ui/android/resources/resource_manager.h" | 11 #include "ui/android/resources/resource_manager.h" |
13 #include "ui/android/resources/system_ui_resource_type.h" | 12 #include "ui/android/resources/system_ui_resource_type.h" |
14 #include "ui/android/window_android_compositor.h" | 13 #include "ui/android/window_android_compositor.h" |
15 | 14 |
16 namespace ui { | 15 namespace ui { |
17 | 16 |
18 namespace { | 17 namespace { |
19 | 18 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 58 |
60 const float kEdgeHeightAtMdpi = 12.f; | 59 const float kEdgeHeightAtMdpi = 12.f; |
61 const float kGlowHeightAtMdpi = 128.f; | 60 const float kGlowHeightAtMdpi = 128.f; |
62 | 61 |
63 } // namespace | 62 } // namespace |
64 | 63 |
65 class EdgeEffect::EffectLayer { | 64 class EdgeEffect::EffectLayer { |
66 public: | 65 public: |
67 EffectLayer(ui::SystemUIResourceType resource_type, | 66 EffectLayer(ui::SystemUIResourceType resource_type, |
68 ui::ResourceManager* resource_manager) | 67 ui::ResourceManager* resource_manager) |
69 : ui_resource_layer_(cc::UIResourceLayer::Create(cc::LayerSettings())), | 68 : ui_resource_layer_(cc::UIResourceLayer::Create()), |
70 resource_type_(resource_type), | 69 resource_type_(resource_type), |
71 resource_manager_(resource_manager) {} | 70 resource_manager_(resource_manager) {} |
72 | 71 |
73 ~EffectLayer() { ui_resource_layer_->RemoveFromParent(); } | 72 ~EffectLayer() { ui_resource_layer_->RemoveFromParent(); } |
74 | 73 |
75 void SetParent(cc::Layer* parent) { | 74 void SetParent(cc::Layer* parent) { |
76 if (ui_resource_layer_->parent() != parent) | 75 if (ui_resource_layer_->parent() != parent) |
77 parent->AddChild(ui_resource_layer_); | 76 parent->AddChild(ui_resource_layer_); |
78 } | 77 } |
79 | 78 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // static | 351 // static |
353 void EdgeEffect::PreloadResources(ui::ResourceManager* resource_manager) { | 352 void EdgeEffect::PreloadResources(ui::ResourceManager* resource_manager) { |
354 DCHECK(resource_manager); | 353 DCHECK(resource_manager); |
355 resource_manager->PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, | 354 resource_manager->PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, |
356 kEdgeResourceId); | 355 kEdgeResourceId); |
357 resource_manager->PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, | 356 resource_manager->PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, |
358 kGlowResourceId); | 357 kGlowResourceId); |
359 } | 358 } |
360 | 359 |
361 } // namespace ui | 360 } // namespace ui |
OLD | NEW |