Thumbnails: Capture just before navigating away

Hidden behind new feature CaptureThumbnailOnNavigatingAway.

This is very similar to what NavigationEntryScreenshotManager does.
Hopefully this is a better time for capturing screenshots than when a
page load finishes (see crbug.com/737396 and crbug.com/741856).

Bug: 718413
Change-Id: I0fbcc7964b9f89c7ce589a197ac85b85a41385ba
Reviewed-on: https://chromium-review.googlesource.com/570318
Reviewed-by: Friedrich Horschig <[email protected]>
Commit-Queue: Marc Treib <[email protected]>
Cr-Commit-Position: refs/heads/master@{#486729}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 906f9d4..8d5d90f50 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -3182,6 +3182,12 @@
      flag_descriptions::kAsyncImageDecodingDescription, kOsAll,
      MULTI_VALUE_TYPE(kAsyncImageDecodingChoices)},
 
+    {"capture-thumbnail-on-navigating-away",
+     flag_descriptions::kCaptureThumbnailOnNavigatingAwayName,
+     flag_descriptions::kCaptureThumbnailOnNavigatingAwayDescription,
+     kOsDesktop,
+     FEATURE_VALUE_TYPE(features::kCaptureThumbnailOnNavigatingAway)},
+
     // NOTE: Adding new command-line switches requires adding corresponding
     // entries to enum "LoginCustomFlags" in histograms/enums.xml. See note in
     // enums.xml and don't forget to run AboutFlagsHistogramTest unit test.