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/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 image_delegate_ = NULL; | 201 image_delegate_ = NULL; |
202 if (overlay_dismiss_layer.get()) { | 202 if (overlay_dismiss_layer.get()) { |
203 // OverlayDismissAnimator deletes overlay_dismiss_layer and itself when the | 203 // OverlayDismissAnimator deletes overlay_dismiss_layer and itself when the |
204 // animation completes. | 204 // animation completes. |
205 (new OverlayDismissAnimator(overlay_dismiss_layer.Pass()))->Animate(); | 205 (new OverlayDismissAnimator(overlay_dismiss_layer.Pass()))->Animate(); |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 ui::Layer* OverscrollNavigationOverlay::CreateSlideLayer(int offset) { | 209 ui::Layer* OverscrollNavigationOverlay::CreateSlideLayer(int offset) { |
210 const NavigationControllerImpl& controller = web_contents_->GetController(); | 210 const NavigationControllerImpl& controller = web_contents_->GetController(); |
211 const NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( | 211 const NavigationEntryImpl* entry = controller.GetEntryAtOffset(offset); |
212 controller.GetEntryAtOffset(offset)); | |
213 | 212 |
214 gfx::Image image; | 213 gfx::Image image; |
215 if (entry && entry->screenshot().get()) { | 214 if (entry && entry->screenshot().get()) { |
216 std::vector<gfx::ImagePNGRep> image_reps; | 215 std::vector<gfx::ImagePNGRep> image_reps; |
217 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), 1.0f)); | 216 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), 1.0f)); |
218 image = gfx::Image(image_reps); | 217 image = gfx::Image(image_reps); |
219 } | 218 } |
220 if (!layer_delegate_) | 219 if (!layer_delegate_) |
221 layer_delegate_.reset(new ImageLayerDelegate()); | 220 layer_delegate_.reset(new ImageLayerDelegate()); |
222 layer_delegate_->SetImage(image); | 221 layer_delegate_->SetImage(image); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 306 |
308 void OverscrollNavigationOverlay::DidStopLoading(RenderViewHost* host) { | 307 void OverscrollNavigationOverlay::DidStopLoading(RenderViewHost* host) { |
309 // Don't compare URLs in this case - it's possible they won't match if | 308 // Don't compare URLs in this case - it's possible they won't match if |
310 // a gesture-nav initiated navigation was interrupted by some other in-site | 309 // a gesture-nav initiated navigation was interrupted by some other in-site |
311 // navigation ((e.g., from a script, or from a bookmark). | 310 // navigation ((e.g., from a script, or from a bookmark). |
312 loading_complete_ = true; | 311 loading_complete_ = true; |
313 StopObservingIfDone(); | 312 StopObservingIfDone(); |
314 } | 313 } |
315 | 314 |
316 } // namespace content | 315 } // namespace content |
OLD | NEW |