Commit 852c3123 authored by maxbogue's avatar maxbogue Committed by Commit bot

Register sync session ID in SyncController.

Removing GSM.setupSessionSyncId() part 3/4. Generate the sync
sessions ID in SyncController and cleanup ChromeShellActivity.

BUG=428882

Review URL: https://codereview.chromium.org/951773003

Cr-Commit-Position: refs/heads/master@{#319097}
parent 8d4dd86f
...@@ -10,6 +10,7 @@ import android.content.Context; ...@@ -10,6 +10,7 @@ import android.content.Context;
import android.util.Log; import android.util.Log;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory;
import org.chromium.chrome.browser.invalidation.InvalidationController; import org.chromium.chrome.browser.invalidation.InvalidationController;
import org.chromium.chrome.browser.signin.SigninManager; import org.chromium.chrome.browser.signin.SigninManager;
import org.chromium.chrome.browser.signin.SigninManager.SignInFlowObserver; import org.chromium.chrome.browser.signin.SigninManager.SignInFlowObserver;
...@@ -60,6 +61,9 @@ public class SyncController implements ProfileSyncService.SyncStateChangedListen ...@@ -60,6 +61,9 @@ public class SyncController implements ProfileSyncService.SyncStateChangedListen
mProfileSyncService = ProfileSyncService.get(mContext); mProfileSyncService = ProfileSyncService.get(mContext);
mProfileSyncService.addSyncStateChangedListener(this); mProfileSyncService.addSyncStateChangedListener(this);
mChromeSigninController.ensureGcmIsInitialized(); mChromeSigninController.ensureGcmIsInitialized();
// Set the sessions ID using the generator that was registered for GENERATOR_ID.
mProfileSyncService.setSessionsId(
UniqueIdentificationGeneratorFactory.getInstance(GENERATOR_ID));
} }
/** /**
......
...@@ -36,8 +36,6 @@ import org.chromium.chrome.browser.Tab; ...@@ -36,8 +36,6 @@ import org.chromium.chrome.browser.Tab;
import org.chromium.chrome.browser.appmenu.AppMenuHandler; import org.chromium.chrome.browser.appmenu.AppMenuHandler;
import org.chromium.chrome.browser.appmenu.AppMenuPropertiesDelegate; import org.chromium.chrome.browser.appmenu.AppMenuPropertiesDelegate;
import org.chromium.chrome.browser.dom_distiller.DomDistillerTabUtils; import org.chromium.chrome.browser.dom_distiller.DomDistillerTabUtils;
import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory;
import org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator;
import org.chromium.chrome.browser.nfc.BeamController; import org.chromium.chrome.browser.nfc.BeamController;
import org.chromium.chrome.browser.nfc.BeamProvider; import org.chromium.chrome.browser.nfc.BeamProvider;
import org.chromium.chrome.browser.notifications.NotificationUIManager; import org.chromium.chrome.browser.notifications.NotificationUIManager;
...@@ -45,7 +43,6 @@ import org.chromium.chrome.browser.preferences.PreferencesLauncher; ...@@ -45,7 +43,6 @@ import org.chromium.chrome.browser.preferences.PreferencesLauncher;
import org.chromium.chrome.browser.printing.PrintingControllerFactory; import org.chromium.chrome.browser.printing.PrintingControllerFactory;
import org.chromium.chrome.browser.printing.TabPrinter; import org.chromium.chrome.browser.printing.TabPrinter;
import org.chromium.chrome.browser.share.ShareHelper; import org.chromium.chrome.browser.share.ShareHelper;
import org.chromium.chrome.browser.sync.ProfileSyncService;
import org.chromium.chrome.browser.sync.SyncController; import org.chromium.chrome.browser.sync.SyncController;
import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
...@@ -70,8 +67,6 @@ import org.chromium.ui.base.WindowAndroid; ...@@ -70,8 +67,6 @@ import org.chromium.ui.base.WindowAndroid;
public class ChromeShellActivity extends ActionBarActivity implements AppMenuPropertiesDelegate { public class ChromeShellActivity extends ActionBarActivity implements AppMenuPropertiesDelegate {
private static final String TAG = "ChromeShellActivity"; private static final String TAG = "ChromeShellActivity";
private static final String SESSIONS_UUID_PREF_KEY = "chromium.sync.sessions.id";
/** /**
* Factory used to set up a mock ActivityWindowAndroid for testing. * Factory used to set up a mock ActivityWindowAndroid for testing.
*/ */
...@@ -195,8 +190,6 @@ public class ChromeShellActivity extends ActionBarActivity implements AppMenuPro ...@@ -195,8 +190,6 @@ public class ChromeShellActivity extends ActionBarActivity implements AppMenuPro
mPrintingController = PrintingControllerFactory.create(this); mPrintingController = PrintingControllerFactory.create(this);
setupSessionSyncId();
mSyncController = SyncController.get(this); mSyncController = SyncController.get(this);
// In case this method is called after the first onStart(), we need to inform the // In case this method is called after the first onStart(), we need to inform the
// SyncController that we have started. // SyncController that we have started.
...@@ -484,19 +477,6 @@ public class ChromeShellActivity extends ActionBarActivity implements AppMenuPro ...@@ -484,19 +477,6 @@ public class ChromeShellActivity extends ActionBarActivity implements AppMenuPro
sAppMenuHandlerFactory = factory; sAppMenuHandlerFactory = factory;
} }
private void setupSessionSyncId() {
// Ensure that sync uses the correct UniqueIdentificationGenerator, but do not force the
// registration, in case a test case has already overridden it.
UuidBasedUniqueIdentificationGenerator generator =
new UuidBasedUniqueIdentificationGenerator(this, SESSIONS_UUID_PREF_KEY);
UniqueIdentificationGeneratorFactory.registerGenerator(
UuidBasedUniqueIdentificationGenerator.GENERATOR_ID, generator, false);
// Since we do not override the UniqueIdentificationGenerator, we get it from the factory,
// instead of using the instance we just created.
ProfileSyncService.get(this).setSessionsId(UniqueIdentificationGeneratorFactory
.getInstance(UuidBasedUniqueIdentificationGenerator.GENERATOR_ID));
}
/** /**
* Open a dialog that gives the user the option to sign in from a list of available accounts. * Open a dialog that gives the user the option to sign in from a list of available accounts.
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment