| 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 #ifndef CONTENT_BROWSER_ANDROID_EDGE_EFFECT_L_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_EDGE_EFFECT_L_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_EDGE_EFFECT_L_H_ | 6 #define CONTENT_BROWSER_ANDROID_EDGE_EFFECT_L_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/browser/android/edge_effect_base.h" | 10 #include "content/browser/android/edge_effect_base.h" |
| 11 #include "ui/gfx/geometry/rect_f.h" | 11 #include "ui/gfx/geometry/rect_f.h" |
| 12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 class Layer; | 15 class Layer; |
| 16 class UIResourceLayer; | 16 class UIResourceLayer; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 class SystemUIResourceManager; | 20 class ResourceManager; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 // |EdgeEffectL| mirrors its Android L counterpart, EdgeEffect.java. | 25 // |EdgeEffectL| mirrors its Android L counterpart, EdgeEffect.java. |
| 26 // Conscious tradeoffs were made to align this as closely as possible with the | 26 // Conscious tradeoffs were made to align this as closely as possible with the |
| 27 // the original Android java version. | 27 // the original Android java version. |
| 28 // All coordinates and dimensions are in device pixels. | 28 // All coordinates and dimensions are in device pixels. |
| 29 class EdgeEffectL : public EdgeEffectBase { | 29 class EdgeEffectL : public EdgeEffectBase { |
| 30 public: | 30 public: |
| 31 explicit EdgeEffectL(ui::SystemUIResourceManager* resource_manager); | 31 explicit EdgeEffectL(ui::ResourceManager* resource_manager); |
| 32 virtual ~EdgeEffectL(); | 32 virtual ~EdgeEffectL(); |
| 33 | 33 |
| 34 virtual void Pull(base::TimeTicks current_time, | 34 virtual void Pull(base::TimeTicks current_time, |
| 35 float delta_distance, | 35 float delta_distance, |
| 36 float displacement) override; | 36 float displacement) override; |
| 37 virtual void Absorb(base::TimeTicks current_time, float velocity) override; | 37 virtual void Absorb(base::TimeTicks current_time, float velocity) override; |
| 38 virtual bool Update(base::TimeTicks current_time) override; | 38 virtual bool Update(base::TimeTicks current_time) override; |
| 39 virtual void Release(base::TimeTicks current_time) override; | 39 virtual void Release(base::TimeTicks current_time) override; |
| 40 | 40 |
| 41 virtual void Finish() override; | 41 virtual void Finish() override; |
| 42 virtual bool IsFinished() const override; | 42 virtual bool IsFinished() const override; |
| 43 | 43 |
| 44 virtual void ApplyToLayers(const gfx::SizeF& size, | 44 virtual void ApplyToLayers(const gfx::SizeF& size, |
| 45 const gfx::Transform& transform) override; | 45 const gfx::Transform& transform) override; |
| 46 virtual void SetParent(cc::Layer* parent) override; | 46 virtual void SetParent(cc::Layer* parent) override; |
| 47 | 47 |
| 48 // Thread-safe trigger to load resources. | 48 // Thread-safe trigger to load resources. |
| 49 static void PreloadResources(ui::SystemUIResourceManager* resource_manager); | 49 static void PreloadResources(ui::ResourceManager* resource_manager); |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 ui::SystemUIResourceManager* const resource_manager_; | 52 ui::ResourceManager* const resource_manager_; |
| 53 | 53 |
| 54 scoped_refptr<cc::UIResourceLayer> glow_; | 54 scoped_refptr<cc::UIResourceLayer> glow_; |
| 55 | 55 |
| 56 float glow_alpha_; | 56 float glow_alpha_; |
| 57 float glow_scale_y_; | 57 float glow_scale_y_; |
| 58 | 58 |
| 59 float glow_alpha_start_; | 59 float glow_alpha_start_; |
| 60 float glow_alpha_finish_; | 60 float glow_alpha_finish_; |
| 61 float glow_scale_y_start_; | 61 float glow_scale_y_start_; |
| 62 float glow_scale_y_finish_; | 62 float glow_scale_y_finish_; |
| 63 | 63 |
| 64 gfx::RectF arc_rect_; | 64 gfx::RectF arc_rect_; |
| 65 gfx::Size bounds_; | 65 gfx::Size bounds_; |
| 66 float displacement_; | 66 float displacement_; |
| 67 float target_displacement_; | 67 float target_displacement_; |
| 68 | 68 |
| 69 base::TimeTicks start_time_; | 69 base::TimeTicks start_time_; |
| 70 base::TimeDelta duration_; | 70 base::TimeDelta duration_; |
| 71 | 71 |
| 72 State state_; | 72 State state_; |
| 73 | 73 |
| 74 float pull_distance_; | 74 float pull_distance_; |
| 75 | 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(EdgeEffectL); | 76 DISALLOW_COPY_AND_ASSIGN(EdgeEffectL); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace content | 79 } // namespace content |
| 80 | 80 |
| 81 #endif // CONTENT_BROWSER_ANDROID_EDGE_EFFECT_L_H_ | 81 #endif // CONTENT_BROWSER_ANDROID_EDGE_EFFECT_L_H_ |
| OLD | NEW |