Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index 729ad00d4d98500be5a662f65e12eb2d5cc1599b..5f0bf108c12f20f3645fb43f04ac8c1def9d394e 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -594,6 +594,7 @@ RenderViewImpl::RenderViewImpl( |
#endif |
session_storage_namespace_id_(session_storage_namespace_id), |
handling_select_range_(false), |
+ next_snapshot_id_(0), |
#if defined(OS_WIN) |
focused_plugin_id_(-1), |
#endif |
@@ -1007,6 +1008,8 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
#endif |
IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB, |
OnReleaseDisambiguationPopupDIB) |
+ IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, |
+ OnWindowSnapshotCompleted) |
// Have the super handle all other messages. |
IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
@@ -1713,6 +1716,20 @@ bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { |
return Send(message); |
} |
+void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { |
+ int id = next_smooth_scroll_gesture_id_++; |
Ken Russell (switch to Gerrit)
2012/11/08 22:27:44
Typo: next_smooth_scroll_gesture_id_ -> next_snaps
|
+ pending_snapshots_.insert(std::make_pair(id, callback)); |
+ Send(new ViewHostMsg_GetWindowSnapshot(routing_id_, id)); |
+} |
+ |
+void RenderViewImpl::OnWindowSnapshotCompleted(const int snapshot_id, |
+ const gfx::Size& size, const std::vector<unsigned char>& png) { |
+ PendingSnapshotMap::iterator it = pending_snapshots_.find(snapshot_id); |
+ DCHECK(it != pending_snapshots_.end()); |
+ it->second.Run(size, png); |
+ pending_snapshots_.erase(it); |
+} |
+ |
// WebKit::WebViewClient ------------------------------------------------------ |
WebView* RenderViewImpl::createView( |