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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_ANDROID_EDGE_EFFECT_L_H_
6 #define CONTENT_BROWSER_ANDROID_EDGE_EFFECT_L_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/browser/android/edge_effect_base.h"
11 #include "ui/gfx/geometry/rect_f.h"
12 #include "ui/gfx/geometry/size.h"
16 class UIResourceLayer
;
20 class SystemUIResourceManager
;
25 // |EdgeEffectL| mirrors its Android L counterpart, EdgeEffect.java.
26 // Conscious tradeoffs were made to align this as closely as possible with the
27 // the original Android java version.
28 // All coordinates and dimensions are in device pixels.
29 class EdgeEffectL
: public EdgeEffectBase
{
31 explicit EdgeEffectL(ui::SystemUIResourceManager
* resource_manager
);
32 virtual ~EdgeEffectL();
34 virtual void Pull(base::TimeTicks current_time
,
36 float displacement
) OVERRIDE
;
37 virtual void Absorb(base::TimeTicks current_time
, float velocity
) OVERRIDE
;
38 virtual bool Update(base::TimeTicks current_time
) OVERRIDE
;
39 virtual void Release(base::TimeTicks current_time
) OVERRIDE
;
41 virtual void Finish() OVERRIDE
;
42 virtual bool IsFinished() const OVERRIDE
;
44 virtual void ApplyToLayers(const gfx::SizeF
& size
,
45 const gfx::Transform
& transform
) OVERRIDE
;
46 virtual void SetParent(cc::Layer
* parent
) OVERRIDE
;
48 // Thread-safe trigger to load resources.
49 static void PreloadResources(ui::SystemUIResourceManager
* resource_manager
);
52 ui::SystemUIResourceManager
* const resource_manager_
;
54 scoped_refptr
<cc::UIResourceLayer
> glow_
;
59 float glow_alpha_start_
;
60 float glow_alpha_finish_
;
61 float glow_scale_y_start_
;
62 float glow_scale_y_finish_
;
67 float target_displacement_
;
69 base::TimeTicks start_time_
;
70 base::TimeDelta duration_
;
76 DISALLOW_COPY_AND_ASSIGN(EdgeEffectL
);
79 } // namespace content
81 #endif // CONTENT_BROWSER_ANDROID_EDGE_EFFECT_L_H_