| 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.signin; | 5 package org.chromium.chrome.browser.signin; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.FragmentManager; | 8 import android.app.FragmentManager; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 private AccountSigninConfirmationView mSigninConfirmationView; | 123 private AccountSigninConfirmationView mSigninConfirmationView; |
| 124 private ImageView mSigninAccountImage; | 124 private ImageView mSigninAccountImage; |
| 125 private TextView mSigninAccountName; | 125 private TextView mSigninAccountName; |
| 126 private TextView mSigninAccountEmail; | 126 private TextView mSigninAccountEmail; |
| 127 private TextView mSigninPersonalizeServiceDescription; | 127 private TextView mSigninPersonalizeServiceDescription; |
| 128 private TextView mSigninSettingsControl; | 128 private TextView mSigninSettingsControl; |
| 129 | 129 |
| 130 public AccountSigninView(Context context, AttributeSet attrs) { | 130 public AccountSigninView(Context context, AttributeSet attrs) { |
| 131 super(context, attrs); | 131 super(context, attrs); |
| 132 mAccountManagerHelper = AccountManagerHelper.get(); | 132 mAccountManagerHelper = AccountManagerHelper.get(getContext().getApplica
tionContext()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 /** | 135 /** |
| 136 * Initializes this view with profile data cache, delegate and listener. | 136 * Initializes this view with profile data cache, delegate and listener. |
| 137 * @param profileData ProfileDataCache that will be used to call to retrieve
user account info. | 137 * @param profileData ProfileDataCache that will be used to call to retrieve
user account info. |
| 138 * @param delegate The UI object creation delegate. | 138 * @param delegate The UI object creation delegate. |
| 139 * @param listener The account selection event listener. | 139 * @param listener The account selection event listener. |
| 140 */ | 140 */ |
| 141 public void init(ProfileDataCache profileData, Delegate delegate, Listener l
istener) { | 141 public void init(ProfileDataCache profileData, Delegate delegate, Listener l
istener) { |
| 142 mProfileData = profileData; | 142 mProfileData = profileData; |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 SpanApplier.applySpans(getSettingsControlDescription(mIsChildAcc
ount), | 441 SpanApplier.applySpans(getSettingsControlDescription(mIsChildAcc
ount), |
| 442 new SpanInfo(SETTINGS_LINK_OPEN, SETTINGS_LINK_CLOSE, se
ttingsSpan))); | 442 new SpanInfo(SETTINGS_LINK_OPEN, SETTINGS_LINK_CLOSE, se
ttingsSpan))); |
| 443 } | 443 } |
| 444 | 444 |
| 445 private void showConfirmSigninPageAccountTrackerServiceCheck() { | 445 private void showConfirmSigninPageAccountTrackerServiceCheck() { |
| 446 // Disable the buttons to prevent them being clicked again while waiting
for the callbacks. | 446 // Disable the buttons to prevent them being clicked again while waiting
for the callbacks. |
| 447 setButtonsEnabled(false); | 447 setButtonsEnabled(false); |
| 448 | 448 |
| 449 // Ensure that the AccountTrackerService has a fully up to date GAIA id
<-> email mapping, | 449 // Ensure that the AccountTrackerService has a fully up to date GAIA id
<-> email mapping, |
| 450 // as this is needed for the previous account check. | 450 // as this is needed for the previous account check. |
| 451 if (AccountTrackerService.get().checkAndSeedSystemAccounts()) { | 451 if (AccountTrackerService.get(getContext()).checkAndSeedSystemAccounts()
) { |
| 452 showConfirmSigninPagePreviousAccountCheck(); | 452 showConfirmSigninPagePreviousAccountCheck(); |
| 453 } else { | 453 } else { |
| 454 AccountTrackerService.get().addSystemAccountsSeededListener( | 454 AccountTrackerService.get(getContext()).addSystemAccountsSeededListe
ner( |
| 455 new OnSystemAccountsSeededListener() { | 455 new OnSystemAccountsSeededListener() { |
| 456 @Override | 456 @Override |
| 457 public void onSystemAccountsSeedingComplete() { | 457 public void onSystemAccountsSeedingComplete() { |
| 458 AccountTrackerService.get().removeSystemAccountsSeed
edListener(this); | 458 AccountTrackerService.get(getContext()) |
| 459 .removeSystemAccountsSeededListener(this); |
| 459 showConfirmSigninPagePreviousAccountCheck(); | 460 showConfirmSigninPagePreviousAccountCheck(); |
| 460 } | 461 } |
| 461 | 462 |
| 462 @Override | 463 @Override |
| 463 public void onSystemAccountsChanged() {} | 464 public void onSystemAccountsChanged() {} |
| 464 }); | 465 }); |
| 465 } | 466 } |
| 466 } | 467 } |
| 467 | 468 |
| 468 private void showConfirmSigninPagePreviousAccountCheck() { | 469 private void showConfirmSigninPagePreviousAccountCheck() { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 * @return Whether the view is in "no choice, just a confirmation" forced-ac
count mode. | 629 * @return Whether the view is in "no choice, just a confirmation" forced-ac
count mode. |
| 629 */ | 630 */ |
| 630 public boolean isInForcedAccountMode() { | 631 public boolean isInForcedAccountMode() { |
| 631 return mForcedAccountName != null; | 632 return mForcedAccountName != null; |
| 632 } | 633 } |
| 633 | 634 |
| 634 private String getSelectedAccountName() { | 635 private String getSelectedAccountName() { |
| 635 return mAccountNames.get(mSigninChooseView.getSelectedAccountPosition())
; | 636 return mAccountNames.get(mSigninChooseView.getSelectedAccountPosition())
; |
| 636 } | 637 } |
| 637 } | 638 } |
| OLD | NEW |