OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/web_contents/aura/overscroll_window_animation.h" | 5 #include "content/browser/web_contents/aura/overscroll_window_animation.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 void OverscrollWindowAnimation::OnOverscrollModeChange( | 95 void OverscrollWindowAnimation::OnOverscrollModeChange( |
96 OverscrollMode old_mode, | 96 OverscrollMode old_mode, |
97 OverscrollMode new_mode, | 97 OverscrollMode new_mode, |
98 OverscrollSource source) { | 98 OverscrollSource source) { |
99 DCHECK_NE(old_mode, new_mode); | 99 DCHECK_NE(old_mode, new_mode); |
100 Direction new_direction = GetDirectionForMode(new_mode); | 100 Direction new_direction = GetDirectionForMode(new_mode); |
101 if (new_direction == SLIDE_NONE) { | 101 if (new_direction == SLIDE_NONE) { |
102 // The user cancelled the in progress animation. | 102 // The user cancelled the in progress animation. |
103 if (is_active()) | 103 if (is_active()) { |
104 CancelSlide(); | 104 CancelSlide(); |
| 105 } else { |
| 106 overscroll_source_ = OverscrollSource::NONE; |
| 107 direction_ = SLIDE_NONE; |
| 108 } |
105 return; | 109 return; |
106 } | 110 } |
107 if (is_active()) { | 111 if (is_active()) { |
108 slide_window_->layer()->GetAnimator()->StopAnimating(); | 112 slide_window_->layer()->GetAnimator()->StopAnimating(); |
109 delegate_->GetMainWindow()->layer()->GetAnimator()->StopAnimating(); | 113 delegate_->GetMainWindow()->layer()->GetAnimator()->StopAnimating(); |
110 } | 114 } |
111 gfx::Rect slide_window_bounds(GetVisibleSize()); | 115 gfx::Rect slide_window_bounds(GetVisibleSize()); |
112 if (new_direction == SLIDE_FRONT) { | 116 if (new_direction == SLIDE_FRONT) { |
113 slide_window_bounds.Offset(base::i18n::IsRTL() | 117 slide_window_bounds.Offset(base::i18n::IsRTL() |
114 ? -slide_window_bounds.width() | 118 ? -slide_window_bounds.width() |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 ui::Layer* OverscrollWindowAnimation::GetBackLayer() const { | 190 ui::Layer* OverscrollWindowAnimation::GetBackLayer() const { |
187 DCHECK(direction_ != SLIDE_NONE); | 191 DCHECK(direction_ != SLIDE_NONE); |
188 if (direction_ == SLIDE_BACK) { | 192 if (direction_ == SLIDE_BACK) { |
189 DCHECK(slide_window_); | 193 DCHECK(slide_window_); |
190 return slide_window_->layer(); | 194 return slide_window_->layer(); |
191 } | 195 } |
192 return delegate_->GetMainWindow()->layer(); | 196 return delegate_->GetMainWindow()->layer(); |
193 } | 197 } |
194 | 198 |
195 } // namespace content | 199 } // namespace content |
OLD | NEW |