@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHomepageManager = HomepageManager.getInstance(getActivity()); getActivity().setTitle(R.string.options_homepage_edit_title); View v = inflater.inflate(R.layout.homepage_editor, container, false); FloatLabelLayout homepageUrl = (FloatLabelLayout) v.findViewById(R.id.homepage_url); homepageUrl.focusWithoutAnimation(); mHomepageUrlEdit = (EditText) v.findViewById(R.id.homepage_url_edit); mHomepageUrlEdit.setText( (mHomepageManager.getPrefHomepageUseDefaultUri() ? PartnerBrowserCustomizations.getHomePageUrl() : mHomepageManager.getPrefHomepageCustomUri())); mHomepageUrlEdit.addTextChangedListener(this); initializeSaveCancelResetButtons(v); return v; }
/** @return Whether parental controls are enabled. Returning true will disable incognito mode. */ @CalledByNative protected boolean areParentalControlsEnabled() { return PartnerBrowserCustomizations.isIncognitoDisabled(); }
/** * Handle application level deferred startup tasks that can be lazily done after all the necessary * initialization has been completed. Any calls requiring network access should probably go here. */ @UiThread public void onDeferredStartupForApp() { if (mDeferredStartupComplete) return; ThreadUtils.assertOnUiThread(); long startDeferredStartupTime = SystemClock.uptimeMillis(); RecordHistogram.recordLongTimesHistogram( "UMA.Debug.EnableCrashUpload.DeferredStartUptime", startDeferredStartupTime - UmaUtils.getMainEntryPointTime(), TimeUnit.MILLISECONDS); mLocaleManager.recordStartupMetrics(); // Punt all tasks that may block the UI thread off onto a background thread. new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { try { TraceEvent.begin("ChromeBrowserInitializer.onDeferredStartup.doInBackground"); long asyncTaskStartTime = SystemClock.uptimeMillis(); boolean crashDumpDisabled = CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_CRASH_DUMP_UPLOAD); if (!crashDumpDisabled) { RecordHistogram.recordLongTimesHistogram( "UMA.Debug.EnableCrashUpload.Uptime2", asyncTaskStartTime - UmaUtils.getMainEntryPointTime(), TimeUnit.MILLISECONDS); PrivacyPreferencesManager.getInstance().enablePotentialCrashUploading(); MinidumpUploadService.tryUploadAllCrashDumps(mAppContext); } CrashFileManager crashFileManager = new CrashFileManager(mAppContext.getCacheDir()); crashFileManager.cleanOutAllNonFreshMinidumpFiles(); MinidumpUploadService.storeBreakpadUploadStatsInUma( ChromePreferenceManager.getInstance(mAppContext)); // Force a widget refresh in order to wake up any possible zombie widgets. // This is needed to ensure the right behavior when the process is suddenly // killed. BookmarkWidgetProvider.refreshAllWidgets(mAppContext); // Initialize whether or not precaching is enabled. PrecacheLauncher.updatePrecachingEnabled(mAppContext); if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_WEBAPK)) { WebApkVersionManager.updateWebApksIfNeeded(); } removeSnapshotDatabase(); cacheIsChromeDefaultBrowser(); RecordHistogram.recordLongTimesHistogram( "UMA.Debug.EnableCrashUpload.DeferredStartUpDurationAsync", SystemClock.uptimeMillis() - asyncTaskStartTime, TimeUnit.MILLISECONDS); return null; } finally { TraceEvent.end("ChromeBrowserInitializer.onDeferredStartup.doInBackground"); } } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); AfterStartupTaskUtils.setStartupComplete(); PartnerBrowserCustomizations.setOnInitializeAsyncFinished( new Runnable() { @Override public void run() { String homepageUrl = HomepageManager.getHomepageUri(mAppContext); LaunchMetrics.recordHomePageLaunchMetrics( HomepageManager.isHomepageEnabled(mAppContext), NewTabPage.isNTPUrl(homepageUrl), homepageUrl); } }); // TODO(aruslan): http://b/6397072 This will be moved elsewhere PartnerBookmarksShim.kickOffReading(mAppContext); PowerMonitor.create(mAppContext); ShareHelper.clearSharedImages(mAppContext); // Clear any media notifications that existed when Chrome was last killed. MediaCaptureNotificationService.clearMediaNotifications(mAppContext); startModerateBindingManagementIfNeeded(); recordKeyboardLocaleUma(); ChromeApplication application = (ChromeApplication) mAppContext; // Starts syncing with GSA. application.createGsaHelper().startSync(); application.initializeSharedClasses(); // Start or stop Physical Web PhysicalWeb.onChromeStart(application); mDeferredStartupComplete = true; RecordHistogram.recordLongTimesHistogram( "UMA.Debug.EnableCrashUpload.DeferredStartUpDuration", SystemClock.uptimeMillis() - startDeferredStartupTime, TimeUnit.MILLISECONDS); }