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