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 "content/browser/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 "content/browser/android/animation_utils.h" |
9 #include "ui/base/android/system_ui_resource_manager.h" | 9 #include "ui/android/resources/resource_manager.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 // Time it will take the effect to fully recede in ms | 15 // Time it will take the effect to fully recede in ms |
16 const int kRecedeTimeMs = 600; | 16 const int kRecedeTimeMs = 600; |
17 | 17 |
18 // Time it will take before a pulled glow begins receding in ms | 18 // Time it will take before a pulled glow begins receding in ms |
19 const int kPullTimeMs = 167; | 19 const int kPullTimeMs = 167; |
(...skipping 18 matching lines...) Expand all Loading... |
38 // How much dragging should effect the height of the glow image. | 38 // How much dragging should effect the height of the glow image. |
39 // Number determined by user testing. | 39 // Number determined by user testing. |
40 const float kPullDistanceAlphaGlowFactor = 0.8f; | 40 const float kPullDistanceAlphaGlowFactor = 0.8f; |
41 | 41 |
42 const int kVelocityGlowFactor = 6; | 42 const int kVelocityGlowFactor = 6; |
43 | 43 |
44 const ui::SystemUIResourceType kResourceType = ui::OVERSCROLL_GLOW_L; | 44 const ui::SystemUIResourceType kResourceType = ui::OVERSCROLL_GLOW_L; |
45 | 45 |
46 } // namespace | 46 } // namespace |
47 | 47 |
48 EdgeEffectL::EdgeEffectL(ui::SystemUIResourceManager* resource_manager) | 48 EdgeEffectL::EdgeEffectL(ui::ResourceManager* resource_manager) |
49 : resource_manager_(resource_manager), | 49 : resource_manager_(resource_manager), |
50 glow_(cc::UIResourceLayer::Create()), | 50 glow_(cc::UIResourceLayer::Create()), |
51 glow_alpha_(0), | 51 glow_alpha_(0), |
52 glow_scale_y_(0), | 52 glow_scale_y_(0), |
53 glow_alpha_start_(0), | 53 glow_alpha_start_(0), |
54 glow_alpha_finish_(0), | 54 glow_alpha_finish_(0), |
55 glow_scale_y_start_(0), | 55 glow_scale_y_start_(0), |
56 glow_scale_y_finish_(0), | 56 glow_scale_y_finish_(0), |
57 displacement_(0.5f), | 57 displacement_(0.5f), |
58 target_displacement_(0.5f), | 58 target_displacement_(0.5f), |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 offset_transform.ConcatTransform(transform); | 248 offset_transform.ConcatTransform(transform); |
249 glow_->SetTransform(offset_transform); | 249 glow_->SetTransform(offset_transform); |
250 } | 250 } |
251 | 251 |
252 void EdgeEffectL::SetParent(cc::Layer* parent) { | 252 void EdgeEffectL::SetParent(cc::Layer* parent) { |
253 if (glow_->parent() != parent) | 253 if (glow_->parent() != parent) |
254 parent->AddChild(glow_); | 254 parent->AddChild(glow_); |
255 } | 255 } |
256 | 256 |
257 // static | 257 // static |
258 void EdgeEffectL::PreloadResources( | 258 void EdgeEffectL::PreloadResources(ui::ResourceManager* resource_manager) { |
259 ui::SystemUIResourceManager* resource_manager) { | |
260 DCHECK(resource_manager); | 259 DCHECK(resource_manager); |
261 resource_manager->PreloadResource(kResourceType); | 260 resource_manager->PreloadResource(kResourceType); |
262 } | 261 } |
263 | 262 |
264 } // namespace content | 263 } // namespace content |
OLD | NEW |