| Index: content/browser/renderer_host/render_view_host_impl.cc
|
| diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
|
| index 19ddc20c593639086de0675ad7b0b35c47ed898b..68c5102ff0a14b84fb1f3fb513c74c64db264b4d 100644
|
| --- a/content/browser/renderer_host/render_view_host_impl.cc
|
| +++ b/content/browser/renderer_host/render_view_host_impl.cc
|
| @@ -52,6 +52,7 @@
|
| #include "content/public/browser/notification_types.h"
|
| #include "content/public/browser/render_view_host_observer.h"
|
| #include "content/public/browser/user_metrics.h"
|
| +#include "content/public/browser/window_util.h"
|
| #include "content/public/common/bindings_policy.h"
|
| #include "content/public/common/content_constants.h"
|
| #include "content/public/common/content_switches.h"
|
| @@ -1028,6 +1029,7 @@ bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) {
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse)
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL)
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_MediaNotification, OnMediaNotification)
|
| + IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowSnapshot, OnGetWindowSnapshot)
|
| #if defined(OS_ANDROID)
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent)
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeBodyBackgroundColor,
|
| @@ -2036,4 +2038,29 @@ void RenderViewHostImpl::ClearPowerSaveBlockers() {
|
| STLDeleteValues(&power_save_blockers_);
|
| }
|
|
|
| +void RenderViewHostImpl::OnGetWindowSnapshot(const int id) {
|
| + std::vector<unsigned char> png;
|
| +
|
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
| + if (command_line.HasSwitch(switches::kEnableGpuBenchmarking)) {
|
| + gfx::Size snapshot_size;
|
| + gfx::Rect view_bounds = GetView()->GetViewBounds();
|
| + gfx::Rect snapshot_bounds(
|
| + 0, 0, view_bounds.width(), view_bounds.height());
|
| +
|
| + snapshot_size.SetSize(snapshot_bounds.width(),
|
| + snapshot_bounds.height());
|
| +
|
| + if (content::GrabViewSnapshot(GetView()->GetNativeView(),
|
| + &png, snapshot_bounds)) {
|
| + Send(new ViewMsg_WindowSnapshotCompleted(
|
| + GetRoutingID(), id, snapshot_size, png));
|
| + return;
|
| + }
|
| + }
|
| +
|
| + Send(new ViewMsg_WindowSnapshotCompleted(
|
| + GetRoutingID(), id, gfx::Size(), png));
|
| +}
|
| +
|
| } // namespace content
|
|
|