Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: content/browser/web_contents/navigation_controller_impl.cc

Issue 11776010: overscroll: Take a screenshot at more appropriate times. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « content/browser/web_contents/navigation_controller_impl.h ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698