Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java

Issue 2784353002: Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Fix tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java
index 6bcee905c0065125a0330633871252e029e26edc..02524a3eff9ae053424ab0871d196b7a853c15d7 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java
@@ -183,7 +183,7 @@ public class AccountManagementFragment extends PreferenceFragment
* @param profile Profile to use.
*/
private static void startFetchingAccountsInformation(Context context, Profile profile) {
- Account[] accounts = AccountManagerHelper.get(context).getGoogleAccounts();
+ Account[] accounts = AccountManagerHelper.get().getGoogleAccounts();
for (int i = 0; i < accounts.length; i++) {
startFetchingAccountInformation(context, profile, accounts[i].name);
}
@@ -195,7 +195,7 @@ public class AccountManagementFragment extends PreferenceFragment
if (getPreferenceScreen() != null) getPreferenceScreen().removeAll();
- ChromeSigninController signInController = ChromeSigninController.get(context);
+ ChromeSigninController signInController = ChromeSigninController.get();
if (!signInController.isSignedIn()) {
// The AccountManagementFragment can only be shown when the user is signed in. If the
// user is signed out, exit the fragment.
@@ -205,8 +205,7 @@ public class AccountManagementFragment extends PreferenceFragment
addPreferencesFromResource(R.xml.account_management_preferences);
- String signedInAccountName =
- ChromeSigninController.get(getActivity()).getSignedInAccountName();
+ String signedInAccountName = ChromeSigninController.get().getSignedInAccountName();
String fullName = getCachedUserName(signedInAccountName);
if (TextUtils.isEmpty(fullName)) {
fullName = ProfileDownloader.getCachedFullName(Profile.getLastUsedProfile());
@@ -246,7 +245,7 @@ public class AccountManagementFragment extends PreferenceFragment
public boolean onPreferenceClick(Preference preference) {
if (!isVisible() || !isResumed()) return false;
- if (ChromeSigninController.get(getActivity()).isSignedIn()
+ if (ChromeSigninController.get().isSignedIn()
&& getSignOutAllowedPreferenceValue(getActivity())) {
AccountManagementScreenHelper.logEvent(
ProfileAccountManagementMetrics.TOGGLE_SIGNOUT,
@@ -282,7 +281,7 @@ public class AccountManagementFragment extends PreferenceFragment
private void configureSyncSettings() {
final Preferences preferences = (Preferences) getActivity();
- final Account account = ChromeSigninController.get(getActivity()).getSignedInUser();
+ final Account account = ChromeSigninController.get().getSignedInUser();
findPreference(PREF_SYNC_SETTINGS)
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
@@ -310,7 +309,7 @@ public class AccountManagementFragment extends PreferenceFragment
public boolean onPreferenceClick(Preference preference) {
Activity activity = getActivity();
AppHooks.get().createGoogleActivityController().openWebAndAppActivitySettings(
- activity, ChromeSigninController.get(activity).getSignedInAccountName());
+ activity, ChromeSigninController.get().getSignedInAccountName());
RecordUserAction.record("Signin_AccountSettings_GoogleActivityControlsClicked");
return true;
}
@@ -416,7 +415,7 @@ public class AccountManagementFragment extends PreferenceFragment
mAccountsListPreferences.clear();
final Preferences activity = (Preferences) getActivity();
- Account[] accounts = AccountManagerHelper.get(activity).getGoogleAccounts();
+ Account[] accounts = AccountManagerHelper.get().getGoogleAccounts();
int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER;
for (Account account : accounts) {
@@ -475,7 +474,7 @@ public class AccountManagementFragment extends PreferenceFragment
public void onSignOutClicked() {
// In case the user reached this fragment without being signed in, we guard the sign out so
// we do not hit a native crash.
- if (!ChromeSigninController.get(getActivity()).isSignedIn()) return;
+ if (!ChromeSigninController.get().isSignedIn()) return;
final Activity activity = getActivity();
final DialogFragment clearDataProgressDialog = new ClearDataProgressDialog();
@@ -543,18 +542,15 @@ public class AccountManagementFragment extends PreferenceFragment
/**
* Open the account management UI.
- * @param applicationContext An application context.
- * @param profile A user profile.
* @param serviceType A signin::GAIAServiceType that triggered the dialog.
*/
- public static void openAccountManagementScreen(
- Context applicationContext, Profile profile, int serviceType) {
- Intent intent = PreferencesLauncher.createIntentForSettingsPage(applicationContext,
- AccountManagementFragment.class.getName());
+ public static void openAccountManagementScreen(int serviceType) {
+ Intent intent = PreferencesLauncher.createIntentForSettingsPage(
+ ContextUtils.getApplicationContext(), AccountManagementFragment.class.getName());
Bundle arguments = new Bundle();
arguments.putInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, serviceType);
intent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, arguments);
- applicationContext.startActivity(intent);
+ ContextUtils.getApplicationContext().startActivity(intent);
}
/**
@@ -700,7 +696,7 @@ public class AccountManagementFragment extends PreferenceFragment
* @param profile A profile to use.
*/
public static void prefetchUserNamePicture(Context context, Profile profile) {
- final String accountName = ChromeSigninController.get(context).getSignedInAccountName();
+ final String accountName = ChromeSigninController.get().getSignedInAccountName();
if (TextUtils.isEmpty(accountName)) return;
if (sToNamePicture.get(accountName) != null) return;

Powered by Google App Engine
This is Rietveld 408576698