OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 "ui/android/overscroll_glow.h" | 5 #include "ui/android/overscroll_glow.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "ui/android/edge_effect_base.h" | 10 #include "ui/android/edge_effect_base.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 OverscrollGlow::OverscrollGlow(OverscrollGlowClient* client) | 36 OverscrollGlow::OverscrollGlow(OverscrollGlowClient* client) |
37 : client_(client), | 37 : client_(client), |
38 edge_offsets_(), | 38 edge_offsets_(), |
39 initialized_(false), | 39 initialized_(false), |
40 allow_horizontal_overscroll_(true), | 40 allow_horizontal_overscroll_(true), |
41 allow_vertical_overscroll_(true) { | 41 allow_vertical_overscroll_(true) { |
42 DCHECK(client); | 42 DCHECK(client); |
43 } | 43 } |
44 | 44 |
| 45 OverscrollGlow::OverscrollGlow() |
| 46 : client_(nullptr), |
| 47 edge_offsets_(), |
| 48 initialized_(false), |
| 49 allow_horizontal_overscroll_(true), |
| 50 allow_vertical_overscroll_(true) {} |
| 51 |
45 OverscrollGlow::~OverscrollGlow() { | 52 OverscrollGlow::~OverscrollGlow() { |
46 Detach(); | 53 Detach(); |
47 } | 54 } |
48 | 55 |
49 void OverscrollGlow::Reset() { | 56 void OverscrollGlow::Reset() { |
50 if (!initialized_) | 57 if (!initialized_) |
51 return; | 58 return; |
52 Detach(); | 59 Detach(); |
53 for (size_t i = 0; i < EDGE_COUNT; ++i) | 60 for (size_t i = 0; i < EDGE_COUNT; ++i) |
54 edge_effects_[i]->Finish(); | 61 edge_effects_[i]->Finish(); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 for (size_t i = 0; i < EDGE_COUNT; ++i) | 279 for (size_t i = 0; i < EDGE_COUNT; ++i) |
273 edge_effects_[i]->Release(current_time); | 280 edge_effects_[i]->Release(current_time); |
274 } | 281 } |
275 | 282 |
276 EdgeEffectBase* OverscrollGlow::GetOppositeEdge(int edge_index) { | 283 EdgeEffectBase* OverscrollGlow::GetOppositeEdge(int edge_index) { |
277 DCHECK(initialized_); | 284 DCHECK(initialized_); |
278 return edge_effects_[(edge_index + 2) % EDGE_COUNT].get(); | 285 return edge_effects_[(edge_index + 2) % EDGE_COUNT].get(); |
279 } | 286 } |
280 | 287 |
281 } // namespace ui | 288 } // namespace ui |
OLD | NEW |