Search in sources :

Example 1 with IntentHandlerDelegate

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

the class ChromeActivity method createIntentHandlerDelegate.

protected IntentHandlerDelegate createIntentHandlerDelegate() {
    return new IntentHandlerDelegate() {

        @Override
        public void processWebSearchIntent(String query) {
            Intent searchIntent = new Intent(Intent.ACTION_WEB_SEARCH);
            searchIntent.putExtra(SearchManager.QUERY, query);
            startActivity(searchIntent);
        }

        @Override
        public void processUrlViewIntent(String url, String referer, String headers, TabOpenType tabOpenType, String externalAppId, int tabIdToBringToFront, boolean hasUserGesture, Intent intent) {
        }
    };
}
Also used : Intent(android.content.Intent) IntentHandlerDelegate(org.chromium.chrome.browser.IntentHandler.IntentHandlerDelegate) TabOpenType(org.chromium.chrome.browser.IntentHandler.TabOpenType)

Example 2 with IntentHandlerDelegate

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

the class SeparateTaskManagedCustomTabActivity method createIntentHandlerDelegate.

@Override
protected IntentHandlerDelegate createIntentHandlerDelegate() {
    return new IntentHandlerDelegate() {

        @Override
        public void processWebSearchIntent(String query) {
        }

        @Override
        public void processUrlViewIntent(String url, String referer, String headers, TabOpenType tabOpenType, String externalAppId, int tabIdToBringToFront, boolean hasUserGesture, Intent intent) {
            Tab currentTab = getTabCreator(false).launchUrlFromExternalApp(url, referer, headers, externalAppId, true, intent, mIntentHandlingTimeMs);
            // Close all existing tabs from the previous session.
            TabModel tabModel = getTabModelSelector().getModel(false);
            for (int i = tabModel.getCount() - 1; i >= 0; i--) {
                if (tabModel.getTabAt(i).equals(currentTab))
                    continue;
                tabModel.closeTab(tabModel.getTabAt(i), false, false, false);
            }
        }
    };
}
Also used : Tab(org.chromium.chrome.browser.tab.Tab) Intent(android.content.Intent) IntentHandlerDelegate(org.chromium.chrome.browser.IntentHandler.IntentHandlerDelegate) TabOpenType(org.chromium.chrome.browser.IntentHandler.TabOpenType) TabModel(org.chromium.chrome.browser.tabmodel.TabModel)

Aggregations

Intent (android.content.Intent)2 IntentHandlerDelegate (org.chromium.chrome.browser.IntentHandler.IntentHandlerDelegate)2 TabOpenType (org.chromium.chrome.browser.IntentHandler.TabOpenType)2 Tab (org.chromium.chrome.browser.tab.Tab)1 TabModel (org.chromium.chrome.browser.tabmodel.TabModel)1