本文整理汇总了Java中org.chromium.chrome.browser.sync.ProfileSyncService.get方法的典型用法代码示例。如果您正苦于以下问题:Java ProfileSyncService.get方法的具体用法?Java ProfileSyncService.get怎么用?Java ProfileSyncService.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.chromium.chrome.browser.sync.ProfileSyncService
的用法示例。
在下文中一共展示了ProfileSyncService.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
// Prevent sync from starting if it hasn't already to give the user a chance to change
// their sync settings.
ProfileSyncService syncService = ProfileSyncService.get();
if (syncService != null) {
syncService.setSetupInProgress(true);
}
mGaiaServiceType = AccountManagementScreenHelper.GAIA_SERVICE_TYPE_NONE;
if (getArguments() != null) {
mGaiaServiceType =
getArguments().getInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, mGaiaServiceType);
}
AccountManagementScreenHelper.logEvent(
ProfileAccountManagementMetrics.VIEW,
mGaiaServiceType);
startFetchingAccountsInformation(getActivity(), Profile.getLastUsedProfile());
}
示例2: showSyncErrorIcon
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
/**
* Checks if sync error icon should be shown. Show sync error icon if sync is off because
* of error, passphrase required or disabled in Android.
*/
static boolean showSyncErrorIcon(Context context) {
if (!AndroidSyncSettings.isMasterSyncEnabled(context)) {
return true;
}
ProfileSyncService profileSyncService = ProfileSyncService.get();
if (profileSyncService != null) {
if (profileSyncService.hasUnrecoverableError()) {
return true;
}
if (profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE) {
return true;
}
if (profileSyncService.isSyncActive()
&& profileSyncService.isPassphraseRequiredForDecryption()) {
return true;
}
}
return false;
}
示例3: getPromptText
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
private String getPromptText() {
ProfileSyncService pss = ProfileSyncService.get();
String accountName = pss.getCurrentSignedInAccountText() + "\n\n";
PassphraseType passphraseType = pss.getPassphraseType();
if (pss.hasExplicitPassphraseTime()) {
switch (passphraseType) {
case FROZEN_IMPLICIT_PASSPHRASE:
return accountName + pss.getSyncEnterGooglePassphraseBodyWithDateText();
case CUSTOM_PASSPHRASE:
return accountName + pss.getSyncEnterCustomPassphraseBodyWithDateText();
case IMPLICIT_PASSPHRASE: // Falling through intentionally.
case KEYSTORE_PASSPHRASE: // Falling through intentionally.
default:
Log.w(TAG, "Found incorrect passphrase type " + passphraseType
+ ". Falling back to default string.");
return accountName + pss.getSyncEnterCustomPassphraseBodyText();
}
}
return accountName + pss.getSyncEnterCustomPassphraseBodyText();
}
示例4: onStopWithNative
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@Override
public void onStopWithNative() {
Tab tab = getActivityTab();
if (tab != null && !hasWindowFocus()) tab.onActivityHidden();
if (mAppMenuHandler != null) mAppMenuHandler.hideAppMenu();
if (GSAState.getInstance(this).isGsaAvailable()) {
GSAAccountChangeListener.getInstance().disconnect();
if (mSyncStateChangedListener != null) {
ProfileSyncService syncService = ProfileSyncService.get();
if (syncService != null) {
syncService.removeSyncStateChangedListener(mSyncStateChangedListener);
}
mSyncStateChangedListener = null;
}
}
super.onStopWithNative();
}
示例5: onCreate
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
// Prevent sync from starting if it hasn't already to give the user a chance to change
// their sync settings.
ProfileSyncService syncService = ProfileSyncService.get();
if (syncService != null) {
syncService.setSetupInProgress(true);
}
mGaiaServiceType = AccountManagementScreenHelper.GAIA_SERVICE_TYPE_NONE;
if (getArguments() != null) {
mGaiaServiceType =
getArguments().getInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, mGaiaServiceType);
}
mProfile = Profile.getLastUsedProfile();
AccountManagementScreenHelper.logEvent(
ProfileAccountManagementMetrics.VIEW,
mGaiaServiceType);
startFetchingAccountsInformation(getActivity(), mProfile);
}
示例6: onResume
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@Override
public void onResume() {
super.onResume();
SigninManager.get(getActivity()).addSignInStateObserver(this);
ProfileDownloader.addObserver(this);
ProfileSyncService syncService = ProfileSyncService.get();
if (syncService != null) {
syncService.addSyncStateChangedListener(this);
}
update();
}
示例7: onPause
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@Override
public void onPause() {
super.onPause();
SigninManager.get(getActivity()).removeSignInStateObserver(this);
ProfileDownloader.removeObserver(this);
ProfileSyncService syncService = ProfileSyncService.get();
if (syncService != null) {
syncService.removeSyncStateChangedListener(this);
}
}
示例8: onDestroy
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@Override
public void onDestroy() {
super.onDestroy();
// Allow sync to begin syncing if it hasn't yet.
ProfileSyncService syncService = ProfileSyncService.get();
if (syncService != null) {
syncService.setSetupInProgress(false);
}
}
示例9: SigninHelper
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
private SigninHelper(Context context) {
mContext = context;
mProfileSyncService = ProfileSyncService.get();
mSigninManager = SigninManager.get(mContext);
mAccountTrackerService = AccountTrackerService.get(mContext);
mOAuth2TokenService = OAuth2TokenService.getForProfile(Profile.getLastUsedProfile());
mChromeSigninController = ChromeSigninController.get(mContext);
}
示例10: registerForUpdates
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
/**
* Starts listening for updates to the sign-in and sync state.
*/
public void registerForUpdates() {
SigninManager manager = SigninManager.get(getContext());
manager.addSignInAllowedObserver(this);
ProfileDownloader.addObserver(this);
FirstRunSignInProcessor.updateSigninManagerFirstRunCheckDone(getContext());
AndroidSyncSettings.registerObserver(getContext(), this);
ProfileSyncService syncService = ProfileSyncService.get();
if (syncService != null) {
syncService.addSyncStateChangedListener(this);
}
}
示例11: unregisterForUpdates
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
/**
* Stops listening for updates to the sign-in and sync state. Every call to registerForUpdates()
* must be matched with a call to this method.
*/
public void unregisterForUpdates() {
SigninManager manager = SigninManager.get(getContext());
manager.removeSignInAllowedObserver(this);
ProfileDownloader.removeObserver(this);
AndroidSyncSettings.unregisterObserver(getContext(), this);
ProfileSyncService syncService = ProfileSyncService.get();
if (syncService != null) {
syncService.removeSyncStateChangedListener(this);
}
}
示例12: ensureStartedAndUpdateRegisteredTypes
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
/**
* Updates the sync invalidation types that the client is registered for based on the preferred
* sync types. Starts the client if needed.
*/
public void ensureStartedAndUpdateRegisteredTypes() {
ProfileSyncService syncService = ProfileSyncService.get();
if (syncService == null) return;
mStarted = true;
// Ensure GCM has been initialized.
ensureGcmIsInitialized();
// Do not apply changes to {@link #mSessionInvalidationsEnabled} yet because the timer task
// may be scheduled far into the future.
mEnableSessionInvalidationsTimer.resume();
HashSet<Integer> typesToRegister = new HashSet<Integer>();
typesToRegister.addAll(syncService.getPreferredDataTypes());
if (!mSessionInvalidationsEnabled) {
typesToRegister.remove(ModelType.SESSIONS);
typesToRegister.remove(ModelType.FAVICON_TRACKING);
typesToRegister.remove(ModelType.FAVICON_IMAGES);
}
Intent registerIntent = InvalidationIntentProtocol.createRegisterIntent(
ChromeSigninController.get(mContext).getSignedInUser(),
typesToRegister);
registerIntent.setClass(
mContext, InvalidationClientService.getRegisteredClass());
mContext.startService(registerIntent);
}
示例13: finishSignIn
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
private void finishSignIn(AccountIdsAndNames accountIdsAndNames) {
if (mSignInAccount == null) {
Log.w(TAG, "Sign in request was canceled; aborting finishSignIn().");
return;
}
// Tell the native side that sign-in has completed.
nativeOnSignInCompleted(mNativeSigninManagerAndroid, mSignInAccount.name,
accountIdsAndNames.mAccountIds, accountIdsAndNames.mAccountNames);
// Cache the signed-in account name. This must be done after the native call, otherwise
// sync tries to start without being signed in natively and crashes.
ChromeSigninController.get(mContext).setSignedInAccountName(mSignInAccount.name);
// Sign-in to sync.
ProfileSyncService profileSyncService = ProfileSyncService.get();
if (AndroidSyncSettings.isSyncEnabled(mContext)
&& !profileSyncService.hasSyncSetupCompleted()) {
profileSyncService.setSetupInProgress(true);
profileSyncService.requestStart();
}
if (mSignInFlowObserver != null) mSignInFlowObserver.onSigninComplete();
// All done, cleanup.
Log.d(TAG, "Signin done");
mSignInActivity = null;
mSignInAccount = null;
mSignInFlowObserver = null;
notifySignInAllowedChanged();
for (SignInStateObserver observer : mSignInStateObservers) {
observer.onSignedIn();
}
}
示例14: getSyncStatusSummary
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
private static String getSyncStatusSummary(Activity activity) {
if (!ChromeSigninController.get(activity).isSignedIn()) return "";
ProfileSyncService profileSyncService = ProfileSyncService.get();
Resources res = activity.getResources();
if (ChildAccountService.getInstance(activity).hasChildAccount()) {
return res.getString(R.string.kids_account);
}
if (!AndroidSyncSettings.isMasterSyncEnabled(activity)) {
return res.getString(R.string.sync_android_master_sync_disabled);
}
if (profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE) {
return res.getString(profileSyncService.getAuthError().getMessage());
}
if (AndroidSyncSettings.isSyncEnabled(activity)) {
if (!profileSyncService.isSyncInitialized()) {
return res.getString(R.string.sync_setup_progress);
}
if (profileSyncService.isPassphraseRequiredForDecryption()) {
return res.getString(R.string.sync_need_passphrase);
}
}
return AndroidSyncSettings.isSyncEnabled(activity)
? res.getString(R.string.sync_is_enabled)
: res.getString(R.string.sync_is_disabled);
}
示例15: SigninHelper
import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的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);
}