OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 bool overscroll_completed() const { | 66 bool overscroll_completed() const { |
67 return completed_; | 67 return completed_; |
68 } | 68 } |
69 | 69 |
70 void Reset() { | 70 void Reset() { |
71 count_ = 0; | 71 count_ = 0; |
72 completed_ = false; | 72 completed_ = false; |
73 } | 73 } |
74 | 74 |
75 private: | 75 private: |
76 virtual bool CanOverscrollContent() const OVERRIDE { | 76 virtual bool CanOverscrollContent() const override { |
77 return true; | 77 return true; |
78 } | 78 } |
79 | 79 |
80 virtual void OverscrollUpdate(int delta_y) OVERRIDE { | 80 virtual void OverscrollUpdate(int delta_y) override { |
81 ++count_; | 81 ++count_; |
82 } | 82 } |
83 | 83 |
84 virtual void OverscrollComplete() OVERRIDE { | 84 virtual void OverscrollComplete() override { |
85 completed_ = true; | 85 completed_ = true; |
86 } | 86 } |
87 | 87 |
88 int count_; | 88 int count_; |
89 bool completed_; | 89 bool completed_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(VerticalOverscrollTracker); | 91 DISALLOW_COPY_AND_ASSIGN(VerticalOverscrollTracker); |
92 }; | 92 }; |
93 | 93 |
94 } //namespace | 94 } //namespace |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 message_loop_runner_->Run(); | 126 message_loop_runner_->Run(); |
127 } | 127 } |
128 | 128 |
129 bool ScreenshotSetForEntry(NavigationEntryImpl* entry) const { | 129 bool ScreenshotSetForEntry(NavigationEntryImpl* entry) const { |
130 return screenshot_set_.count(entry) > 0; | 130 return screenshot_set_.count(entry) > 0; |
131 } | 131 } |
132 | 132 |
133 private: | 133 private: |
134 // Overridden from NavigationEntryScreenshotManager: | 134 // Overridden from NavigationEntryScreenshotManager: |
135 virtual void TakeScreenshotImpl(RenderViewHost* host, | 135 virtual void TakeScreenshotImpl(RenderViewHost* host, |
136 NavigationEntryImpl* entry) OVERRIDE { | 136 NavigationEntryImpl* entry) override { |
137 ++waiting_for_screenshots_; | 137 ++waiting_for_screenshots_; |
138 screenshot_taken_for_ = host; | 138 screenshot_taken_for_ = host; |
139 NavigationEntryScreenshotManager::TakeScreenshotImpl(host, entry); | 139 NavigationEntryScreenshotManager::TakeScreenshotImpl(host, entry); |
140 } | 140 } |
141 | 141 |
142 virtual void OnScreenshotSet(NavigationEntryImpl* entry) OVERRIDE { | 142 virtual void OnScreenshotSet(NavigationEntryImpl* entry) override { |
143 --waiting_for_screenshots_; | 143 --waiting_for_screenshots_; |
144 screenshot_set_[entry] = true; | 144 screenshot_set_[entry] = true; |
145 NavigationEntryScreenshotManager::OnScreenshotSet(entry); | 145 NavigationEntryScreenshotManager::OnScreenshotSet(entry); |
146 if (waiting_for_screenshots_ == 0 && message_loop_runner_.get()) | 146 if (waiting_for_screenshots_ == 0 && message_loop_runner_.get()) |
147 message_loop_runner_->Quit(); | 147 message_loop_runner_->Quit(); |
148 } | 148 } |
149 | 149 |
150 RenderViewHost* screenshot_taken_for_; | 150 RenderViewHost* screenshot_taken_for_; |
151 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 151 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
152 int waiting_for_screenshots_; | 152 int waiting_for_screenshots_; |
(...skipping 14 matching lines...) Expand all Loading... |
167 | 167 |
168 void WaitUntilNavigationStarts() { | 168 void WaitUntilNavigationStarts() { |
169 if (navigated_) | 169 if (navigated_) |
170 return; | 170 return; |
171 should_quit_loop_ = true; | 171 should_quit_loop_ = true; |
172 base::MessageLoop::current()->Run(); | 172 base::MessageLoop::current()->Run(); |
173 } | 173 } |
174 | 174 |
175 private: | 175 private: |
176 // Overridden from WebContentsObserver: | 176 // Overridden from WebContentsObserver: |
177 virtual void AboutToNavigateRenderView(RenderViewHost* host) OVERRIDE { | 177 virtual void AboutToNavigateRenderView(RenderViewHost* host) override { |
178 navigated_ = true; | 178 navigated_ = true; |
179 if (should_quit_loop_) | 179 if (should_quit_loop_) |
180 base::MessageLoop::current()->Quit(); | 180 base::MessageLoop::current()->Quit(); |
181 } | 181 } |
182 | 182 |
183 bool navigated_; | 183 bool navigated_; |
184 bool should_quit_loop_; | 184 bool should_quit_loop_; |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(NavigationWatcher); | 186 DISALLOW_COPY_AND_ASSIGN(NavigationWatcher); |
187 }; | 187 }; |
(...skipping 20 matching lines...) Expand all Loading... |
208 private: | 208 private: |
209 void ReceivedEventAck(blink::WebInputEvent::Type type, | 209 void ReceivedEventAck(blink::WebInputEvent::Type type, |
210 InputEventAckState state) { | 210 InputEventAckState state) { |
211 if (type_ == type) { | 211 if (type_ == type) { |
212 state_ = state; | 212 state_ = state; |
213 quit_.Run(); | 213 quit_.Run(); |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 // BrowserMessageFilter: | 217 // BrowserMessageFilter: |
218 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 218 virtual bool OnMessageReceived(const IPC::Message& message) override { |
219 if (message.type() == InputHostMsg_HandleInputEvent_ACK::ID) { | 219 if (message.type() == InputHostMsg_HandleInputEvent_ACK::ID) { |
220 InputHostMsg_HandleInputEvent_ACK::Param params; | 220 InputHostMsg_HandleInputEvent_ACK::Param params; |
221 InputHostMsg_HandleInputEvent_ACK::Read(&message, ¶ms); | 221 InputHostMsg_HandleInputEvent_ACK::Read(&message, ¶ms); |
222 blink::WebInputEvent::Type type = params.a.type; | 222 blink::WebInputEvent::Type type = params.a.type; |
223 InputEventAckState ack = params.a.state; | 223 InputEventAckState ack = params.a.state; |
224 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 224 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
225 base::Bind(&InputEventMessageFilterWaitsForAcks::ReceivedEventAck, | 225 base::Bind(&InputEventMessageFilterWaitsForAcks::ReceivedEventAck, |
226 this, type, ack)); | 226 this, type, ack)); |
227 } | 227 } |
228 return false; | 228 return false; |
(...skipping 28 matching lines...) Expand all Loading... |
257 NavigateToURL(shell(), test_url); | 257 NavigateToURL(shell(), test_url); |
258 | 258 |
259 WebContentsImpl* web_contents = | 259 WebContentsImpl* web_contents = |
260 static_cast<WebContentsImpl*>(shell()->web_contents()); | 260 static_cast<WebContentsImpl*>(shell()->web_contents()); |
261 NavigationControllerImpl* controller = &web_contents->GetController(); | 261 NavigationControllerImpl* controller = &web_contents->GetController(); |
262 | 262 |
263 screenshot_manager_ = new ScreenshotTracker(controller); | 263 screenshot_manager_ = new ScreenshotTracker(controller); |
264 controller->SetScreenshotManager(screenshot_manager_); | 264 controller->SetScreenshotManager(screenshot_manager_); |
265 } | 265 } |
266 | 266 |
267 virtual void SetUpCommandLine(CommandLine* cmd) OVERRIDE { | 267 virtual void SetUpCommandLine(CommandLine* cmd) override { |
268 cmd->AppendSwitchASCII(switches::kTouchEvents, | 268 cmd->AppendSwitchASCII(switches::kTouchEvents, |
269 switches::kTouchEventsEnabled); | 269 switches::kTouchEventsEnabled); |
270 } | 270 } |
271 | 271 |
272 void TestOverscrollNavigation(bool touch_handler) { | 272 void TestOverscrollNavigation(bool touch_handler) { |
273 ASSERT_NO_FATAL_FAILURE( | 273 ASSERT_NO_FATAL_FAILURE( |
274 StartTestWithPage("files/overscroll_navigation.html")); | 274 StartTestWithPage("files/overscroll_navigation.html")); |
275 WebContentsImpl* web_contents = | 275 WebContentsImpl* web_contents = |
276 static_cast<WebContentsImpl*>(shell()->web_contents()); | 276 static_cast<WebContentsImpl*>(shell()->web_contents()); |
277 NavigationController& controller = web_contents->GetController(); | 277 NavigationController& controller = web_contents->GetController(); |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 details = dispatcher->OnEventFromSource(&release); | 1148 details = dispatcher->OnEventFromSource(&release); |
1149 ASSERT_FALSE(details.dispatcher_destroyed); | 1149 ASSERT_FALSE(details.dispatcher_destroyed); |
1150 WaitAFrame(); | 1150 WaitAFrame(); |
1151 | 1151 |
1152 EXPECT_LT(0, tracker.num_overscroll_updates()); | 1152 EXPECT_LT(0, tracker.num_overscroll_updates()); |
1153 EXPECT_FALSE(tracker.overscroll_completed()); | 1153 EXPECT_FALSE(tracker.overscroll_completed()); |
1154 } | 1154 } |
1155 } | 1155 } |
1156 | 1156 |
1157 } // namespace content | 1157 } // namespace content |
OLD | NEW |