Skip to content

Commit

Permalink
jni: Pass method parameters as JavaParamRef in printing.
Browse files Browse the repository at this point in the history
Pass all object parameters to JNI methods in JavaParamRef<> wrappers.
This matches previous changes made to do this for JNI non-method
functions.

BUG=519562
R=avayvod@chromium.org

Review URL: https://codereview.chromium.org/1477783002

Cr-Commit-Position: refs/heads/master@{#361696}
  • Loading branch information
tornewuff authored and Commit bot committed Nov 25, 2015
1 parent ea9b0ba commit 6f3f097
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 7 additions & 5 deletions printing/printing_context_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ void PrintingContextAndroid::AskUserForSettings(
}
}

void PrintingContextAndroid::AskUserForSettingsReply(JNIEnv* env,
jobject obj,
jboolean success) {
void PrintingContextAndroid::AskUserForSettingsReply(
JNIEnv* env,
const JavaParamRef<jobject>& obj,
jboolean success) {
if (!success) {
// TODO(cimamoglu): Differentiate between FAILED And CANCEL.
callback_.Run(FAILED);
Expand Down Expand Up @@ -137,8 +138,9 @@ void PrintingContextAndroid::AskUserForSettingsReply(JNIEnv* env,
callback_.Run(OK);
}

void PrintingContextAndroid::ShowSystemDialogDone(JNIEnv* env,
jobject obj) {
void PrintingContextAndroid::ShowSystemDialogDone(
JNIEnv* env,
const JavaParamRef<jobject>& obj) {
// Settings are not updated, callback is called only to unblock javascript.
callback_.Run(CANCEL);
}
Expand Down
7 changes: 5 additions & 2 deletions printing/printing_context_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext {

// Called from Java, when printing settings from the user are ready or the
// printing operation is canceled.
void AskUserForSettingsReply(JNIEnv* env, jobject obj, jboolean success);
void AskUserForSettingsReply(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jboolean success);

// Called from Java, when a printing process initiated by a script finishes.
void ShowSystemDialogDone(JNIEnv* env, jobject obj);
void ShowSystemDialogDone(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);

// PrintingContext implementation.
void AskUserForSettings(int max_pages,
Expand Down

0 comments on commit 6f3f097

Please sign in to comment.