OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "printing/printing_context_android.h" | 5 #include "printing/printing_context_android.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 int max_pages, | 84 int max_pages, |
85 bool has_selection, | 85 bool has_selection, |
86 const PrintSettingsCallback& callback) { | 86 const PrintSettingsCallback& callback) { |
87 // This method is always run in the UI thread. | 87 // This method is always run in the UI thread. |
88 callback_ = callback; | 88 callback_ = callback; |
89 | 89 |
90 JNIEnv* env = base::android::AttachCurrentThread(); | 90 JNIEnv* env = base::android::AttachCurrentThread(); |
91 if (j_printing_context_.is_null()) { | 91 if (j_printing_context_.is_null()) { |
92 j_printing_context_.Reset(Java_PrintingContext_create( | 92 j_printing_context_.Reset(Java_PrintingContext_create( |
93 env, | 93 env, |
94 base::android::GetApplicationContext(), | |
95 reinterpret_cast<int>(this))); | 94 reinterpret_cast<int>(this))); |
96 } | 95 } |
97 | 96 |
98 Java_PrintingContext_pageCountEstimationDone(env, | 97 Java_PrintingContext_pageCountEstimationDone(env, |
99 j_printing_context_.obj(), | 98 j_printing_context_.obj(), |
100 max_pages); | 99 max_pages); |
101 } | 100 } |
102 | 101 |
103 void PrintingContextAndroid::AskUserForSettingsReply(JNIEnv* env, | 102 void PrintingContextAndroid::AskUserForSettingsReply(JNIEnv* env, |
104 jobject obj, | 103 jobject obj, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // Intentional No-op. | 237 // Intentional No-op. |
239 return NULL; | 238 return NULL; |
240 } | 239 } |
241 | 240 |
242 // static | 241 // static |
243 bool PrintingContextAndroid::RegisterPrintingContext(JNIEnv* env) { | 242 bool PrintingContextAndroid::RegisterPrintingContext(JNIEnv* env) { |
244 return RegisterNativesImpl(env); | 243 return RegisterNativesImpl(env); |
245 } | 244 } |
246 | 245 |
247 } // namespace printing | 246 } // namespace printing |
OLD | NEW |