本文整理汇总了Java中org.chromium.sync.signin.ChromeSigninController.get方法的典型用法代码示例。如果您正苦于以下问题:Java ChromeSigninController.get方法的具体用法?Java ChromeSigninController.get怎么用?Java ChromeSigninController.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.chromium.sync.signin.ChromeSigninController
的用法示例。
在下文中一共展示了ChromeSigninController.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GoogleServicesManager
import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的package包/类
private GoogleServicesManager(Context context) {
try {
TraceEvent.begin("GoogleServicesManager.GoogleServicesManager");
ThreadUtils.assertOnUiThread();
// We should store the application context, as we outlive any activity which may create
// us.
mContext = context.getApplicationContext();
mChromeSigninController = ChromeSigninController.get(mContext);
mSigninHelper = SigninHelper.get(mContext);
// The sign out flow starts by clearing the signed in user in the ChromeSigninController
// on the Java side, and then performs a sign out on the native side. If there is a
// crash on the native side then the signin state may get out of sync. Make sure that
// the native side is signed out if the Java side doesn't have a currently signed in
// user.
SigninManager signinManager = SigninManager.get(mContext);
if (!mChromeSigninController.isSignedIn() && signinManager.isSignedInOnNative()) {
Log.w(TAG, "Signed in state got out of sync, forcing native sign out");
signinManager.signOut(null, null);
}
// Initialize sync.
SyncController.get(context);
ApplicationStatus.registerApplicationStateListener(this);
} finally {
TraceEvent.end("GoogleServicesManager.GoogleServicesManager");
}
}
示例2: update
import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的package包/类
public void update() {
final Context context = getActivity();
if (context == null) return;
if (getPreferenceScreen() != null) getPreferenceScreen().removeAll();
ChromeSigninController signInController = ChromeSigninController.get(context);
if (!signInController.isSignedIn()) {
// The AccountManagementFragment can only be shown when the user is signed in. If the
// user is signed out, exit the fragment.
getActivity().finish();
return;
}
addPreferencesFromResource(R.xml.account_management_preferences);
String signedInAccountName =
ChromeSigninController.get(getActivity()).getSignedInAccountName();
String fullName = getCachedUserName(signedInAccountName);
if (TextUtils.isEmpty(fullName)) {
fullName = ProfileDownloader.getCachedFullName(Profile.getLastUsedProfile());
}
if (TextUtils.isEmpty(fullName)) fullName = signedInAccountName;
getActivity().setTitle(fullName);
configureSignOutSwitch();
configureAddAccountPreference(fullName);
configureGoIncognitoPreferences(fullName);
configureChildAccountPreferences();
updateAccountsList();
}
示例3: SigninHelper
import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的package包/类
private SigninHelper(Context context) {
mContext = context;
mProfileSyncService = ProfileSyncService.get();
mSigninManager = SigninManager.get(mContext);
mOAuth2TokenService = OAuth2TokenService.getForProfile(Profile.getLastUsedProfile());
mSyncController = SyncController.get(context);
mChromeSigninController = ChromeSigninController.get(mContext);
}
示例4: SyncController
import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的package包/类
private SyncController(Context context) {
mContext = context;
mChromeSigninController = ChromeSigninController.get(mContext);
AndroidSyncSettings.registerObserver(context, this);
mProfileSyncService = ProfileSyncService.get();
mProfileSyncService.addSyncStateChangedListener(this);
// Set the sessions ID using the generator that was registered for GENERATOR_ID.
mProfileSyncService.setSessionsId(
UniqueIdentificationGeneratorFactory.getInstance(GENERATOR_ID));
// Create the SyncNotificationController.
mSyncNotificationController = new SyncNotificationController(
mContext, PassphraseActivity.class, AccountManagementFragment.class);
mProfileSyncService.addSyncStateChangedListener(mSyncNotificationController);
updateSyncStateFromAndroid();
// When the application gets paused, tell sync to flush the directory to disk.
ApplicationStatus.registerStateListenerForAllActivities(new ActivityStateListener() {
@Override
public void onActivityStateChange(Activity activity, int newState) {
if (newState == ActivityState.PAUSED) {
mProfileSyncService.flushDirectory();
}
}
});
}
示例5: SyncController
import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的package包/类
private SyncController(Context context) {
mContext = context;
mChromeSigninController = ChromeSigninController.get(mContext);
mSyncStatusHelper = SyncStatusHelper.get(context);
mSyncStatusHelper.registerSyncSettingsChangedObserver(this);
mProfileSyncService = ProfileSyncService.get(mContext);
mProfileSyncService.addSyncStateChangedListener(this);
setupSessionSyncId();
mChromeSigninController.ensureGcmIsInitialized();
}
示例6: update
import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的package包/类
/**
* Updates the title, summary, and image based on the current sign-in state.
*/
private void update() {
String title;
String summary;
String fragment;
Account account = ChromeSigninController.get(getContext()).getSignedInUser();
if (account == null) {
title = getContext().getString(R.string.sign_in_to_chrome);
summary = getContext().getString(R.string.sign_in_to_chrome_summary);
fragment = null;
} else {
List<String> accounts = AccountManagerHelper.get(getContext()).getGoogleAccountNames();
if (accounts.size() == 1) {
summary = accounts.get(0);
} else {
summary = getContext().getString(
R.string.number_of_signed_in_accounts, accounts.size());
}
fragment = AccountManagementFragment.class.getName();
title = AccountManagementFragment.getCachedUserName(account.name);
if (title == null) {
final Profile profile = Profile.getLastUsedProfile();
String cachedName = ProfileDownloader.getCachedFullName(profile);
Bitmap cachedBitmap = ProfileDownloader.getCachedAvatar(profile);
if (TextUtils.isEmpty(cachedName) || cachedBitmap == null) {
AccountManagementFragment.startFetchingAccountInformation(
getContext(), profile, account.name);
}
title = TextUtils.isEmpty(cachedName) ? account.name : cachedName;
}
}
setTitle(title);
setSummary(summary);
setFragment(fragment);
ChromeSigninController signinController = ChromeSigninController.get(getContext());
boolean enabled = signinController.isSignedIn()
|| SigninManager.get(getContext()).isSignInAllowed();
if (mViewEnabled != enabled) {
mViewEnabled = enabled;
notifyChanged();
}
if (!enabled) setFragment(null);
if (SigninManager.get(getContext()).isSigninDisabledByPolicy()) {
setIcon(ManagedPreferencesUtils.getManagedByEnterpriseIconId());
} else {
Resources resources = getContext().getResources();
Bitmap bitmap = AccountManagementFragment.getUserPicture(
signinController.getSignedInAccountName(), resources);
setIcon(new BitmapDrawable(resources, bitmap));
}
}