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;
}
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);
}
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();
}
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();
}
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);
}
Aggregations