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

Side by Side Diff: components/test_runner/pixel_dump.cc

Issue 1836973003: Move download messages from Renderer to Frame filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments, merge Created 4 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/test_runner/pixel_dump.h" 5 #include "components/test_runner/pixel_dump.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "components/test_runner/layout_test_runtime_flags.h" 15 #include "components/test_runner/layout_test_runtime_flags.h"
16 // FIXME: Including platform_canvas.h here is a layering violation. 16 // FIXME: Including platform_canvas.h here is a layering violation.
17 #include "skia/ext/platform_canvas.h" 17 #include "skia/ext/platform_canvas.h"
18 #include "third_party/WebKit/public/platform/Platform.h" 18 #include "third_party/WebKit/public/platform/Platform.h"
19 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac k.h" 19 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac k.h"
20 #include "third_party/WebKit/public/platform/WebImage.h" 20 #include "third_party/WebKit/public/platform/WebImage.h"
21 #include "third_party/WebKit/public/platform/WebMockClipboard.h" 21 #include "third_party/WebKit/public/platform/WebMockClipboard.h"
22 #include "third_party/WebKit/public/platform/WebPoint.h" 22 #include "third_party/WebKit/public/platform/WebPoint.h"
23 #include "third_party/WebKit/public/web/WebFrame.h" 23 #include "third_party/WebKit/public/web/WebFrame.h"
24 #include "third_party/WebKit/public/web/WebLocalFrame.h"
24 #include "third_party/WebKit/public/web/WebPagePopup.h" 25 #include "third_party/WebKit/public/web/WebPagePopup.h"
25 #include "third_party/WebKit/public/web/WebPrintParams.h" 26 #include "third_party/WebKit/public/web/WebPrintParams.h"
26 #include "third_party/WebKit/public/web/WebView.h" 27 #include "third_party/WebKit/public/web/WebView.h"
27 #include "ui/gfx/geometry/point.h" 28 #include "ui/gfx/geometry/point.h"
28 29
29 namespace test_runner { 30 namespace test_runner {
30 31
31 namespace { 32 namespace {
32 33
33 struct PixelsDumpRequest { 34 struct PixelsDumpRequest {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 179
179 void CopyImageAtAndCapturePixels( 180 void CopyImageAtAndCapturePixels(
180 blink::WebView* web_view, 181 blink::WebView* web_view,
181 int x, 182 int x,
182 int y, 183 int y,
183 const base::Callback<void(const SkBitmap&)>& callback) { 184 const base::Callback<void(const SkBitmap&)>& callback) {
184 DCHECK(!callback.is_null()); 185 DCHECK(!callback.is_null());
185 uint64_t sequence_number = 186 uint64_t sequence_number =
186 blink::Platform::current()->clipboard()->sequenceNumber( 187 blink::Platform::current()->clipboard()->sequenceNumber(
187 blink::WebClipboard::Buffer()); 188 blink::WebClipboard::Buffer());
188 web_view->copyImageAt(blink::WebPoint(x, y)); 189 // TODO(lukasza): Support image capture in OOPIFs for
190 // https://crbug.com/477150.
191 web_view->mainFrame()->toWebLocalFrame()->copyImageAt(blink::WebPoint(x, y));
189 if (sequence_number == 192 if (sequence_number ==
190 blink::Platform::current()->clipboard()->sequenceNumber( 193 blink::Platform::current()->clipboard()->sequenceNumber(
191 blink::WebClipboard::Buffer())) { 194 blink::WebClipboard::Buffer())) {
192 SkBitmap emptyBitmap; 195 SkBitmap emptyBitmap;
193 callback.Run(emptyBitmap); 196 callback.Run(emptyBitmap);
194 return; 197 return;
195 } 198 }
196 199
197 blink::WebImage image = static_cast<blink::WebMockClipboard*>( 200 blink::WebImage image = static_cast<blink::WebMockClipboard*>(
198 blink::Platform::current()->clipboard()) 201 blink::Platform::current()->clipboard())
199 ->readRawImage(blink::WebClipboard::Buffer()); 202 ->readRawImage(blink::WebClipboard::Buffer());
200 const SkBitmap& bitmap = image.getSkBitmap(); 203 const SkBitmap& bitmap = image.getSkBitmap();
201 SkAutoLockPixels autoLock(bitmap); 204 SkAutoLockPixels autoLock(bitmap);
202 callback.Run(bitmap); 205 callback.Run(bitmap);
203 } 206 }
204 207
205 } // namespace test_runner 208 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/renderer_context_menu/render_view_context_menu_base.h ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698