| 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" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 const std::vector<std::string>& ids = token_service->GetAccounts(); | 217 const std::vector<std::string>& ids = token_service->GetAccounts(); |
| 218 token_service->ValidateAccounts(primary_acct, ids); | 218 token_service->ValidateAccounts(primary_acct, ids); |
| 219 | 219 |
| 220 } else { | 220 } else { |
| 221 DVLOG(1) << "SigninManagerAndroid::LogInSignedInUser " | 221 DVLOG(1) << "SigninManagerAndroid::LogInSignedInUser " |
| 222 " Manually calling GoogleAutoLoginHelper"; | 222 " Manually calling GoogleAutoLoginHelper"; |
| 223 // Old code path that doesn't depend on the new Account Reconcilor. | 223 // Old code path that doesn't depend on the new Account Reconcilor. |
| 224 // We manually login. | 224 // We manually login. |
| 225 | 225 |
| 226 // AutoLogin deletes itself. | 226 // AutoLogin deletes itself. |
| 227 ProfileOAuth2TokenService* token_service = |
| 228 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
| 227 GoogleAutoLoginHelper* autoLogin = new GoogleAutoLoginHelper(profile_); | 229 GoogleAutoLoginHelper* autoLogin = new GoogleAutoLoginHelper(profile_); |
| 228 autoLogin->LogIn(); | 230 autoLogin->LogIn(token_service->GetPrimaryAccountId()); |
| 229 } | 231 } |
| 230 } | 232 } |
| 231 | 233 |
| 232 static jlong Init(JNIEnv* env, jobject obj) { | 234 static jlong Init(JNIEnv* env, jobject obj) { |
| 233 SigninManagerAndroid* signin_manager_android = | 235 SigninManagerAndroid* signin_manager_android = |
| 234 new SigninManagerAndroid(env, obj); | 236 new SigninManagerAndroid(env, obj); |
| 235 return reinterpret_cast<intptr_t>(signin_manager_android); | 237 return reinterpret_cast<intptr_t>(signin_manager_android); |
| 236 } | 238 } |
| 237 | 239 |
| 238 static jboolean ShouldLoadPolicyForUser(JNIEnv* env, | 240 static jboolean ShouldLoadPolicyForUser(JNIEnv* env, |
| 239 jobject obj, | 241 jobject obj, |
| 240 jstring j_username) { | 242 jstring j_username) { |
| 241 #if defined(ENABLE_CONFIGURATION_POLICY) | 243 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 242 std::string username = | 244 std::string username = |
| 243 base::android::ConvertJavaStringToUTF8(env, j_username); | 245 base::android::ConvertJavaStringToUTF8(env, j_username); |
| 244 return !policy::BrowserPolicyConnector::IsNonEnterpriseUser(username); | 246 return !policy::BrowserPolicyConnector::IsNonEnterpriseUser(username); |
| 245 #else | 247 #else |
| 246 return false; | 248 return false; |
| 247 #endif | 249 #endif |
| 248 } | 250 } |
| 249 | 251 |
| 250 // static | 252 // static |
| 251 bool SigninManagerAndroid::Register(JNIEnv* env) { | 253 bool SigninManagerAndroid::Register(JNIEnv* env) { |
| 252 return RegisterNativesImpl(env); | 254 return RegisterNativesImpl(env); |
| 253 } | 255 } |
| OLD | NEW |