1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/android/intent_helper.h"
9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h"
11 #include "base/android/scoped_java_ref.h"
12 #include "jni/IntentHelper_jni.h"
14 using base::android::AttachCurrentThread
;
15 using base::android::ConvertUTF16ToJavaString
;
20 void SendEmail(const base::string16
& d_email
,
21 const base::string16
& d_subject
,
22 const base::string16
& d_body
,
23 const base::string16
& d_chooser_title
,
24 const base::string16
& d_file_to_attach
) {
25 JNIEnv
* env
= AttachCurrentThread();
26 ScopedJavaLocalRef
<jstring
> j_email
= ConvertUTF16ToJavaString(env
, d_email
);
27 ScopedJavaLocalRef
<jstring
> j_subject
=
28 ConvertUTF16ToJavaString(env
, d_subject
);
29 ScopedJavaLocalRef
<jstring
> j_body
= ConvertUTF16ToJavaString(env
, d_body
);
30 ScopedJavaLocalRef
<jstring
> j_chooser_title
=
31 ConvertUTF16ToJavaString(env
, d_chooser_title
);
32 ScopedJavaLocalRef
<jstring
> j_file_to_attach
=
33 ConvertUTF16ToJavaString(env
, d_file_to_attach
);
34 Java_IntentHelper_sendEmail(env
,
35 base::android::GetApplicationContext(),
39 j_chooser_title
.obj(),
40 j_file_to_attach
.obj());
43 void OpenDateAndTimeSettings() {
44 JNIEnv
* env
= AttachCurrentThread();
45 Java_IntentHelper_openDateAndTimeSettings(env
,
46 base::android::GetApplicationContext());
49 bool RegisterIntentHelper(JNIEnv
* env
) {
50 return RegisterNativesImpl(env
);
53 } // namespace android