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

Side by Side Diff: chrome/browser/android/feedback/screenshot_task.cc

Issue 2592983002: [devtools] Support different encodings for Page.CaptureScreenshot. (Closed)
Patch Set: Disabled test on MacOS >=10.11, added ref to bug. Created 3 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 | chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/android/feedback/screenshot_task.h" 5 #include "chrome/browser/android/feedback/screenshot_task.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 13 matching lines...) Expand all
24 24
25 namespace chrome { 25 namespace chrome {
26 namespace android { 26 namespace android {
27 27
28 bool RegisterScreenshotTask(JNIEnv* env) { 28 bool RegisterScreenshotTask(JNIEnv* env) {
29 return RegisterNativesImpl(env); 29 return RegisterNativesImpl(env);
30 } 30 }
31 31
32 void SnapshotCallback(JNIEnv* env, 32 void SnapshotCallback(JNIEnv* env,
33 const JavaRef<jobject>& callback, 33 const JavaRef<jobject>& callback,
34 scoped_refptr<base::RefCountedBytes> png_data) { 34 scoped_refptr<base::RefCountedMemory> png_data) {
35 jbyteArray jbytes = nullptr; 35 jbyteArray jbytes = nullptr;
36 if (png_data.get()) { 36 if (png_data.get()) {
37 size_t size = png_data->size(); 37 size_t size = png_data->size();
38 jbytes = env->NewByteArray(size); 38 jbytes = env->NewByteArray(size);
39 env->SetByteArrayRegion(jbytes, 0, size, (jbyte*) png_data->front()); 39 env->SetByteArrayRegion(jbytes, 0, size, (jbyte*) png_data->front());
40 } 40 }
41 Java_ScreenshotTask_notifySnapshotFinished(env, callback, jbytes); 41 Java_ScreenshotTask_notifySnapshotFinished(env, callback, jbytes);
42 } 42 }
43 43
44 void GrabWindowSnapshotAsync(JNIEnv* env, 44 void GrabWindowSnapshotAsync(JNIEnv* env,
45 const JavaParamRef<jclass>& clazz, 45 const JavaParamRef<jclass>& clazz,
46 const JavaParamRef<jobject>& jcallback, 46 const JavaParamRef<jobject>& jcallback,
47 jlong native_window_android, 47 jlong native_window_android,
48 jint window_width, 48 jint window_width,
49 jint window_height) { 49 jint window_height) {
50 WindowAndroid* window_android = reinterpret_cast<WindowAndroid*>( 50 WindowAndroid* window_android = reinterpret_cast<WindowAndroid*>(
51 native_window_android); 51 native_window_android);
52 gfx::Rect window_bounds(window_width, window_height); 52 gfx::Rect window_bounds(window_width, window_height);
53 ui::GrabWindowSnapshotAsync( 53 ui::GrabWindowSnapshotAsyncPNG(
54 window_android, window_bounds, base::ThreadTaskRunnerHandle::Get(), 54 window_android, window_bounds, base::ThreadTaskRunnerHandle::Get(),
55 base::Bind(&SnapshotCallback, env, 55 base::Bind(&SnapshotCallback, env,
56 ScopedJavaGlobalRef<jobject>(env, jcallback))); 56 ScopedJavaGlobalRef<jobject>(env, jcallback)));
57 } 57 }
58 58
59 } // namespace android 59 } // namespace android
60 } // namespace chrome 60 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698