OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_navigation_overlay.h" | 5 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" |
6 | 6 |
7 #include "content/browser/frame_host/navigation_entry_impl.h" | 7 #include "content/browser/frame_host/navigation_entry_impl.h" |
8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
9 #include "content/browser/web_contents/aura/image_window_delegate.h" | 9 #include "content/browser/web_contents/aura/image_window_delegate.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 // we don't need to do anything. | 294 // we don't need to do anything. |
295 // This check prevents StopObservingIfDone() being called multiple times | 295 // This check prevents StopObservingIfDone() being called multiple times |
296 // (including recursively) for a single event. | 296 // (including recursively) for a single event. |
297 if (window_slider_.get()) { | 297 if (window_slider_.get()) { |
298 // The slider has just been destroyed. Release the ownership. | 298 // The slider has just been destroyed. Release the ownership. |
299 WindowSlider* slider ALLOW_UNUSED = window_slider_.release(); | 299 WindowSlider* slider ALLOW_UNUSED = window_slider_.release(); |
300 StopObservingIfDone(); | 300 StopObservingIfDone(); |
301 } | 301 } |
302 } | 302 } |
303 | 303 |
304 void OverscrollNavigationOverlay::DocumentOnLoadCompletedInMainFrame( | 304 void OverscrollNavigationOverlay::DocumentOnLoadCompletedInMainFrame() { |
305 int32 page_id) { | |
306 // Use the last committed entry rather than the active one, in case a | 305 // Use the last committed entry rather than the active one, in case a |
307 // pending entry has been created. | 306 // pending entry has been created. |
308 int committed_entry_id = | 307 int committed_entry_id = |
309 web_contents_->GetController().GetLastCommittedEntry()->GetUniqueID(); | 308 web_contents_->GetController().GetLastCommittedEntry()->GetUniqueID(); |
310 // Consider the loading completed once the main frame has loaded. | 309 // Consider the loading completed once the main frame has loaded. |
311 if (committed_entry_id == pending_entry_id_ || !pending_entry_id_) { | 310 if (committed_entry_id == pending_entry_id_ || !pending_entry_id_) { |
312 loading_complete_ = true; | 311 loading_complete_ = true; |
313 StopObservingIfDone(); | 312 StopObservingIfDone(); |
314 } | 313 } |
315 } | 314 } |
316 | 315 |
317 void OverscrollNavigationOverlay::DidFirstVisuallyNonEmptyPaint(int32 page_id) { | 316 void OverscrollNavigationOverlay::DidFirstVisuallyNonEmptyPaint() { |
318 int visible_entry_id = | 317 int visible_entry_id = |
319 web_contents_->GetController().GetVisibleEntry()->GetUniqueID(); | 318 web_contents_->GetController().GetVisibleEntry()->GetUniqueID(); |
320 if (visible_entry_id == pending_entry_id_ || !pending_entry_id_) { | 319 if (visible_entry_id == pending_entry_id_ || !pending_entry_id_) { |
321 received_paint_update_ = true; | 320 received_paint_update_ = true; |
322 StopObservingIfDone(); | 321 StopObservingIfDone(); |
323 } | 322 } |
324 } | 323 } |
325 | 324 |
326 void OverscrollNavigationOverlay::DidStopLoading(RenderViewHost* host) { | 325 void OverscrollNavigationOverlay::DidStopLoading(RenderViewHost* host) { |
327 // Use the last committed entry rather than the active one, in case a | 326 // Use the last committed entry rather than the active one, in case a |
(...skipping 14 matching lines...) Expand all Loading... |
342 bool OverscrollNavigationOverlay::OnMessageReceived( | 341 bool OverscrollNavigationOverlay::OnMessageReceived( |
343 const IPC::Message& message) { | 342 const IPC::Message& message) { |
344 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 343 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
345 IPC_BEGIN_MESSAGE_MAP(OverscrollNavigationOverlay, message) | 344 IPC_BEGIN_MESSAGE_MAP(OverscrollNavigationOverlay, message) |
346 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) | 345 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) |
347 IPC_END_MESSAGE_MAP() | 346 IPC_END_MESSAGE_MAP() |
348 return false; | 347 return false; |
349 } | 348 } |
350 | 349 |
351 } // namespace content | 350 } // namespace content |
OLD | NEW |