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/browser/signin_metrics.h" |
27 #include "components/signin/core/common/profile_management_switches.h" | 27 #include "components/signin/core/common/profile_management_switches.h" |
| 28 #include "google_apis/gaia/gaia_constants.h" |
28 #include "jni/SigninManager_jni.h" | 29 #include "jni/SigninManager_jni.h" |
29 | 30 |
30 #if defined(ENABLE_CONFIGURATION_POLICY) | 31 #if defined(ENABLE_CONFIGURATION_POLICY) |
31 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 32 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
32 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" | 33 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" |
33 #include "chrome/browser/policy/cloud/user_policy_signin_service_mobile.h" | 34 #include "chrome/browser/policy/cloud/user_policy_signin_service_mobile.h" |
34 #include "components/policy/core/browser/browser_policy_connector.h" | 35 #include "components/policy/core/browser/browser_policy_connector.h" |
35 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 36 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
36 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 37 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
37 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 38 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 245 |
245 } else { | 246 } else { |
246 DVLOG(1) << "SigninManagerAndroid::LogInSignedInUser " | 247 DVLOG(1) << "SigninManagerAndroid::LogInSignedInUser " |
247 " Manually calling MergeSessionHelper"; | 248 " Manually calling MergeSessionHelper"; |
248 // Old code path that doesn't depend on the new Account Reconcilor. | 249 // Old code path that doesn't depend on the new Account Reconcilor. |
249 // We manually login. | 250 // We manually login. |
250 | 251 |
251 ProfileOAuth2TokenService* token_service = | 252 ProfileOAuth2TokenService* token_service = |
252 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); | 253 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
253 merge_session_helper_.reset(new MergeSessionHelper( | 254 merge_session_helper_.reset(new MergeSessionHelper( |
254 token_service, profile_->GetRequestContext(), this)); | 255 token_service, GaiaConstants::kChromeSource, |
| 256 profile_->GetRequestContext(), this)); |
255 merge_session_helper_->LogIn(signin_manager->GetAuthenticatedAccountId()); | 257 merge_session_helper_->LogIn(signin_manager->GetAuthenticatedAccountId()); |
256 } | 258 } |
257 } | 259 } |
258 | 260 |
259 jboolean SigninManagerAndroid::IsSigninAllowedByPolicy(JNIEnv* env, | 261 jboolean SigninManagerAndroid::IsSigninAllowedByPolicy(JNIEnv* env, |
260 jobject obj) { | 262 jobject obj) { |
261 return SigninManagerFactory::GetForProfile(profile_)->IsSigninAllowed(); | 263 return SigninManagerFactory::GetForProfile(profile_)->IsSigninAllowed(); |
262 } | 264 } |
263 | 265 |
264 void SigninManagerAndroid::OnSigninAllowedPrefChanged() { | 266 void SigninManagerAndroid::OnSigninAllowedPrefChanged() { |
(...skipping 21 matching lines...) Expand all Loading... |
286 } | 288 } |
287 | 289 |
288 static jboolean IsNewProfileManagementEnabled(JNIEnv* env, jclass clazz) { | 290 static jboolean IsNewProfileManagementEnabled(JNIEnv* env, jclass clazz) { |
289 return switches::IsNewProfileManagement(); | 291 return switches::IsNewProfileManagement(); |
290 } | 292 } |
291 | 293 |
292 // static | 294 // static |
293 bool SigninManagerAndroid::Register(JNIEnv* env) { | 295 bool SigninManagerAndroid::Register(JNIEnv* env) { |
294 return RegisterNativesImpl(env); | 296 return RegisterNativesImpl(env); |
295 } | 297 } |
OLD | NEW |