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 "chrome/browser/android/signin/signin_manager_android.h" | 5 #include "chrome/browser/android/signin/signin_manager_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 16 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
17 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 17 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
19 #include "chrome/browser/signin/android_profile_oauth2_token_service.h" | 19 #include "chrome/browser/signin/android_profile_oauth2_token_service.h" |
20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
21 #include "chrome/browser/signin/signin_manager_factory.h" | 21 #include "chrome/browser/signin/signin_manager_factory.h" |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "components/bookmarks/browser/bookmark_model.h" | 23 #include "components/bookmarks/browser/bookmark_model.h" |
24 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 24 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
25 #include "components/signin/core/browser/signin_manager.h" | 25 #include "components/signin/core/browser/signin_manager.h" |
| 26 #include "components/signin/core/browser/signin_metrics.h" |
26 #include "components/signin/core/common/profile_management_switches.h" | 27 #include "components/signin/core/common/profile_management_switches.h" |
27 #include "jni/SigninManager_jni.h" | 28 #include "jni/SigninManager_jni.h" |
28 | 29 |
29 #if defined(ENABLE_CONFIGURATION_POLICY) | 30 #if defined(ENABLE_CONFIGURATION_POLICY) |
30 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 31 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
31 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" | 32 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" |
32 #include "chrome/browser/policy/cloud/user_policy_signin_service_mobile.h" | 33 #include "chrome/browser/policy/cloud/user_policy_signin_service_mobile.h" |
33 #include "components/policy/core/browser/browser_policy_connector.h" | 34 #include "components/policy/core/browser/browser_policy_connector.h" |
34 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 35 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
35 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 36 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 127 } |
127 | 128 |
128 void SigninManagerAndroid::OnSignInCompleted(JNIEnv* env, | 129 void SigninManagerAndroid::OnSignInCompleted(JNIEnv* env, |
129 jobject obj, | 130 jobject obj, |
130 jstring username) { | 131 jstring username) { |
131 SigninManagerFactory::GetForProfile(profile_)->OnExternalSigninCompleted( | 132 SigninManagerFactory::GetForProfile(profile_)->OnExternalSigninCompleted( |
132 base::android::ConvertJavaStringToUTF8(env, username)); | 133 base::android::ConvertJavaStringToUTF8(env, username)); |
133 } | 134 } |
134 | 135 |
135 void SigninManagerAndroid::SignOut(JNIEnv* env, jobject obj) { | 136 void SigninManagerAndroid::SignOut(JNIEnv* env, jobject obj) { |
136 SigninManagerFactory::GetForProfile(profile_)->SignOut(); | 137 SigninManagerFactory::GetForProfile(profile_)->SignOut( |
| 138 signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS); |
137 } | 139 } |
138 | 140 |
139 base::android::ScopedJavaLocalRef<jstring> | 141 base::android::ScopedJavaLocalRef<jstring> |
140 SigninManagerAndroid::GetManagementDomain(JNIEnv* env, jobject obj) { | 142 SigninManagerAndroid::GetManagementDomain(JNIEnv* env, jobject obj) { |
141 base::android::ScopedJavaLocalRef<jstring> domain; | 143 base::android::ScopedJavaLocalRef<jstring> domain; |
142 | 144 |
143 #if defined(ENABLE_CONFIGURATION_POLICY) | 145 #if defined(ENABLE_CONFIGURATION_POLICY) |
144 policy::UserCloudPolicyManager* manager = | 146 policy::UserCloudPolicyManager* manager = |
145 policy::UserCloudPolicyManagerFactory::GetForBrowserContext(profile_); | 147 policy::UserCloudPolicyManagerFactory::GetForBrowserContext(profile_); |
146 policy::CloudPolicyStore* store = manager->core()->store(); | 148 policy::CloudPolicyStore* store = manager->core()->store(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 270 } |
269 | 271 |
270 static jboolean IsNewProfileManagementEnabled(JNIEnv* env, jclass clazz) { | 272 static jboolean IsNewProfileManagementEnabled(JNIEnv* env, jclass clazz) { |
271 return switches::IsNewProfileManagement(); | 273 return switches::IsNewProfileManagement(); |
272 } | 274 } |
273 | 275 |
274 // static | 276 // static |
275 bool SigninManagerAndroid::Register(JNIEnv* env) { | 277 bool SigninManagerAndroid::Register(JNIEnv* env) { |
276 return RegisterNativesImpl(env); | 278 return RegisterNativesImpl(env); |
277 } | 279 } |
OLD | NEW |