Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / browser / android / edge_effect.h
blob8fb5c5f55d35e94210f08b1e965f24fe60507a5d
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_ANDROID_EDGE_EFFECT_H_
6 #define CONTENT_BROWSER_ANDROID_EDGE_EFFECT_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/android/edge_effect_base.h"
11 namespace cc {
12 class Layer;
15 namespace ui {
16 class SystemUIResourceManager;
19 namespace content {
21 // |EdgeEffect| mirrors its Android counterpart, EdgeEffect.java.
22 // Conscious tradeoffs were made to align this as closely as possible with the
23 // the original Android java version.
24 // All coordinates and dimensions are in device pixels.
25 class EdgeEffect : public EdgeEffectBase {
26 public:
27 explicit EdgeEffect(ui::SystemUIResourceManager* resource_manager,
28 float device_scale_factor);
29 virtual ~EdgeEffect();
31 virtual void Pull(base::TimeTicks current_time,
32 float delta_distance,
33 float displacement) override;
34 virtual void Absorb(base::TimeTicks current_time, float velocity) override;
35 virtual bool Update(base::TimeTicks current_time) override;
36 virtual void Release(base::TimeTicks current_time) override;
38 virtual void Finish() override;
39 virtual bool IsFinished() const override;
41 virtual void ApplyToLayers(const gfx::SizeF& size,
42 const gfx::Transform& transform) override;
43 virtual void SetParent(cc::Layer* parent) override;
45 // Thread-safe trigger to load resources.
46 static void PreloadResources(ui::SystemUIResourceManager* resource_manager);
48 private:
49 class EffectLayer;
50 scoped_ptr<EffectLayer> edge_;
51 scoped_ptr<EffectLayer> glow_;
53 float base_edge_height_;
54 float base_glow_height_;
56 float edge_alpha_;
57 float edge_scale_y_;
58 float glow_alpha_;
59 float glow_scale_y_;
61 float edge_alpha_start_;
62 float edge_alpha_finish_;
63 float edge_scale_y_start_;
64 float edge_scale_y_finish_;
65 float glow_alpha_start_;
66 float glow_alpha_finish_;
67 float glow_scale_y_start_;
68 float glow_scale_y_finish_;
70 base::TimeTicks start_time_;
71 base::TimeDelta duration_;
73 State state_;
75 float pull_distance_;
77 DISALLOW_COPY_AND_ASSIGN(EdgeEffect);
80 } // namespace content
82 #endif // CONTENT_BROWSER_ANDROID_EDGE_EFFECT_H_