Generate thumbnails in the browser process.

The feature is now behind --enable-in-browser-thumbnailing flag.

The in-browser thumbnailing works as follows:

- The scroll offset is sent from the renderer to the browser.
- The thumbnail is taken when the page info is sent from the renderer process.
- Since thumbnails are generated in the browser, we can avoid the generation when unnecessary (ex. off-the-record mode, or New Tab Page).
- The quality of thumbnails is as good as before, as the patch doesn't change timing heuristics.
- The drawback is that we cannot take thumbnails from background tabs.

New functions are added to ThumbnailGenerator for clipping thumbnails, with tests.

BUG=65936
TEST=add unit tests for thumbnail_generator. confirmed that the thumbnails are updated with and without --enable-in-browser-thumbnailing

Review URL: http://codereview.chromium.org/6246007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72115 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
index 7fb9e4a..ba01020 100644
--- a/chrome/renderer/render_widget.cc
+++ b/chrome/renderer/render_widget.cc
@@ -585,6 +585,7 @@
   params.resizer_rect = resizer_rect_;
   params.plugin_window_moves.swap(plugin_window_moves_);
   params.flags = next_paint_flags_;
+  params.scroll_offset = GetScrollOffset();
 
   update_reply_pending_ = true;
   Send(new ViewHostMsg_UpdateRect(routing_id_, params));
@@ -920,6 +921,11 @@
   return NULL;
 }
 
+gfx::Size RenderWidget::GetScrollOffset() {
+  // Bare RenderWidgets don't support scroll offset.
+  return gfx::Size(0, 0);
+}
+
 void RenderWidget::SetHidden(bool hidden) {
   if (is_hidden_ == hidden)
     return;