OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/signin/account_management_screen_helper.h" | 5 #include "chrome/browser/android/signin/account_management_screen_helper.h" |
6 | 6 |
7 #include "base/android/context_utils.h" | 7 #include "base/android/context_utils.h" |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/profiles/profile_android.h" | 11 #include "chrome/browser/profiles/profile_android.h" |
12 #include "chrome/browser/profiles/profile_metrics.h" | 12 #include "chrome/browser/profiles/profile_metrics.h" |
13 #include "jni/AccountManagementScreenHelper_jni.h" | 13 #include "jni/AccountManagementScreenHelper_jni.h" |
14 | 14 |
| 15 using base::android::JavaParamRef; |
| 16 |
15 // static | 17 // static |
16 void AccountManagementScreenHelper::OpenAccountManagementScreen( | 18 void AccountManagementScreenHelper::OpenAccountManagementScreen( |
17 Profile* profile, | 19 Profile* profile, |
18 signin::GAIAServiceType service_type) { | 20 signin::GAIAServiceType service_type) { |
19 DCHECK(profile); | 21 DCHECK(profile); |
20 DCHECK(ProfileAndroid::FromProfile(profile)); | 22 DCHECK(ProfileAndroid::FromProfile(profile)); |
21 | 23 |
22 Java_AccountManagementScreenHelper_openAccountManagementScreen( | 24 Java_AccountManagementScreenHelper_openAccountManagementScreen( |
23 base::android::AttachCurrentThread(), | 25 base::android::AttachCurrentThread(), |
24 base::android::GetApplicationContext(), | 26 base::android::GetApplicationContext(), |
25 ProfileAndroid::FromProfile(profile)->GetJavaObject().obj(), | 27 ProfileAndroid::FromProfile(profile)->GetJavaObject().obj(), |
26 static_cast<int>(service_type)); | 28 static_cast<int>(service_type)); |
27 } | 29 } |
28 | 30 |
29 static void LogEvent(JNIEnv* env, | 31 static void LogEvent(JNIEnv* env, |
30 const JavaParamRef<jclass>& clazz, | 32 const JavaParamRef<jclass>& clazz, |
31 jint metric, | 33 jint metric, |
32 jint gaiaServiceType) { | 34 jint gaiaServiceType) { |
33 ProfileMetrics::LogProfileAndroidAccountManagementMenu( | 35 ProfileMetrics::LogProfileAndroidAccountManagementMenu( |
34 static_cast<ProfileMetrics::ProfileAndroidAccountManagementMenu>(metric), | 36 static_cast<ProfileMetrics::ProfileAndroidAccountManagementMenu>(metric), |
35 static_cast<signin::GAIAServiceType>(gaiaServiceType)); | 37 static_cast<signin::GAIAServiceType>(gaiaServiceType)); |
36 } | 38 } |
37 | 39 |
38 // static | 40 // static |
39 bool AccountManagementScreenHelper::Register(JNIEnv* env) { | 41 bool AccountManagementScreenHelper::Register(JNIEnv* env) { |
40 return RegisterNativesImpl(env); | 42 return RegisterNativesImpl(env); |
41 } | 43 } |
OLD | NEW |