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 "content/browser/android/edge_effect_l.h" | 5 #include "ui/android/edge_effect_l.h" |
6 | 6 |
7 #include "cc/layers/ui_resource_layer.h" | 7 #include "cc/layers/ui_resource_layer.h" |
8 #include "content/browser/android/animation_utils.h" | 8 #include "ui/android/animation_utils.h" |
9 #include "content/public/browser/android/compositor.h" | |
10 #include "ui/android/resources/resource_manager.h" | 9 #include "ui/android/resources/resource_manager.h" |
11 #include "ui/android/resources/system_ui_resource_type.h" | 10 #include "ui/android/resources/system_ui_resource_type.h" |
| 11 #include "ui/android/window_android_compositor.h" |
12 #include "ui/gfx/geometry/rect_f.h" | 12 #include "ui/gfx/geometry/rect_f.h" |
13 #include "ui/gfx/geometry/size_conversions.h" | 13 #include "ui/gfx/geometry/size_conversions.h" |
14 | 14 |
15 namespace content { | 15 namespace ui { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // Time it will take the effect to fully recede in ms | 19 // Time it will take the effect to fully recede in ms |
20 const int kRecedeTimeMs = 600; | 20 const int kRecedeTimeMs = 600; |
21 | 21 |
22 // Time it will take before a pulled glow begins receding in ms | 22 // Time it will take before a pulled glow begins receding in ms |
23 const int kPullTimeMs = 167; | 23 const int kPullTimeMs = 167; |
24 | 24 |
25 // Time it will take for a pulled glow to decay to partial strength before | 25 // Time it will take for a pulled glow to decay to partial strength before |
(...skipping 18 matching lines...) Expand all Loading... |
44 const float kPullDistanceAlphaGlowFactor = 0.8f; | 44 const float kPullDistanceAlphaGlowFactor = 0.8f; |
45 | 45 |
46 const int kVelocityGlowFactor = 6; | 46 const int kVelocityGlowFactor = 6; |
47 | 47 |
48 const ui::SystemUIResourceType kResourceId = ui::OVERSCROLL_GLOW_L; | 48 const ui::SystemUIResourceType kResourceId = ui::OVERSCROLL_GLOW_L; |
49 | 49 |
50 } // namespace | 50 } // namespace |
51 | 51 |
52 EdgeEffectL::EdgeEffectL(ui::ResourceManager* resource_manager) | 52 EdgeEffectL::EdgeEffectL(ui::ResourceManager* resource_manager) |
53 : resource_manager_(resource_manager), | 53 : resource_manager_(resource_manager), |
54 glow_(cc::UIResourceLayer::Create(Compositor::LayerSettings())), | 54 glow_(cc::UIResourceLayer::Create( |
| 55 WindowAndroidCompositor::LayerSettings())), |
55 glow_alpha_(0), | 56 glow_alpha_(0), |
56 glow_scale_y_(0), | 57 glow_scale_y_(0), |
57 glow_alpha_start_(0), | 58 glow_alpha_start_(0), |
58 glow_alpha_finish_(0), | 59 glow_alpha_finish_(0), |
59 glow_scale_y_start_(0), | 60 glow_scale_y_start_(0), |
60 glow_scale_y_finish_(0), | 61 glow_scale_y_finish_(0), |
61 displacement_(0.5f), | 62 displacement_(0.5f), |
62 target_displacement_(0.5f), | 63 target_displacement_(0.5f), |
63 state_(STATE_IDLE), | 64 state_(STATE_IDLE), |
64 pull_distance_(0) { | 65 pull_distance_(0) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 parent->AddChild(glow_); | 292 parent->AddChild(glow_); |
292 } | 293 } |
293 | 294 |
294 // static | 295 // static |
295 void EdgeEffectL::PreloadResources(ui::ResourceManager* resource_manager) { | 296 void EdgeEffectL::PreloadResources(ui::ResourceManager* resource_manager) { |
296 DCHECK(resource_manager); | 297 DCHECK(resource_manager); |
297 resource_manager->PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, | 298 resource_manager->PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, |
298 kResourceId); | 299 kResourceId); |
299 } | 300 } |
300 | 301 |
301 } // namespace content | 302 } // namespace ui |
OLD | NEW |