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_delegate.h" | 5 #include "content/browser/web_contents/aura/overscroll_window_delegate.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "content/browser/frame_host/navigation_controller_impl.h" | 8 #include "content/browser/frame_host/navigation_controller_impl.h" |
9 #include "content/browser/frame_host/navigation_entry_impl.h" | 9 #include "content/browser/frame_host/navigation_entry_impl.h" |
10 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 10 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 void OverscrollWindowDelegate::StartOverscroll() { | 36 void OverscrollWindowDelegate::StartOverscroll() { |
37 OverscrollMode old_mode = overscroll_mode_; | 37 OverscrollMode old_mode = overscroll_mode_; |
38 if (delta_x_ > 0) | 38 if (delta_x_ > 0) |
39 overscroll_mode_ = OVERSCROLL_EAST; | 39 overscroll_mode_ = OVERSCROLL_EAST; |
40 else | 40 else |
41 overscroll_mode_ = OVERSCROLL_WEST; | 41 overscroll_mode_ = OVERSCROLL_WEST; |
42 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_); | 42 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_); |
43 } | 43 } |
44 | 44 |
45 void OverscrollWindowDelegate::ResetOverscroll() { | 45 void OverscrollWindowDelegate::ResetOverscroll() { |
| 46 if (overscroll_mode_ == OVERSCROLL_NONE) |
| 47 return; |
46 delegate_->OnOverscrollModeChange(overscroll_mode_, OVERSCROLL_NONE); | 48 delegate_->OnOverscrollModeChange(overscroll_mode_, OVERSCROLL_NONE); |
47 overscroll_mode_ = OVERSCROLL_NONE; | 49 overscroll_mode_ = OVERSCROLL_NONE; |
48 delta_x_ = 0; | 50 delta_x_ = 0; |
49 } | 51 } |
50 | 52 |
51 void OverscrollWindowDelegate::CompleteOrResetOverscroll() { | 53 void OverscrollWindowDelegate::CompleteOrResetOverscroll() { |
52 if (overscroll_mode_ == OVERSCROLL_NONE) | 54 if (overscroll_mode_ == OVERSCROLL_NONE) |
53 return; | 55 return; |
54 int width = delegate_->GetVisibleBounds().width(); | 56 int width = delegate_->GetVisibleBounds().width(); |
55 float ratio = (fabs(delta_x_)) / width; | 57 float ratio = (fabs(delta_x_)) / width; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 ResetOverscroll(); | 122 ResetOverscroll(); |
121 break; | 123 break; |
122 | 124 |
123 default: | 125 default: |
124 break; | 126 break; |
125 } | 127 } |
126 event->SetHandled(); | 128 event->SetHandled(); |
127 } | 129 } |
128 | 130 |
129 } // namespace content | 131 } // namespace content |
OLD | NEW |