Java Code Examples for org.chromium.chrome.browser.infobar.InfoBar#ACTION_TYPE_NONE

The following examples show how to use org.chromium.chrome.browser.infobar.InfoBar#ACTION_TYPE_NONE . 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: TranslateInfoBar.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Based on the infobar and the button pressed figure out what action needs to happen.
 */
private int actionFor(boolean isPrimaryButton) {
    int action = InfoBar.ACTION_TYPE_NONE;
    int infobarType = getInfoBarType();
    switch (infobarType) {
        case TranslateInfoBar.BEFORE_TRANSLATE_INFOBAR:
            action = isPrimaryButton
                    ? InfoBar.ACTION_TYPE_TRANSLATE : InfoBar.ACTION_TYPE_CANCEL;
            break;
        case TranslateInfoBar.AFTER_TRANSLATE_INFOBAR:
            if (!isPrimaryButton) {
                action = InfoBar.ACTION_TYPE_TRANSLATE_SHOW_ORIGINAL;
            }
            break;
        case TranslateInfoBar.TRANSLATE_ERROR_INFOBAR:
            // retry
            action = InfoBar.ACTION_TYPE_TRANSLATE;
            break;
        default:
            break;
    }
    return action;
}
 
Example 2
Source File: TranslateInfoBar.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Based on the infobar and the button pressed figure out what action needs to happen.
 */
private int actionFor(boolean isPrimaryButton) {
    int action = InfoBar.ACTION_TYPE_NONE;
    int infobarType = getInfoBarType();
    switch (infobarType) {
        case TranslateInfoBar.BEFORE_TRANSLATE_INFOBAR:
            action = isPrimaryButton
                    ? InfoBar.ACTION_TYPE_TRANSLATE : InfoBar.ACTION_TYPE_CANCEL;
            break;
        case TranslateInfoBar.AFTER_TRANSLATE_INFOBAR:
            if (!isPrimaryButton) {
                action = InfoBar.ACTION_TYPE_TRANSLATE_SHOW_ORIGINAL;
            }
            break;
        case TranslateInfoBar.TRANSLATE_ERROR_INFOBAR:
            // retry
            action = InfoBar.ACTION_TYPE_TRANSLATE;
            break;
        default:
            break;
    }
    return action;
}