| 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 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "content/browser/web_contents/aura/shadow_layer_delegate.h" | 10 #include "content/browser/web_contents/aura/shadow_layer_delegate.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 overscroll_cancelled_ = false; | 79 overscroll_cancelled_ = false; |
| 80 } else { | 80 } else { |
| 81 delegate_->OnOverscrollCompleted(slide_window_.Pass()); | 81 delegate_->OnOverscrollCompleted(slide_window_.Pass()); |
| 82 } | 82 } |
| 83 direction_ = SLIDE_NONE; | 83 direction_ = SLIDE_NONE; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void OverscrollWindowAnimation::OnOverscrollModeChange( | 86 void OverscrollWindowAnimation::OnOverscrollModeChange( |
| 87 OverscrollMode old_mode, | 87 OverscrollMode old_mode, |
| 88 OverscrollMode new_mode) { | 88 OverscrollMode new_mode) { |
| 89 DCHECK_NE(old_mode, new_mode); |
| 89 Direction new_direction = GetDirectionForMode(new_mode); | 90 Direction new_direction = GetDirectionForMode(new_mode); |
| 90 if (new_direction == SLIDE_NONE) { | 91 if (new_direction == SLIDE_NONE) { |
| 91 // The user cancelled the in progress animation. | 92 // The user cancelled the in progress animation. |
| 92 if (is_active()) | 93 if (is_active()) |
| 93 CancelSlide(); | 94 CancelSlide(); |
| 94 return; | 95 return; |
| 95 } | 96 } |
| 96 if (is_active()) { | 97 if (is_active()) { |
| 97 slide_window_->layer()->GetAnimator()->StopAnimating(); | 98 slide_window_->layer()->GetAnimator()->StopAnimating(); |
| 98 delegate_->GetMainWindow()->layer()->GetAnimator()->StopAnimating(); | 99 delegate_->GetMainWindow()->layer()->GetAnimator()->StopAnimating(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 ui::Layer* OverscrollWindowAnimation::GetBackLayer() const { | 168 ui::Layer* OverscrollWindowAnimation::GetBackLayer() const { |
| 168 DCHECK(direction_ != SLIDE_NONE); | 169 DCHECK(direction_ != SLIDE_NONE); |
| 169 if (direction_ == SLIDE_BACK) { | 170 if (direction_ == SLIDE_BACK) { |
| 170 DCHECK(slide_window_); | 171 DCHECK(slide_window_); |
| 171 return slide_window_->layer(); | 172 return slide_window_->layer(); |
| 172 } | 173 } |
| 173 return delegate_->GetMainWindow()->layer(); | 174 return delegate_->GetMainWindow()->layer(); |
| 174 } | 175 } |
| 175 | 176 |
| 176 } // namespace content | 177 } // namespace content |
| OLD | NEW |