org.chromium.content.browser.BrowserStartupController.StartupCallback Java Examples

The following examples show how to use org.chromium.content.browser.BrowserStartupController.StartupCallback. 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: AccountsChangedReceiver.java    From delion with Apache License 2.0 6 votes vote down vote up
private static void notifyAccountsChangedOnBrowserStartup(
        final Context context, final Intent intent) {
    StartupCallback notifyAccountsChangedCallback = new StartupCallback() {
        @Override
        public void onSuccess(boolean alreadyStarted) {
            for (AccountsChangedObserver observer : sObservers) {
                observer.onAccountsChanged(context, intent);
            }
        }

        @Override
        public void onFailure() {
            // Startup failed, so ignore call.
        }
    };
    // If the browser process has already been loaded, a task will be posted immediately to
    // call the |notifyAccountsChangedCallback| passed in as a parameter.
    BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER)
            .addStartupCompletedObserver(notifyAccountsChangedCallback);
}
 
Example #2
Source File: GcmUma.java    From delion with Apache License 2.0 6 votes vote down vote up
private static void onNativeLaunched(final Context context, final Runnable task) {
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER)
                    .addStartupCompletedObserver(
                            new StartupCallback() {
                                @Override
                                public void onSuccess(boolean alreadyStarted) {
                                    task.run();
                                }

                                @Override
                                public void onFailure() {
                                    // Startup failed.
                                }
                            });
        }
    });
}
 
Example #3
Source File: UrlManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Register a StartupCallback to initialize the native portion of the JNI bridge.
 */
private void registerNativeInitStartupCallback() {
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            BrowserStartupController.get(mContext, LibraryProcessType.PROCESS_BROWSER)
                    .addStartupCompletedObserver(new StartupCallback() {
                        @Override
                        public void onSuccess(boolean alreadyStarted) {
                            mNativePhysicalWebDataSourceAndroid = nativeInit();
                        }

                        @Override
                        public void onFailure() {
                            // Startup failed.
                        }
                    });
        }
    });
}
 
Example #4
Source File: AccountsChangedReceiver.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private static void notifyAccountsChangedOnBrowserStartup(
        final Context context, final Intent intent) {
    StartupCallback notifyAccountsChangedCallback = new StartupCallback() {
        @Override
        public void onSuccess(boolean alreadyStarted) {
            for (AccountsChangedObserver observer : sObservers) {
                observer.onAccountsChanged(context, intent);
            }
        }

        @Override
        public void onFailure() {
            // Startup failed, so ignore call.
        }
    };
    // If the browser process has already been loaded, a task will be posted immediately to
    // call the |notifyAccountsChangedCallback| passed in as a parameter.
    BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER)
            .addStartupCompletedObserver(notifyAccountsChangedCallback);
}
 
Example #5
Source File: GcmUma.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private static void onNativeLaunched(final Context context, final Runnable task) {
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER)
                    .addStartupCompletedObserver(
                            new StartupCallback() {
                                @Override
                                public void onSuccess(boolean alreadyStarted) {
                                    task.run();
                                }

                                @Override
                                public void onFailure() {
                                    // Startup failed.
                                }
                            });
        }
    });
}
 
Example #6
Source File: UrlManager.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Register a StartupCallback to initialize the native portion of the JNI bridge.
 */
private void registerNativeInitStartupCallback() {
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER)
                    .addStartupCompletedObserver(new StartupCallback() {
                        @Override
                        public void onSuccess(boolean alreadyStarted) {
                            mNativePhysicalWebDataSourceAndroid = nativeInit();
                            for (UrlInfo urlInfo : getUrls()) {
                                safeNotifyNativeListenersOnFound(urlInfo.getUrl());
                            }
                        }

                        @Override
                        public void onFailure() {
                            // Startup failed.
                        }
                    });
        }
    });
}
 
Example #7
Source File: AccountsChangedReceiver.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private static void notifyAccountsChangedOnBrowserStartup(final Context context) {
    StartupCallback notifyAccountsChangedCallback = new StartupCallback() {
        @Override
        public void onSuccess(boolean alreadyStarted) {
            for (AccountsChangedObserver observer : sObservers) {
                observer.onAccountsChanged();
            }
        }

        @Override
        public void onFailure() {
            // Startup failed, so ignore call.
        }
    };
    // If the browser process has already been loaded, a task will be posted immediately to
    // call the |notifyAccountsChangedCallback| passed in as a parameter.
    BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER)
            .addStartupCompletedObserver(notifyAccountsChangedCallback);
}
 
Example #8
Source File: GcmUma.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private static void onNativeLaunched(final Context context, final Runnable task) {
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER)
                    .addStartupCompletedObserver(
                            new StartupCallback() {
                                @Override
                                public void onSuccess(boolean alreadyStarted) {
                                    task.run();
                                }

                                @Override
                                public void onFailure() {
                                    // Startup failed.
                                }
                            });
        }
    });
}