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

Side by Side Diff: components/sync/android/java/src/org/chromium/components/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, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.sync.signin; 5 package org.chromium.components.sync.signin;
6 6
7 import android.accounts.Account; 7 import android.accounts.Account;
8 import android.content.Context; 8 import android.content.Context;
9 9
10 import org.chromium.base.ContextUtils; 10 import org.chromium.base.ContextUtils;
11 import org.chromium.sync.AndroidSyncSettings; 11 import org.chromium.components.sync.AndroidSyncSettings;
12 12
13 /** 13 /**
14 * Caches the signed-in username in the app prefs. 14 * Caches the signed-in username in the app prefs.
15 */ 15 */
16 public class ChromeSigninController { 16 public class ChromeSigninController {
17
18 public static final String TAG = "ChromeSigninController"; 17 public static final String TAG = "ChromeSigninController";
19 18
20 // Used by ChromeBackupAgent and for testing. 19 // Used by ChromeBackupAgent and for testing.
21 public static final String SIGNED_IN_ACCOUNT_KEY = "google.services.username "; 20 public static final String SIGNED_IN_ACCOUNT_KEY = "google.services.username ";
22 21
23 private static final Object LOCK = new Object(); 22 private static final Object LOCK = new Object();
24 23
25 private static ChromeSigninController sChromeSigninController; 24 private static ChromeSigninController sChromeSigninController;
26 25
27 private final Context mApplicationContext; 26 private final Context mApplicationContext;
(...skipping 24 matching lines...) Expand all
52 return null; 51 return null;
53 } 52 }
54 return AccountManagerHelper.createAccountFromName(syncAccountName); 53 return AccountManagerHelper.createAccountFromName(syncAccountName);
55 } 54 }
56 55
57 public boolean isSignedIn() { 56 public boolean isSignedIn() {
58 return getSignedInAccountName() != null; 57 return getSignedInAccountName() != null;
59 } 58 }
60 59
61 public void setSignedInAccountName(String accountName) { 60 public void setSignedInAccountName(String accountName) {
62 ContextUtils.getAppSharedPreferences().edit() 61 ContextUtils.getAppSharedPreferences()
62 .edit()
63 .putString(SIGNED_IN_ACCOUNT_KEY, accountName) 63 .putString(SIGNED_IN_ACCOUNT_KEY, accountName)
64 .apply(); 64 .apply();
65 // TODO(maxbogue): Move this to SigninManager. 65 // TODO(maxbogue): Move this to SigninManager.
66 AndroidSyncSettings.updateAccount(mApplicationContext, getSignedInUser() ); 66 AndroidSyncSettings.updateAccount(mApplicationContext, getSignedInUser() );
67 } 67 }
68 68
69 public String getSignedInAccountName() { 69 public String getSignedInAccountName() {
70 return ContextUtils.getAppSharedPreferences().getString(SIGNED_IN_ACCOUN T_KEY, null); 70 return ContextUtils.getAppSharedPreferences().getString(SIGNED_IN_ACCOUN T_KEY, null);
71 } 71 }
72 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698