Search in sources :

Example 11 with ChromeApplication

use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.

the class LocationSettings method getInstance.

/**
 * Returns the singleton instance of LocationSettings, creating it if needed.
 */
@SuppressFBWarnings("LI_LAZY_INIT_STATIC")
public static LocationSettings getInstance() {
    ThreadUtils.assertOnUiThread();
    if (sInstance == null) {
        ChromeApplication application = (ChromeApplication) ContextUtils.getApplicationContext();
        sInstance = application.createLocationSettings();
    }
    return sInstance;
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) SuppressFBWarnings(org.chromium.base.annotations.SuppressFBWarnings)

Example 12 with ChromeApplication

use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.

the class WebApkActivity method initializeChildProcessCreationParams.

/**
 * Initializes {@link ChildProcessCreationParams} as a WebAPK's renderer process if
 * {@link isForWebApk}} is true; as Chrome's child process otherwise.
 * @param isForWebApk: Whether the {@link ChildProcessCreationParams} is initialized as a
 *                     WebAPK renderer process.
 */
private void initializeChildProcessCreationParams(boolean isForWebApk) {
    // TODO(hanxi): crbug.com/664530. WebAPKs shouldn't use a global ChildProcessCreationParams.
    ChromeApplication chrome = (ChromeApplication) ContextUtils.getApplicationContext();
    ChildProcessCreationParams params = chrome.getChildProcessCreationParams();
    if (isForWebApk) {
        boolean isExternalService = false;
        params = new ChildProcessCreationParams(getWebappInfo().webApkPackageName(), isExternalService, LibraryProcessType.PROCESS_CHILD);
    }
    ChildProcessCreationParams.set(params);
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) ChildProcessCreationParams(org.chromium.content.browser.ChildProcessCreationParams)

Example 13 with ChromeApplication

use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.

the class MultiWindowUtils method getInstance.

/**
 * Returns the singleton instance of MultiWindowUtils, creating it if needed.
 */
public static MultiWindowUtils getInstance() {
    if (sInstance.get() == null) {
        ChromeApplication application = (ChromeApplication) ContextUtils.getApplicationContext();
        sInstance.compareAndSet(null, application.createMultiWindowUtils());
    }
    return sInstance.get();
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication)

Example 14 with ChromeApplication

use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.

the class CustomTabsConnection method getInstance.

/**
 * @return The unique instance of ChromeCustomTabsConnection.
 */
@SuppressFBWarnings("BC_UNCONFIRMED_CAST")
public static CustomTabsConnection getInstance(Application application) {
    if (sInstance.get() == null) {
        ChromeApplication chromeApplication = (ChromeApplication) application;
        chromeApplication.initCommandLine();
        sInstance.compareAndSet(null, chromeApplication.createCustomTabsConnection());
    }
    return sInstance.get();
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) SuppressFBWarnings(org.chromium.base.annotations.SuppressFBWarnings)

Example 15 with ChromeApplication

use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.

the class CustomTabsConnection method initializeBrowser.

/**
 * Warmup activities that should only happen once.
 */
@SuppressFBWarnings("DM_EXIT")
private static void initializeBrowser(final Application app) {
    ThreadUtils.assertOnUiThread();
    try {
        ChromeBrowserInitializer.getInstance(app).handleSynchronousStartup();
    } catch (ProcessInitException e) {
        Log.e(TAG, "ProcessInitException while starting the browser process.");
        // Cannot do anything without the native library, and cannot show a
        // dialog to the user.
        System.exit(-1);
    }
    final Context context = app.getApplicationContext();
    final ChromeApplication chrome = (ChromeApplication) context;
    ChildProcessCreationParams.set(chrome.getChildProcessCreationParams());
    new AsyncTask<Void, Void, Void>() {

        @Override
        protected Void doInBackground(Void... params) {
            ChildProcessLauncher.warmUp(context);
            return null;
        }
    }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    ChromeBrowserInitializer.initNetworkChangeNotifier(context);
    WarmupManager.getInstance().initializeViewHierarchy(context, R.layout.custom_tabs_control_container, R.layout.custom_tabs_toolbar);
}
Also used : Context(android.content.Context) ChromeApplication(org.chromium.chrome.browser.ChromeApplication) ProcessInitException(org.chromium.base.library_loader.ProcessInitException) SuppressFBWarnings(org.chromium.base.annotations.SuppressFBWarnings)

Aggregations

ChromeApplication (org.chromium.chrome.browser.ChromeApplication)17 PolicyAuditor (org.chromium.chrome.browser.policy.PolicyAuditor)4 Activity (android.app.Activity)3 Context (android.content.Context)3 SuppressFBWarnings (org.chromium.base.annotations.SuppressFBWarnings)3 CalledByNative (org.chromium.base.annotations.CalledByNative)2 FeedbackCollector (org.chromium.chrome.browser.feedback.FeedbackCollector)2 Intent (android.content.Intent)1 Preference (android.preference.Preference)1 OnPreferenceClickListener (android.preference.Preference.OnPreferenceClickListener)1 View (android.view.View)1 ProcessInitException (org.chromium.base.library_loader.ProcessInitException)1 DevToolsServer (org.chromium.chrome.browser.DevToolsServer)1 UuidBasedUniqueIdentificationGenerator (org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator)1 ChromeBasePreference (org.chromium.chrome.browser.preferences.ChromeBasePreference)1 SyncPreference (org.chromium.chrome.browser.preferences.SyncPreference)1 TabCreator (org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator)1 ChildProcessCreationParams (org.chromium.content.browser.ChildProcessCreationParams)1 PrintDocumentAdapterWrapper (org.chromium.printing.PrintDocumentAdapterWrapper)1 UiUtils (org.chromium.ui.UiUtils)1