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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/init/ProcessInitializationHandler.java

Issue 2697933002: Remove factory methods from ChromeApplication. (Closed)
Patch Set: Rebase Created 3 years, 10 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: chrome/android/java/src/org/chromium/chrome/browser/init/ProcessInitializationHandler.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ProcessInitializationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/init/ProcessInitializationHandler.java
index d5768286e268cc3950050fccceb84ccbb1772866..6715a233f4a311531db15ae6f85c482aaad6be06 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/init/ProcessInitializationHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/init/ProcessInitializationHandler.java
@@ -16,6 +16,7 @@ import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.ThreadUtils;
import org.chromium.chrome.R;
+import org.chromium.chrome.browser.AppHooks;
import org.chromium.chrome.browser.ChromeActivitySessionTracker;
import org.chromium.chrome.browser.ChromeApplication;
import org.chromium.chrome.browser.DeferredStartupHandler;
@@ -51,7 +52,6 @@ public class ProcessInitializationHandler {
private static final String SESSIONS_UUID_PREF_KEY = "chromium.sync.sessions.id";
private static final String DEV_TOOLS_SERVER_SOCKET_PREFIX = "chrome";
- private static Class<? extends ProcessInitializationHandler> sHandlerClassOverride;
private static ProcessInitializationHandler sInstance;
private boolean mInitializedPreNative;
@@ -60,45 +60,17 @@ public class ProcessInitializationHandler {
private DevToolsServer mDevToolsServer;
/**
- * Overrides the type of ProcessInitializationHandler to be created.
- * <p>
- * This must be called before {@link #getInstance()} is triggered.
- *
- * @param classOverride The ProcessInitializationHandler class type to be created instead of
- * the default.
- */
- public static void setProcessInitializationHandlerType(
- Class<? extends ProcessInitializationHandler> classOverride) {
- if (sInstance != null) {
- throw new IllegalStateException("Browser delegate override set after initialized");
- }
- sHandlerClassOverride = classOverride;
- }
-
- /**
* @return The ProcessInitializationHandler for use during the lifetime of the browser process.
*/
public static ProcessInitializationHandler getInstance() {
ThreadUtils.assertOnUiThread();
if (sInstance == null) {
- if (sHandlerClassOverride != null) {
- try {
- sInstance = sHandlerClassOverride.newInstance();
- } catch (InstantiationException | IllegalAccessException e) {
- assert false : "Unable to instantiate ProcessInitializationHandler override.";
- }
- }
- if (sInstance == null) sInstance = new ProcessInitializationHandler();
+ sInstance = AppHooks.get().createProcessInitializationHandler();
}
return sInstance;
}
/**
- * Constructor exposed to allow overriding.
- */
- protected ProcessInitializationHandler() {}
-
- /**
* Initializes the any dependencies that must occur before native library has been loaded.
* <p>
* Adding anything expensive to this must be avoided as it would delay the Chrome startup path.
@@ -139,7 +111,7 @@ public class ProcessInitializationHandler {
// only once and before AccountMangerHelper.get(...) is called to avoid using the
// default AccountManagerDelegate.
AccountManagerHelper.initializeAccountManagerHelper(
- application, application.createAccountManagerDelegate());
+ application, AppHooks.get().createAccountManagerDelegate());
// Set the unique identification generator for invalidations. The
// invalidations system can start and attempt to fetch the client ID
@@ -178,7 +150,7 @@ public class ProcessInitializationHandler {
DataReductionProxySettings.reconcileDataReductionProxyEnabledState(application);
ChromeActivitySessionTracker.getInstance().initializeWithNative();
ChromeApplication.removeSessionCookies();
- AppBannerManager.setAppDetailsDelegate(application.createAppDetailsDelegate());
+ AppBannerManager.setAppDetailsDelegate(AppHooks.get().createAppDetailsDelegate());
ChromeLifetimeController.initialize();
PrefServiceBridge.getInstance().migratePreferences(application);

Powered by Google App Engine
This is Rietveld 408576698