org.chromium.content.app.ContentApplication Java Examples

The following examples show how to use org.chromium.content.app.ContentApplication. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChromeBrowserInitializer.java    From delion with Apache License 2.0 6 votes vote down vote up
private void preInflationStartup() {
    ThreadUtils.assertOnUiThread();
    if (mPreInflationStartupComplete) return;
    PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, mApplication);

    // Ensure critical files are available, so they aren't blocked on the file-system
    // behind long-running accesses in next phase.
    // Don't do any large file access here!
    ContentApplication.initCommandLine(mApplication);
    waitForDebuggerIfNeeded();
    ChromeStrictMode.configureStrictMode();
    if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_WEBAPK)) {
        ChromeWebApkHost.init();
    }

    warmUpSharedPrefs();

    DeviceUtils.addDeviceSpecificUserAgentSwitch(mApplication);
    ApplicationStatus.registerStateListenerForAllActivities(
            createActivityStateListener());

    mPreInflationStartupComplete = true;
}
 
Example #2
Source File: ApplicationInitialization.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Enable fullscreen related startup flags.
 * @param resources Resources to use while calculating initialization constants.
 * @param resControlContainerHeight The resource id for the height of the top controls.
 */
public static void enableFullscreenFlags(
        Resources resources, Context context, int resControlContainerHeight) {
    ContentApplication.initCommandLine(context);

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return;

    TypedValue threshold = new TypedValue();
    resources.getValue(R.dimen.top_controls_show_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString());
    resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString());
}
 
Example #3
Source File: ChromeBrowserInitializer.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void preInflationStartup() {
    ThreadUtils.assertOnUiThread();
    if (mPreInflationStartupComplete) return;
    PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);

    // Ensure critical files are available, so they aren't blocked on the file-system
    // behind long-running accesses in next phase.
    // Don't do any large file access here!
    ContentApplication.initCommandLine(mApplication);
    waitForDebuggerIfNeeded();
    ChromeStrictMode.configureStrictMode();
    ChromeWebApkHost.init();

    warmUpSharedPrefs();

    DeviceUtils.addDeviceSpecificUserAgentSwitch(mApplication);
    ApplicationStatus.registerStateListenerForAllActivities(
            createActivityStateListener());

    mPreInflationStartupComplete = true;
}
 
Example #4
Source File: ChromeBrowserProvider.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onCreate() {
    ContentApplication.initCommandLine(getContext());

    BrowserStartupController.get(getContext(), LibraryProcessType.PROCESS_BROWSER)
            .addStartupCompletedObserver(
                    new BrowserStartupController.StartupCallback() {
                        @Override
                        public void onSuccess(boolean alreadyStarted) {
                            ensureNativeSideInitialized();
                        }

                        @Override
                        public void onFailure() {
                        }
                    });

    return true;
}
 
Example #5
Source File: ApplicationInitialization.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Enable fullscreen related startup flags.
 * @param resources Resources to use while calculating initialization constants.
 * @param resControlContainerHeight The resource id for the height of the browser controls.
 */
public static void enableFullscreenFlags(
        Resources resources, Context context, int resControlContainerHeight) {
    ContentApplication.initCommandLine(context);

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return;

    TypedValue threshold = new TypedValue();
    resources.getValue(R.dimen.top_controls_show_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString());
    resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true);
    Log.w("renshuai: ", "hello" + threshold.coerceToString().toString());
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString());

}
 
Example #6
Source File: ChromeBrowserInitializer.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void preInflationStartup() {
    ThreadUtils.assertOnUiThread();
    if (mPreInflationStartupComplete) return;
    PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);

    // Ensure critical files are available, so they aren't blocked on the file-system
    // behind long-running accesses in next phase.
    // Don't do any large file access here!
    ContentApplication.initCommandLine(mApplication);
    waitForDebuggerIfNeeded();
    ChromeStrictMode.configureStrictMode();
    ChromeWebApkHost.init();

    warmUpSharedPrefs();

    DeviceUtils.addDeviceSpecificUserAgentSwitch(mApplication);
    ApplicationStatus.registerStateListenerForAllActivities(
            createActivityStateListener());

    mPreInflationStartupComplete = true;
}
 
Example #7
Source File: ChromeBrowserProvider.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onCreate() {
    // Work around for broken Android versions that break the Android contract and initialize
    // ContentProviders on non-UI threads.  crbug.com/705442
    ThreadUtils.runOnUiThreadBlocking(new Runnable() {
        @Override
        public void run() {
            ContentApplication.initCommandLine(getContext());

            BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER)
                    .addStartupCompletedObserver(
                            new BrowserStartupController.StartupCallback() {
                                @Override
                                public void onSuccess(boolean alreadyStarted) {
                                    ensureNativeSideInitialized();
                                }

                                @Override
                                public void onFailure() {
                                }
                            });
        }
    });

    return true;
}
 
Example #8
Source File: ApplicationInitialization.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Enable fullscreen related startup flags.
 * @param resources Resources to use while calculating initialization constants.
 * @param resControlContainerHeight The resource id for the height of the browser controls.
 */
public static void enableFullscreenFlags(
        Resources resources, Context context, int resControlContainerHeight) {
    ContentApplication.initCommandLine(context);

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return;

    TypedValue threshold = new TypedValue();
    resources.getValue(R.dimen.top_controls_show_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString());
    resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true);
    commandLine.appendSwitchWithValue(
            ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString());
}