Index: content/browser/web_contents/navigation_controller_impl.cc |
diff --git a/content/browser/web_contents/navigation_controller_impl.cc b/content/browser/web_contents/navigation_controller_impl.cc |
index f6f87d5a70448b3792a687d6b8264048281b4e40..150ff546a5cfae2a4d1983677ea9147ca86a9c03 100644 |
--- a/content/browser/web_contents/navigation_controller_impl.cc |
+++ b/content/browser/web_contents/navigation_controller_impl.cc |
@@ -493,6 +493,9 @@ void NavigationControllerImpl::TakeScreenshot() { |
if (!view) |
return; |
+ if (!take_screenshot_callback_.is_null()) |
+ take_screenshot_callback_.Run(render_view_host); |
+ |
skia::PlatformBitmap* temp_bitmap = new skia::PlatformBitmap; |
render_view_host->CopyFromBackingStore(gfx::Rect(), |
view->GetViewBounds().size(), |
@@ -753,12 +756,6 @@ void NavigationControllerImpl::DocumentLoadedInFrame() { |
bool NavigationControllerImpl::RendererDidNavigate( |
const ViewHostMsg_FrameNavigate_Params& params, |
LoadCommittedDetails* details) { |
- // When navigating away from the current page, take a screenshot of it in the |
- // current state so that it can be used during an overscroll-navigation |
- // gesture. |
- if (details->is_main_frame) |
- TakeScreenshot(); |
- |
// Save the previous state before we clobber it. |
if (GetLastCommittedEntry()) { |
details->previous_url = GetLastCommittedEntry()->GetURL(); |
@@ -1683,4 +1680,9 @@ void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
get_timestamp_callback_ = get_timestamp_callback; |
} |
+void NavigationControllerImpl::SetTakeScreenshotCallbackForTest( |
+ const base::Callback<void(RenderViewHost*)>& take_screenshot_callback) { |
+ take_screenshot_callback_ = take_screenshot_callback; |
+} |
+ |
} // namespace content |