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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.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/ChromeApplication.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
index d2f34b0b768d407134d7271310b5bf26d5d134fc..65275fcc18f0f679f1339960bfcf6d9ad2c26f01 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
@@ -5,12 +5,9 @@
package org.chromium.chrome.browser;
import android.app.Activity;
-import android.app.Notification;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.os.Handler;
-import android.os.Looper;
import android.os.SystemClock;
import android.util.Log;
@@ -24,50 +21,20 @@ import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.MainDex;
import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.base.library_loader.ProcessInitException;
-import org.chromium.chrome.browser.banners.AppDetailsDelegate;
-import org.chromium.chrome.browser.customtabs.CustomTabsConnection;
-import org.chromium.chrome.browser.datausage.ExternalDataUseObserver;
import org.chromium.chrome.browser.document.DocumentActivity;
import org.chromium.chrome.browser.document.IncognitoDocumentActivity;
-import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
-import org.chromium.chrome.browser.feedback.EmptyFeedbackReporter;
-import org.chromium.chrome.browser.feedback.FeedbackReporter;
-import org.chromium.chrome.browser.gsa.GSAHelper;
-import org.chromium.chrome.browser.help.HelpAndFeedback;
-import org.chromium.chrome.browser.historyreport.AppIndexingReporter;
import org.chromium.chrome.browser.init.InvalidStartupDialog;
-import org.chromium.chrome.browser.instantapps.InstantAppsHandler;
-import org.chromium.chrome.browser.locale.LocaleManager;
-import org.chromium.chrome.browser.media.VideoPersister;
import org.chromium.chrome.browser.metrics.UmaUtils;
-import org.chromium.chrome.browser.metrics.VariationsSession;
-import org.chromium.chrome.browser.multiwindow.MultiWindowUtils;
-import org.chromium.chrome.browser.net.qualityprovider.ExternalEstimateProviderAndroid;
-import org.chromium.chrome.browser.omaha.RequestGenerator;
import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomizations;
-import org.chromium.chrome.browser.physicalweb.PhysicalWebBleClient;
-import org.chromium.chrome.browser.policy.PolicyAuditor;
-import org.chromium.chrome.browser.preferences.LocationSettings;
import org.chromium.chrome.browser.preferences.PreferencesLauncher;
import org.chromium.chrome.browser.preferences.autofill.AutofillAndPaymentsPreferences;
import org.chromium.chrome.browser.preferences.password.SavePasswordsPreferences;
-import org.chromium.chrome.browser.rlz.RevenueStats;
-import org.chromium.chrome.browser.services.AndroidEduOwnerCheckCallback;
-import org.chromium.chrome.browser.signin.GoogleActivityController;
-import org.chromium.chrome.browser.sync.GmsCoreSyncListener;
-import org.chromium.chrome.browser.tab.AuthenticatorNavigationInterceptor;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.document.ActivityDelegateImpl;
import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector;
import org.chromium.chrome.browser.tabmodel.document.StorageDelegate;
import org.chromium.chrome.browser.tabmodel.document.TabDelegate;
-import org.chromium.chrome.browser.webapps.ChromeShortcutManager;
-import org.chromium.chrome.browser.webapps.GooglePlayWebApkInstallDelegate;
-import org.chromium.components.signin.AccountManagerDelegate;
-import org.chromium.components.signin.SystemAccountManagerDelegate;
import org.chromium.content.app.ContentApplication;
-import org.chromium.policy.AppRestrictionsProvider;
-import org.chromium.policy.CombinedPolicyProvider;
/**
* Basic application functionality that should be shared among all browser applications that use
@@ -76,7 +43,6 @@ import org.chromium.policy.CombinedPolicyProvider;
@MainDex
public class ChromeApplication extends ContentApplication {
public static final String COMMAND_LINE_FILE = "chrome-command-line";
-
private static final String TAG = "ChromiumApplication";
private static final String PREF_BOOT_TIMESTAMP =
"com.google.android.apps.chrome.ChromeMobileApplication.BOOT_TIMESTAMP";
@@ -107,35 +73,6 @@ public class ChromeApplication extends ContentApplication {
TraceEvent.end("ChromeApplication.onCreate");
}
- /**
- * Returns a new instance of VariationsSession.
- */
- public VariationsSession createVariationsSession() {
- return new VariationsSession();
- }
-
- /**
- * Return a {@link AuthenticatorNavigationInterceptor} for the given {@link Tab}.
- * This can be null if there are no applicable interceptor to be built.
- */
- @SuppressWarnings("unused")
- public AuthenticatorNavigationInterceptor createAuthenticatorNavigationInterceptor(Tab tab) {
- return null;
- }
-
- /**
- * Initiate AndroidEdu device check.
- * @param callback Callback that should receive the results of the AndroidEdu device check.
- */
- public void checkIsAndroidEduDevice(final AndroidEduOwnerCheckCallback callback) {
- new Handler(Looper.getMainLooper()).post(new Runnable() {
- @Override
- public void run() {
- callback.onSchoolCheckDone(false);
- }
- });
- }
-
@CalledByNative
protected void showAutofillSettings() {
PreferencesLauncher.launchSettingsPage(
@@ -148,11 +85,6 @@ public class ChromeApplication extends ContentApplication {
SavePasswordsPreferences.class.getName());
}
- @Override
- public void initCommandLine() {
- CommandLineInitUtil.initCommandLine(this, COMMAND_LINE_FILE);
- }
-
/**
* Shows an error dialog following a startup error, and then exits the application.
* @param e The exception reported by Chrome initialization.
@@ -165,14 +97,9 @@ public class ChromeApplication extends ContentApplication {
InvalidStartupDialog.show(activity, e.getErrorCode());
}
- /**
- * Returns an instance of LocationSettings to be installed as a singleton.
- */
- public LocationSettings createLocationSettings() {
- // Using an anonymous subclass as the constructor is protected.
- // This is done to deter instantiation of LocationSettings elsewhere without using the
- // getInstance() helper method.
- return new LocationSettings(){};
+ @Override
+ public void initCommandLine() {
+ CommandLineInitUtil.initCommandLine(this, COMMAND_LINE_FILE);
}
/**
@@ -202,22 +129,6 @@ public class ChromeApplication extends ContentApplication {
}
/**
- * @return A provider of external estimates.
- * @param nativePtr Pointer to the native ExternalEstimateProviderAndroid object.
- */
- public ExternalEstimateProviderAndroid createExternalEstimateProviderAndroid(long nativePtr) {
- return new ExternalEstimateProviderAndroid(nativePtr) {};
- }
-
- /**
- * @return An external observer of data use.
- * @param nativePtr Pointer to the native ExternalDataUseObserver object.
- */
- public ExternalDataUseObserver createExternalDataUseObserver(long nativePtr) {
- return new ExternalDataUseObserver(nativePtr);
- }
-
- /**
* @return The user agent string of Chrome.
*/
public static String getBrowserUserAgent() {
@@ -267,135 +178,6 @@ public class ChromeApplication extends ContentApplication {
private static native void nativeFlushPersistentData();
/**
- * @return An instance of {@link FeedbackReporter} to report feedback.
- */
- public FeedbackReporter createFeedbackReporter() {
- return new EmptyFeedbackReporter();
- }
-
- /**
- * @return An instance of ExternalAuthUtils to be installed as a singleton.
- */
- public ExternalAuthUtils createExternalAuthUtils() {
- return new ExternalAuthUtils();
- }
-
- /**
- * Returns a new instance of HelpAndFeedback.
- */
- public HelpAndFeedback createHelpAndFeedback() {
- return new HelpAndFeedback();
- }
-
- /**
- * @return An instance of {@link CustomTabsConnection}. Should not be called
- * outside of {@link CustomTabsConnection#getInstance()}.
- */
- public CustomTabsConnection createCustomTabsConnection() {
- return new CustomTabsConnection(this);
- }
-
- /**
- * @return A new {@link PhysicalWebBleClient} instance.
- */
- public PhysicalWebBleClient createPhysicalWebBleClient() {
- return new PhysicalWebBleClient();
- }
-
- public InstantAppsHandler createInstantAppsHandler() {
- return new InstantAppsHandler();
- }
-
- /**
- * @return An instance of {@link GSAHelper} that handles the start point of chrome's integration
- * with GSA.
- */
- public GSAHelper createGsaHelper() {
- return new GSAHelper();
- }
-
- /**
- * @return An instance of {@link LocaleManager} that handles customized locale related logic.
- */
- public LocaleManager createLocaleManager() {
- return new LocaleManager();
- }
-
- /**
- * Registers various policy providers with the policy manager.
- * Providers are registered in increasing order of precedence so overrides should call this
- * method in the end for this method to maintain the highest precedence.
- * @param combinedProvider The {@link CombinedPolicyProvider} to register the providers with.
- */
- public void registerPolicyProviders(CombinedPolicyProvider combinedProvider) {
- combinedProvider.registerProvider(new AppRestrictionsProvider(getApplicationContext()));
- }
-
- /**
- * @return An instance of PolicyAuditor that notifies the policy system of the user's activity.
- * Only applicable when the user has a policy active, that is tracking the activity.
- */
- public PolicyAuditor getPolicyAuditor() {
- // This class has a protected constructor to prevent accidental instantiation.
- return new PolicyAuditor() {};
- }
-
- /**
- * @return An instance of MultiWindowUtils to be installed as a singleton.
- */
- public MultiWindowUtils createMultiWindowUtils() {
- return new MultiWindowUtils();
- }
-
- /**
- * @return An instance of VideoPersister to be installed as a singleton.
- */
- public VideoPersister createVideoPersister() {
- return new VideoPersister();
- }
-
- /**
- * @return An instance of RequestGenerator to be used for Omaha XML creation. Will be null if
- * a generator is unavailable.
- */
- public RequestGenerator createOmahaRequestGenerator() {
- return null;
- }
-
- /**
- * @return An instance of GmsCoreSyncListener to notify GmsCore of sync encryption key changes.
- * Will be null if one is unavailable.
- */
- public GmsCoreSyncListener createGmsCoreSyncListener() {
- return null;
- }
-
- /**
- * @return An instance of GoogleActivityController.
- */
- public GoogleActivityController createGoogleActivityController() {
- return new GoogleActivityController();
- }
-
- /**
- * @return An instance of AppDetailsDelegate that can be queried about app information for the
- * App Banner feature. Will be null if one is unavailable.
- */
- public AppDetailsDelegate createAppDetailsDelegate() {
- return null;
- }
-
- /** Returns the singleton instance of GooglePlayWebApkInstallDelegate. */
- public GooglePlayWebApkInstallDelegate getGooglePlayWebApkInstallDelegate() {
- return null;
- }
-
- /** Returns the singleton instance of ChromeShortcutManager */
- public ChromeShortcutManager createChromeShortcutManager() {
- return new ChromeShortcutManager();
- }
-
- /**
* Returns the singleton instance of the DocumentTabModelSelector.
* TODO(dfalcantara): Find a better place for this once we differentiate between activity and
* application-level TabModelSelectors.
@@ -412,44 +194,4 @@ public class ChromeApplication extends ContentApplication {
}
return sDocumentTabModelSelector;
}
-
- /**
- * @return An instance of RevenueStats to be installed as a singleton.
- */
- public RevenueStats createRevenueStatsInstance() {
- return new RevenueStats();
- }
-
- /**
- * Creates a new {@link AccountManagerDelegate}.
- * @return the created {@link AccountManagerDelegate}.
- */
- public AccountManagerDelegate createAccountManagerDelegate() {
- return new SystemAccountManagerDelegate(this);
- }
-
- /**
- * Creates a new {@link AppIndexingReporter}.
- * @return the created {@link AppIndexingReporter}.
- */
- public AppIndexingReporter createAppIndexingReporter() {
- return new AppIndexingReporter();
- }
-
- /**
- * Starts a service from {@code intent}. Meant to eventually be used by services that want to
- * be put into the foreground with {@code notification} via
- * {@link android.app.Service#startForeground(int, Notification)}.
- *
- * @param intent The {@link Intent} to fire to start the service.
- * @param notificationId The id of the notification to show.
- * @param notification The {@link Notification} to show.
- */
- @SuppressWarnings("Unused")
- public void startServiceWithNotification(
- Intent intent, int notificationId, Notification notification) {
- // TODO(dtrainor): Eventually make sure the service gets put into the foreground with
- // {@link android.app.Service#startForeground(int, Notification)}.
- startService(intent);
- }
}

Powered by Google App Engine
This is Rietveld 408576698