| 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 | 9 |
| 9 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 10 #include "content/browser/web_contents/aura/shadow_layer_delegate.h" | 11 #include "content/browser/web_contents/aura/shadow_layer_delegate.h" |
| 11 #include "content/browser/web_contents/web_contents_impl.h" | 12 #include "content/browser/web_contents/web_contents_impl.h" |
| 12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 13 #include "ui/compositor/layer_animation_observer.h" | 14 #include "ui/compositor/layer_animation_observer.h" |
| 14 #include "ui/compositor/scoped_layer_animation_settings.h" | 15 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 GetBackLayer()->SetTransform(back_transform); | 72 GetBackLayer()->SetTransform(back_transform); |
| 72 return true; | 73 return true; |
| 73 } | 74 } |
| 74 | 75 |
| 75 void OverscrollWindowAnimation::OnImplicitAnimationsCompleted() { | 76 void OverscrollWindowAnimation::OnImplicitAnimationsCompleted() { |
| 76 if (overscroll_cancelled_) { | 77 if (overscroll_cancelled_) { |
| 77 slide_window_.reset(); | 78 slide_window_.reset(); |
| 78 delegate_->OnOverscrollCancelled(); | 79 delegate_->OnOverscrollCancelled(); |
| 79 overscroll_cancelled_ = false; | 80 overscroll_cancelled_ = false; |
| 80 } else { | 81 } else { |
| 81 delegate_->OnOverscrollCompleted(slide_window_.Pass()); | 82 delegate_->OnOverscrollCompleted(std::move(slide_window_)); |
| 82 } | 83 } |
| 83 direction_ = SLIDE_NONE; | 84 direction_ = SLIDE_NONE; |
| 84 } | 85 } |
| 85 | 86 |
| 86 void OverscrollWindowAnimation::OnOverscrollModeChange( | 87 void OverscrollWindowAnimation::OnOverscrollModeChange( |
| 87 OverscrollMode old_mode, | 88 OverscrollMode old_mode, |
| 88 OverscrollMode new_mode) { | 89 OverscrollMode new_mode) { |
| 89 DCHECK_NE(old_mode, new_mode); | 90 DCHECK_NE(old_mode, new_mode); |
| 90 Direction new_direction = GetDirectionForMode(new_mode); | 91 Direction new_direction = GetDirectionForMode(new_mode); |
| 91 if (new_direction == SLIDE_NONE) { | 92 if (new_direction == SLIDE_NONE) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 ui::Layer* OverscrollWindowAnimation::GetBackLayer() const { | 169 ui::Layer* OverscrollWindowAnimation::GetBackLayer() const { |
| 169 DCHECK(direction_ != SLIDE_NONE); | 170 DCHECK(direction_ != SLIDE_NONE); |
| 170 if (direction_ == SLIDE_BACK) { | 171 if (direction_ == SLIDE_BACK) { |
| 171 DCHECK(slide_window_); | 172 DCHECK(slide_window_); |
| 172 return slide_window_->layer(); | 173 return slide_window_->layer(); |
| 173 } | 174 } |
| 174 return delegate_->GetMainWindow()->layer(); | 175 return delegate_->GetMainWindow()->layer(); |
| 175 } | 176 } |
| 176 | 177 |
| 177 } // namespace content | 178 } // namespace content |
| OLD | NEW |