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

Side by Side Diff: content/browser/devtools/renderer_overrides_handler.cc

Issue 143683003: Support format using enum argument for Async readback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code changes as per review. Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/render_widget_host_view_child_frame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/devtools/renderer_overrides_handler.h" 5 #include "content/browser/devtools/renderer_overrides_handler.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/barrier_closure.h" 10 #include "base/barrier_closure.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 gfx::Rect view_bounds = host->GetView()->GetViewBounds(); 198 gfx::Rect view_bounds = host->GetView()->GetViewBounds();
199 gfx::Size snapshot_size = gfx::ToFlooredSize( 199 gfx::Size snapshot_size = gfx::ToFlooredSize(
200 gfx::ScaleSize(view_bounds.size(), scale)); 200 gfx::ScaleSize(view_bounds.size(), scale));
201 201
202 view_port->CopyFromCompositingSurface( 202 view_port->CopyFromCompositingSurface(
203 view_bounds, snapshot_size, 203 view_bounds, snapshot_size,
204 base::Bind(&RendererOverridesHandler::ScreenshotCaptured, 204 base::Bind(&RendererOverridesHandler::ScreenshotCaptured,
205 weak_factory_.GetWeakPtr(), 205 weak_factory_.GetWeakPtr(),
206 scoped_refptr<DevToolsProtocol::Command>(), format, quality, 206 scoped_refptr<DevToolsProtocol::Command>(), format, quality,
207 last_compositor_frame_metadata_), 207 last_compositor_frame_metadata_),
208 false); 208 SkBitmap::kARGB_8888_Config);
209 } 209 }
210 210
211 void RendererOverridesHandler::ParseCaptureParameters( 211 void RendererOverridesHandler::ParseCaptureParameters(
212 DevToolsProtocol::Command* command, 212 DevToolsProtocol::Command* command,
213 std::string* format, 213 std::string* format,
214 int* quality, 214 int* quality,
215 double* scale) { 215 double* scale) {
216 *quality = kDefaultScreenshotQuality; 216 *quality = kDefaultScreenshotQuality;
217 *scale = 1; 217 *scale = 1;
218 double max_width = -1; 218 double max_width = -1;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 455
456 // Fallback to copying from compositing surface. 456 // Fallback to copying from compositing surface.
457 RenderWidgetHostViewPort* view_port = 457 RenderWidgetHostViewPort* view_port =
458 RenderWidgetHostViewPort::FromRWHV(host->GetView()); 458 RenderWidgetHostViewPort::FromRWHV(host->GetView());
459 459
460 view_port->CopyFromCompositingSurface( 460 view_port->CopyFromCompositingSurface(
461 view_bounds, snapshot_size, 461 view_bounds, snapshot_size,
462 base::Bind(&RendererOverridesHandler::ScreenshotCaptured, 462 base::Bind(&RendererOverridesHandler::ScreenshotCaptured,
463 weak_factory_.GetWeakPtr(), command, format, quality, 463 weak_factory_.GetWeakPtr(), command, format, quality,
464 last_compositor_frame_metadata_), 464 last_compositor_frame_metadata_),
465 false); 465 SkBitmap::kARGB_8888_Config);
466 return command->AsyncResponsePromise(); 466 return command->AsyncResponsePromise();
467 } 467 }
468 468
469 scoped_refptr<DevToolsProtocol::Response> 469 scoped_refptr<DevToolsProtocol::Response>
470 RendererOverridesHandler::PageCanScreencast( 470 RendererOverridesHandler::PageCanScreencast(
471 scoped_refptr<DevToolsProtocol::Command> command) { 471 scoped_refptr<DevToolsProtocol::Command> command) {
472 base::DictionaryValue* result = new base::DictionaryValue(); 472 base::DictionaryValue* result = new base::DictionaryValue();
473 #if defined(OS_ANDROID) 473 #if defined(OS_ANDROID)
474 result->SetBoolean(devtools::kResult, true); 474 result->SetBoolean(devtools::kResult, true);
475 #else 475 #else
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 return NULL; 972 return NULL;
973 } 973 }
974 event.data.pinchUpdate.scale = static_cast<float>(scale); 974 event.data.pinchUpdate.scale = static_cast<float>(scale);
975 } 975 }
976 976
977 host->ForwardGestureEvent(event); 977 host->ForwardGestureEvent(event);
978 return command->SuccessResponse(NULL); 978 return command->SuccessResponse(NULL);
979 } 979 }
980 980
981 } // namespace content 981 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_widget_host_view_child_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698