Search in sources :

Example 1 with PrintDocumentAdapterWrapper

use of org.chromium.printing.PrintDocumentAdapterWrapper in project AndroidChromium by JackyAndroid.

the class ProcessInitializationHandler method handleDeferredStartupTasksInitialization.

/**
 * Performs the deferred startup task initialization.
 */
protected void handleDeferredStartupTasksInitialization() {
    final ChromeApplication application = (ChromeApplication) ContextUtils.getApplicationContext();
    DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {

        @Override
        public void run() {
            ForcedSigninProcessor.start(application);
            AccountsChangedReceiver.addObserver(new AccountsChangedReceiver.AccountsChangedObserver() {

                @Override
                public void onAccountsChanged(Context context, Intent intent) {
                    ThreadUtils.runOnUiThread(new Runnable() {

                        @Override
                        public void run() {
                            ForcedSigninProcessor.start(application);
                        }
                    });
                }
            });
        }
    });
    DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {

        @Override
        public void run() {
            GoogleServicesManager.get(application).onMainActivityStart();
            RevenueStats.getInstance();
        }
    });
    DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {

        @Override
        public void run() {
            mDevToolsServer = new DevToolsServer(DEV_TOOLS_SERVER_SOCKET_PREFIX);
            mDevToolsServer.setRemoteDebuggingEnabled(true, DevToolsServer.Security.ALLOW_DEBUG_PERMISSION);
        }
    });
    DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {

        @Override
        public void run() {
            // is fixed.
            assert !CommandLine.getInstance().hasSwitch(ContentSwitches.SWITCH_PROCESS_TYPE);
            if (!CommandLine.getInstance().hasSwitch(ContentSwitches.SWITCH_PROCESS_TYPE)) {
                DownloadController.setDownloadNotificationService(DownloadManagerService.getDownloadManagerService(application));
            }
            if (ApiCompatibilityUtils.isPrintingSupported()) {
                String errorText = application.getResources().getString(R.string.error_printing_failed);
                PrintingControllerImpl.create(new PrintDocumentAdapterWrapper(), errorText);
            }
        }
    });
}
Also used : Context(android.content.Context) ChromeApplication(org.chromium.chrome.browser.ChromeApplication) DevToolsServer(org.chromium.chrome.browser.DevToolsServer) PrintDocumentAdapterWrapper(org.chromium.printing.PrintDocumentAdapterWrapper) Intent(android.content.Intent)

Aggregations

Context (android.content.Context)1 Intent (android.content.Intent)1 ChromeApplication (org.chromium.chrome.browser.ChromeApplication)1 DevToolsServer (org.chromium.chrome.browser.DevToolsServer)1 PrintDocumentAdapterWrapper (org.chromium.printing.PrintDocumentAdapterWrapper)1