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; | 15 using base::android::JavaParamRef; |
16 | 16 |
17 // static | 17 // static |
18 void AccountManagementScreenHelper::OpenAccountManagementScreen( | 18 void AccountManagementScreenHelper::OpenAccountManagementScreen( |
19 Profile* profile, | 19 Profile* profile, |
20 signin::GAIAServiceType service_type) { | 20 signin::GAIAServiceType service_type) { |
21 DCHECK(profile); | 21 DCHECK(profile); |
22 DCHECK(ProfileAndroid::FromProfile(profile)); | 22 DCHECK(ProfileAndroid::FromProfile(profile)); |
23 | 23 |
24 Java_AccountManagementScreenHelper_openAccountManagementScreen( | 24 Java_AccountManagementScreenHelper_openAccountManagementScreen( |
25 base::android::AttachCurrentThread(), | 25 base::android::AttachCurrentThread(), |
26 base::android::GetApplicationContext(), | 26 base::android::GetApplicationContext(), |
27 ProfileAndroid::FromProfile(profile)->GetJavaObject().obj(), | 27 ProfileAndroid::FromProfile(profile)->GetJavaObject(), |
28 static_cast<int>(service_type)); | 28 static_cast<int>(service_type)); |
29 } | 29 } |
30 | 30 |
31 static void LogEvent(JNIEnv* env, | 31 static void LogEvent(JNIEnv* env, |
32 const JavaParamRef<jclass>& clazz, | 32 const JavaParamRef<jclass>& clazz, |
33 jint metric, | 33 jint metric, |
34 jint gaiaServiceType) { | 34 jint gaiaServiceType) { |
35 ProfileMetrics::LogProfileAndroidAccountManagementMenu( | 35 ProfileMetrics::LogProfileAndroidAccountManagementMenu( |
36 static_cast<ProfileMetrics::ProfileAndroidAccountManagementMenu>(metric), | 36 static_cast<ProfileMetrics::ProfileAndroidAccountManagementMenu>(metric), |
37 static_cast<signin::GAIAServiceType>(gaiaServiceType)); | 37 static_cast<signin::GAIAServiceType>(gaiaServiceType)); |
38 } | 38 } |
39 | 39 |
40 // static | 40 // static |
41 bool AccountManagementScreenHelper::Register(JNIEnv* env) { | 41 bool AccountManagementScreenHelper::Register(JNIEnv* env) { |
42 return RegisterNativesImpl(env); | 42 return RegisterNativesImpl(env); |
43 } | 43 } |
OLD | NEW |