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

Unified Diff: sync/android/java/src/org/chromium/sync/signin/ChromeSigninController.java

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 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: sync/android/java/src/org/chromium/sync/signin/ChromeSigninController.java
diff --git a/sync/android/java/src/org/chromium/sync/signin/ChromeSigninController.java b/sync/android/java/src/org/chromium/sync/signin/ChromeSigninController.java
deleted file mode 100644
index e37cf1e0cb89da46029185c2a5f7216b67970a62..0000000000000000000000000000000000000000
--- a/sync/android/java/src/org/chromium/sync/signin/ChromeSigninController.java
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.sync.signin;
-
-import android.accounts.Account;
-import android.content.Context;
-
-import org.chromium.base.ContextUtils;
-import org.chromium.sync.AndroidSyncSettings;
-
-/**
- * Caches the signed-in username in the app prefs.
- */
-public class ChromeSigninController {
-
- public static final String TAG = "ChromeSigninController";
-
- // Used by ChromeBackupAgent and for testing.
- public static final String SIGNED_IN_ACCOUNT_KEY = "google.services.username";
-
- private static final Object LOCK = new Object();
-
- private static ChromeSigninController sChromeSigninController;
-
- private final Context mApplicationContext;
-
- private ChromeSigninController(Context context) {
- mApplicationContext = context.getApplicationContext();
- AndroidSyncSettings.updateAccount(context, getSignedInUser());
- }
-
- /**
- * A factory method for the ChromeSigninController.
- *
- * @param context the ApplicationContext is retrieved from the context used as an argument.
- * @return a singleton instance of the ChromeSigninController
- */
- public static ChromeSigninController get(Context context) {
- synchronized (LOCK) {
- if (sChromeSigninController == null) {
- sChromeSigninController = new ChromeSigninController(context);
- }
- }
- return sChromeSigninController;
- }
-
- public Account getSignedInUser() {
- String syncAccountName = getSignedInAccountName();
- if (syncAccountName == null) {
- return null;
- }
- return AccountManagerHelper.createAccountFromName(syncAccountName);
- }
-
- public boolean isSignedIn() {
- return getSignedInAccountName() != null;
- }
-
- public void setSignedInAccountName(String accountName) {
- ContextUtils.getAppSharedPreferences().edit()
- .putString(SIGNED_IN_ACCOUNT_KEY, accountName)
- .apply();
- // TODO(maxbogue): Move this to SigninManager.
- AndroidSyncSettings.updateAccount(mApplicationContext, getSignedInUser());
- }
-
- public String getSignedInAccountName() {
- return ContextUtils.getAppSharedPreferences().getString(SIGNED_IN_ACCOUNT_KEY, null);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698