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.ui; | 5 package org.chromium.chrome.browser.sync.ui; |
6 | 6 |
7 import android.accounts.Account; | 7 import android.accounts.Account; |
8 import android.app.DialogFragment; | 8 import android.app.DialogFragment; |
9 import android.app.FragmentManager; | 9 import android.app.FragmentManager; |
10 import android.app.FragmentTransaction; | 10 import android.app.FragmentTransaction; |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 * @param error The sync error. | 672 * @param error The sync error. |
673 */ | 673 */ |
674 private String getSyncErrorHint(@SyncError int error) { | 674 private String getSyncErrorHint(@SyncError int error) { |
675 Resources res = getActivity().getResources(); | 675 Resources res = getActivity().getResources(); |
676 switch (error) { | 676 switch (error) { |
677 case SYNC_ANDROID_SYNC_DISABLED: | 677 case SYNC_ANDROID_SYNC_DISABLED: |
678 return res.getString(R.string.hint_android_sync_disabled); | 678 return res.getString(R.string.hint_android_sync_disabled); |
679 case SYNC_AUTH_ERROR: | 679 case SYNC_AUTH_ERROR: |
680 return res.getString(R.string.hint_sync_auth_error); | 680 return res.getString(R.string.hint_sync_auth_error); |
681 case SYNC_CLIENT_OUT_OF_DATE: | 681 case SYNC_CLIENT_OUT_OF_DATE: |
682 return res.getString( | 682 return res.getString(R.string.hint_client_out_of_date, BuildInfo
.getPackageLabel()); |
683 R.string.hint_client_out_of_date, BuildInfo.getPackageLa
bel(getActivity())); | |
684 case SYNC_OTHER_ERRORS: | 683 case SYNC_OTHER_ERRORS: |
685 return res.getString(R.string.hint_other_sync_errors); | 684 return res.getString(R.string.hint_other_sync_errors); |
686 case SYNC_PASSPHRASE_REQUIRED: | 685 case SYNC_PASSPHRASE_REQUIRED: |
687 return res.getString(R.string.hint_passphrase_required); | 686 return res.getString(R.string.hint_passphrase_required); |
688 case SYNC_NO_ERROR: | 687 case SYNC_NO_ERROR: |
689 default: | 688 default: |
690 return null; | 689 return null; |
691 } | 690 } |
692 } | 691 } |
693 | 692 |
(...skipping 17 matching lines...) Expand all Loading... |
711 if (mCurrentSyncError == SYNC_AUTH_ERROR) { | 710 if (mCurrentSyncError == SYNC_AUTH_ERROR) { |
712 AccountManagerHelper.get(getActivity()) | 711 AccountManagerHelper.get(getActivity()) |
713 .updateCredentials(ChromeSigninController.get(getActivity())
.getSignedInUser(), | 712 .updateCredentials(ChromeSigninController.get(getActivity())
.getSignedInUser(), |
714 getActivity(), null); | 713 getActivity(), null); |
715 return; | 714 return; |
716 } | 715 } |
717 | 716 |
718 if (mCurrentSyncError == SYNC_CLIENT_OUT_OF_DATE) { | 717 if (mCurrentSyncError == SYNC_CLIENT_OUT_OF_DATE) { |
719 // Opens the client in play store for update. | 718 // Opens the client in play store for update. |
720 Intent intent = new Intent(Intent.ACTION_VIEW); | 719 Intent intent = new Intent(Intent.ACTION_VIEW); |
721 intent.setData( | 720 intent.setData(Uri.parse("market://details?id=" + BuildInfo.getPacka
geName())); |
722 Uri.parse("market://details?id=" + BuildInfo.getPackageName(
getActivity()))); | |
723 startActivity(intent); | 721 startActivity(intent); |
724 return; | 722 return; |
725 } | 723 } |
726 | 724 |
727 if (mCurrentSyncError == SYNC_OTHER_ERRORS) { | 725 if (mCurrentSyncError == SYNC_OTHER_ERRORS) { |
728 final Account account = ChromeSigninController.get(getActivity()).ge
tSignedInUser(); | 726 final Account account = ChromeSigninController.get(getActivity()).ge
tSignedInUser(); |
729 SigninManager.get(getActivity()).signOut(new Runnable() { | 727 SigninManager.get(getActivity()).signOut(new Runnable() { |
730 @Override | 728 @Override |
731 public void run() { | 729 public void run() { |
732 SigninManager.get(getActivity()).signIn(account, null, null)
; | 730 SigninManager.get(getActivity()).signIn(account, null, null)
; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 } | 780 } |
783 | 781 |
784 private void stopSync() { | 782 private void stopSync() { |
785 if (mProfileSyncService.isSyncRequested()) { | 783 if (mProfileSyncService.isSyncRequested()) { |
786 RecordHistogram.recordEnumeratedHistogram("Sync.StopSource", | 784 RecordHistogram.recordEnumeratedHistogram("Sync.StopSource", |
787 StopSource.CHROME_SYNC_SETTINGS, StopSource.STOP_SOURCE_LIMI
T); | 785 StopSource.CHROME_SYNC_SETTINGS, StopSource.STOP_SOURCE_LIMI
T); |
788 mProfileSyncService.requestStop(); | 786 mProfileSyncService.requestStop(); |
789 } | 787 } |
790 } | 788 } |
791 } | 789 } |
OLD | NEW |