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