[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / android / edge_effect_l.h
blob0e78282a37803bf01edde1e383b0f5f4e8691d11
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"
14 namespace cc {
15 class Layer;
16 class UIResourceLayer;
19 namespace ui {
20 class ResourceManager;
23 namespace content {
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 {
30 public:
31 explicit EdgeEffectL(ui::ResourceManager* resource_manager);
32 ~EdgeEffectL() override;
34 void Pull(base::TimeTicks current_time,
35 float delta_distance,
36 float displacement) override;
37 void Absorb(base::TimeTicks current_time, float velocity) override;
38 bool Update(base::TimeTicks current_time) override;
39 void Release(base::TimeTicks current_time) override;
41 void Finish() override;
42 bool IsFinished() const override;
43 float GetAlpha() const override;
45 void ApplyToLayers(Edge edge,
46 const gfx::SizeF& viewport_size,
47 float offset) override;
48 void SetParent(cc::Layer* parent) override;
50 // Thread-safe trigger to load resources.
51 static void PreloadResources(ui::ResourceManager* resource_manager);
53 private:
54 ui::ResourceManager* const resource_manager_;
56 scoped_refptr<cc::UIResourceLayer> glow_;
58 float glow_alpha_;
59 float glow_scale_y_;
61 float glow_alpha_start_;
62 float glow_alpha_finish_;
63 float glow_scale_y_start_;
64 float glow_scale_y_finish_;
66 gfx::RectF arc_rect_;
67 gfx::Size bounds_;
68 float displacement_;
69 float target_displacement_;
71 base::TimeTicks start_time_;
72 base::TimeDelta duration_;
74 State state_;
76 float pull_distance_;
78 DISALLOW_COPY_AND_ASSIGN(EdgeEffectL);
81 } // namespace content
83 #endif // CONTENT_BROWSER_ANDROID_EDGE_EFFECT_L_H_