OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package org.chromium.chrome.browser.sync; | 5 package org.chromium.chrome.browser.sync; |
6 | 6 |
7 import android.accounts.Account; | 7 import android.accounts.Account; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.util.Log; | 10 import android.util.Log; |
11 | 11 |
12 import org.chromium.base.ThreadUtils; | 12 import org.chromium.base.ThreadUtils; |
| 13 import org.chromium.base.VisibleForTesting; |
13 import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory
; | 14 import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory
; |
14 import org.chromium.chrome.browser.invalidation.InvalidationController; | 15 import org.chromium.chrome.browser.invalidation.InvalidationController; |
15 import org.chromium.chrome.browser.signin.AccountManagementFragment; | 16 import org.chromium.chrome.browser.signin.AccountManagementFragment; |
16 import org.chromium.chrome.browser.signin.SigninManager; | 17 import org.chromium.chrome.browser.signin.SigninManager; |
17 import org.chromium.chrome.browser.signin.SigninManager.SignInFlowObserver; | 18 import org.chromium.chrome.browser.signin.SigninManager.SignInFlowObserver; |
18 import org.chromium.chrome.browser.sync.ui.PassphraseActivity; | 19 import org.chromium.chrome.browser.sync.ui.PassphraseActivity; |
19 import org.chromium.sync.AndroidSyncSettings; | 20 import org.chromium.sync.AndroidSyncSettings; |
20 import org.chromium.sync.signin.AccountManagerHelper; | 21 import org.chromium.sync.signin.AccountManagerHelper; |
21 import org.chromium.sync.signin.ChromeSigninController; | 22 import org.chromium.sync.signin.ChromeSigninController; |
22 | 23 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 93 |
93 /** | 94 /** |
94 * Trigger Chromium sign in of the given account. | 95 * Trigger Chromium sign in of the given account. |
95 * | 96 * |
96 * This also ensure that sync setup is not in progress anymore, so sync will
start after | 97 * This also ensure that sync setup is not in progress anymore, so sync will
start after |
97 * sync initialization has happened. | 98 * sync initialization has happened. |
98 * | 99 * |
99 * @param activity the current activity. | 100 * @param activity the current activity. |
100 * @param accountName the full account name. | 101 * @param accountName the full account name. |
101 */ | 102 */ |
| 103 @VisibleForTesting |
102 public void signIn(Activity activity, String accountName) { | 104 public void signIn(Activity activity, String accountName) { |
103 final Account account = AccountManagerHelper.createAccountFromName(accou
ntName); | 105 final Account account = AccountManagerHelper.createAccountFromName(accou
ntName); |
104 | 106 |
105 // The SigninManager handles most of the sign-in flow, and doFinishSignI
n handles the | 107 // The SigninManager handles most of the sign-in flow, and doFinishSignI
n handles the |
106 // ChromeShell specific details. | 108 // ChromeShell specific details. |
107 SigninManager signinManager = SigninManager.get(mContext); | 109 SigninManager signinManager = SigninManager.get(mContext); |
108 signinManager.onFirstRunCheckDone(); | 110 signinManager.onFirstRunCheckDone(); |
109 final boolean passive = false; | 111 final boolean passive = false; |
110 signinManager.startSignIn(activity, account, passive, new SignInFlowObse
rver() { | 112 signinManager.startSignIn(activity, account, passive, new SignInFlowObse
rver() { |
111 @Override | 113 @Override |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 }); | 201 }); |
200 } | 202 } |
201 | 203 |
202 /** | 204 /** |
203 * Returns the SyncNotificationController. | 205 * Returns the SyncNotificationController. |
204 */ | 206 */ |
205 public SyncNotificationController getSyncNotificationController() { | 207 public SyncNotificationController getSyncNotificationController() { |
206 return mSyncNotificationController; | 208 return mSyncNotificationController; |
207 } | 209 } |
208 } | 210 } |
OLD | NEW |