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/macros.h" | 7 #include "base/macros.h" |
8 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 8 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
9 #include "content/public/browser/overscroll_configuration.h" | 9 #include "content/public/browser/overscroll_configuration.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 void OnOverscrollModeChange(OverscrollMode old_mode, | 92 void OnOverscrollModeChange(OverscrollMode old_mode, |
93 OverscrollMode new_mode) override { | 93 OverscrollMode new_mode) override { |
94 mode_changed_ = true; | 94 mode_changed_ = true; |
95 current_mode_ = new_mode; | 95 current_mode_ = new_mode; |
96 if (current_mode_ != OVERSCROLL_NONE) | 96 if (current_mode_ != OVERSCROLL_NONE) |
97 overscroll_started_ = true; | 97 overscroll_started_ = true; |
98 } | 98 } |
99 | 99 |
100 // Window in which the overscroll window delegate is installed. | 100 // Window in which the overscroll window delegate is installed. |
101 scoped_ptr<aura::Window> window_; | 101 std::unique_ptr<aura::Window> window_; |
102 | 102 |
103 // State flags. | 103 // State flags. |
104 bool overscroll_complete_; | 104 bool overscroll_complete_; |
105 bool overscroll_started_; | 105 bool overscroll_started_; |
106 bool mode_changed_; | 106 bool mode_changed_; |
107 OverscrollMode current_mode_; | 107 OverscrollMode current_mode_; |
108 | 108 |
109 // Config defined constants. | 109 // Config defined constants. |
110 const float touch_start_threshold_; | 110 const float touch_start_threshold_; |
111 const float touch_complete_threshold_; | 111 const float touch_complete_threshold_; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 EXPECT_EQ(current_mode(), OVERSCROLL_NONE); | 243 EXPECT_EQ(current_mode(), OVERSCROLL_NONE); |
244 EXPECT_FALSE(overscroll_complete()); | 244 EXPECT_FALSE(overscroll_complete()); |
245 | 245 |
246 // We should be able to restart the overscroll without lifting the finger. | 246 // We should be able to restart the overscroll without lifting the finger. |
247 generator.MoveTouch(gfx::Point(touch_x + touch_start_threshold() + 1, 0)); | 247 generator.MoveTouch(gfx::Point(touch_x + touch_start_threshold() + 1, 0)); |
248 EXPECT_EQ(current_mode(), OVERSCROLL_EAST); | 248 EXPECT_EQ(current_mode(), OVERSCROLL_EAST); |
249 EXPECT_FALSE(overscroll_complete()); | 249 EXPECT_FALSE(overscroll_complete()); |
250 } | 250 } |
251 | 251 |
252 } // namespace content | 252 } // namespace content |
OLD | NEW |