org.chromium.chrome.browser.infobar.InfoBarContainer Java Examples

The following examples show how to use org.chromium.chrome.browser.infobar.InfoBarContainer. 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: ReaderModeManager.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void onRemoveInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isLast) {
    // Re-shows the reader mode button if necessary once the infobars are dismissed.
    if (isLast) {
        mIsInfoBarContainerShown = false;
        requestReaderPanelShow(StateChangeReason.INFOBAR_HIDDEN);
    }
}
 
Example #2
Source File: ReaderModeManager.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Restore any infobars that may have been hidden by Reader Mode.
 */
private void restoreInfobars() {
    if (!mIsInfoBarContainerShown) return;

    Tab curTab = mTabModelSelector.getCurrentTab();
    if (curTab == null) return;

    InfoBarContainer container = curTab.getInfoBarContainer();
    if (container == null) return;

    container.setIsObscuredByOtherView(false);

    // Temporarily hides the reader mode button while the infobars are shown.
    closeReaderPanel(StateChangeReason.INFOBAR_SHOWN, false);
}
 
Example #3
Source File: ContextualSearchManager.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void onCloseContextualSearch(StateChangeReason reason) {
    if (mSearchPanel == null) return;

    mSelectionController.onSearchEnded(reason);

    // Show the infobar container if it was visible before Contextual Search was shown.
    if (mWereInfoBarsHidden) {
        mWereInfoBarsHidden = false;
        InfoBarContainer container = getInfoBarContainer();
        if (container != null) {
            container.setIsObscuredByOtherView(false);
        }
    }

    if (!mWereSearchResultsSeen && mLoadedSearchUrlTimeMs != 0L) {
        removeLastSearchVisit();
    }

    // Clear the timestamp. This is to avoid future calls to hideContextualSearch clearing
    // the current URL.
    mLoadedSearchUrlTimeMs = 0L;
    mWereSearchResultsSeen = false;

    mSearchRequest = null;

    if (mIsShowingPeekPromo || mWouldShowPeekPromo) {
        mPolicy.logPeekPromoMetrics(mIsShowingPeekPromo, mWouldShowPeekPromo);
    }

    if (mIsShowingPromo && !mDidLogPromoOutcome && mSearchPanel.wasPromoInteractive()) {
        ContextualSearchUma.logPromoOutcome(mWasActivatedByTap, mIsMandatoryPromo);
        mDidLogPromoOutcome = true;
    }

    mIsShowingPromo = false;
    mSearchPanel.setIsPromoActive(false, false);
    notifyHideContextualSearch();
}
 
Example #4
Source File: ContextualSearchManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onCloseContextualSearch(StateChangeReason reason) {
    if (mSearchPanel == null) return;

    mSelectionController.onSearchEnded(reason);

    // Show the infobar container if it was visible before Contextual Search was shown.
    if (mWereInfoBarsHidden) {
        mWereInfoBarsHidden = false;
        InfoBarContainer container = getInfoBarContainer();
        if (container != null) {
            container.setIsObscuredByOtherView(false);
        }
    }

    if (!mWereSearchResultsSeen && mLoadedSearchUrlTimeMs != 0L) {
        removeLastSearchVisit();
    }

    // Clear the timestamp. This is to avoid future calls to hideContextualSearch clearing
    // the current URL.
    mLoadedSearchUrlTimeMs = 0L;
    mWereSearchResultsSeen = false;

    mSearchRequest = null;

    if (mIsShowingPeekPromo || mWouldShowPeekPromo) {
        mPolicy.logPeekPromoMetrics(mIsShowingPeekPromo, mWouldShowPeekPromo);
    }

    if (mIsShowingPromo && !mDidLogPromoOutcome && mSearchPanel.wasPromoInteractive()) {
        ContextualSearchUma.logPromoOutcome(mWasActivatedByTap, mIsMandatoryPromo);
        mDidLogPromoOutcome = true;
    }

    mIsShowingPromo = false;
    mSearchPanel.setIsPromoActive(false, false);
    notifyHideContextualSearch();
}
 
Example #5
Source File: ReaderModeManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onAddInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isFirst) {
    mIsInfoBarContainerShown = true;
    // If the panel is opened past the peeking state, obscure the infobar.
    if (mReaderModePanel != null && mReaderModePanel.isPanelOpened() && container != null) {
        container.setIsObscuredByOtherView(true);
    } else if (isFirst) {
        // Temporarily hides the reader mode button while the infobars are shown.
        closeReaderPanel(StateChangeReason.INFOBAR_SHOWN, false);
    }
}
 
Example #6
Source File: ReaderModeManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onRemoveInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isLast) {
    // Re-shows the reader mode button if necessary once the infobars are dismissed.
    if (isLast) {
        mIsInfoBarContainerShown = false;
        requestReaderPanelShow(StateChangeReason.INFOBAR_HIDDEN);
    }
}
 
Example #7
Source File: ReaderModeManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Restore any infobars that may have been hidden by Reader Mode.
 */
private void restoreInfobars() {
    if (!mIsInfoBarContainerShown) return;

    Tab curTab = mTabModelSelector.getCurrentTab();
    if (curTab == null) return;

    InfoBarContainer container = curTab.getInfoBarContainer();
    if (container == null) return;

    container.setIsObscuredByOtherView(false);

    // Temporarily hides the reader mode button while the infobars are shown.
    closeReaderPanel(StateChangeReason.INFOBAR_SHOWN, false);
}
 
Example #8
Source File: ContextualSearchManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onCloseContextualSearch(StateChangeReason reason) {
    if (mSearchPanel == null) return;

    mSelectionController.onSearchEnded(reason);

    // Show the infobar container if it was visible before Contextual Search was shown.
    if (mWereInfoBarsHidden) {
        mWereInfoBarsHidden = false;
        InfoBarContainer container = getInfoBarContainer();
        if (container != null) {
            container.setIsObscuredByOtherView(false);
        }
    }

    if (!mWereSearchResultsSeen && mLoadedSearchUrlTimeMs != 0L) {
        removeLastSearchVisit();
    }

    // Clear the timestamp. This is to avoid future calls to hideContextualSearch clearing
    // the current URL.
    mLoadedSearchUrlTimeMs = 0L;
    mWereSearchResultsSeen = false;

    mSearchRequest = null;

    if (mIsShowingPeekPromo || mWouldShowPeekPromo) {
        mPolicy.logPeekPromoMetrics(mIsShowingPeekPromo, mWouldShowPeekPromo);
    }

    if (mIsShowingPromo && !mDidLogPromoOutcome && mSearchPanel.wasPromoInteractive()) {
        ContextualSearchUma.logPromoOutcome(mWasActivatedByTap, mIsMandatoryPromo);
        mDidLogPromoOutcome = true;
    }

    mIsShowingPromo = false;
    mSearchPanel.setIsPromoActive(false, false);
    notifyHideContextualSearch();
}
 
Example #9
Source File: ReaderModeManager.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void onAddInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isFirst) {
    mIsInfoBarContainerShown = true;
    // If the panel is opened past the peeking state, obscure the infobar.
    if (mReaderModePanel != null && mReaderModePanel.isPanelOpened() && container != null) {
        container.setIsObscuredByOtherView(true);
    } else if (isFirst) {
        // Temporarily hides the reader mode button while the infobars are shown.
        closeReaderPanel(StateChangeReason.INFOBAR_SHOWN, false);
    }
}
 
Example #10
Source File: ReaderModeManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Restore any infobars that may have been hidden by Reader Mode.
 */
private void restoreInfobars() {
    if (!mIsInfoBarContainerShown) return;

    Tab curTab = mTabModelSelector.getCurrentTab();
    if (curTab == null) return;

    InfoBarContainer container = curTab.getInfoBarContainer();
    if (container == null) return;

    container.setIsObscuredByOtherView(false);

    // Temporarily hides the reader mode button while the infobars are shown.
    closeReaderPanel(StateChangeReason.INFOBAR_SHOWN, false);
}
 
Example #11
Source File: ReaderModeManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onRemoveInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isLast) {
    // Re-shows the reader mode button if necessary once the infobars are dismissed.
    if (isLast) {
        mIsInfoBarContainerShown = false;
        requestReaderPanelShow(StateChangeReason.INFOBAR_HIDDEN);
    }
}
 
Example #12
Source File: ReaderModeManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onAddInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isFirst) {
    mIsInfoBarContainerShown = true;
    // If the panel is opened past the peeking state, obscure the infobar.
    if (mReaderModePanel != null && mReaderModePanel.isPanelOpened() && container != null) {
        container.setIsObscuredByOtherView(true);
    } else if (isFirst) {
        // Temporarily hides the reader mode button while the infobars are shown.
        closeReaderPanel(StateChangeReason.INFOBAR_SHOWN, false);
    }
}
 
Example #13
Source File: ContextualSearchManager.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Accessor for the {@code InfoBarContainer} currently attached to the {@code Tab}.
 */
private InfoBarContainer getInfoBarContainer() {
    Tab tab = mActivity.getActivityTab();
    return tab == null ? null : tab.getInfoBarContainer();
}
 
Example #14
Source File: Tab.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * @return The infobar container.
 */
public final InfoBarContainer getInfoBarContainer() {
    return mInfoBarContainer;
}
 
Example #15
Source File: ContextualSearchManager.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/** Accessor for the {@code InfoBarContainer} currently attached to the {@code Tab}. */
private InfoBarContainer getInfoBarContainer() {
    Tab tab = mActivity.getActivityTab();
    return tab == null ? null : tab.getInfoBarContainer();
}
 
Example #16
Source File: Tab.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * @return The infobar container.
 */
public final InfoBarContainer getInfoBarContainer() {
    return mInfoBarContainer;
}
 
Example #17
Source File: Tab.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * @return The infobar container.
 */
public final InfoBarContainer getInfoBarContainer() {
    return mInfoBarContainer;
}
 
Example #18
Source File: ContextualSearchManager.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Accessor for the {@code InfoBarContainer} currently attached to the {@code Tab}.
 */
private InfoBarContainer getInfoBarContainer() {
    Tab tab = mActivity.getActivityTab();
    return tab == null ? null : tab.getInfoBarContainer();
}
 
Example #19
Source File: ChromeActivity.java    From AndroidChromium with Apache License 2.0 3 votes vote down vote up
/**
 * Called when the accessibility status of this device changes.  This might be triggered by
 * touch exploration or general accessibility status updates.  It is an aggregate of two other
 * accessibility update methods.
 * @see #onAccessibilityModeChanged(boolean)
 * @see #onTouchExplorationStateChanged(boolean)
 * @param enabled Whether or not accessibility and touch exploration are currently enabled.
 */
protected void onAccessibilityModeChanged(boolean enabled) {
    InfoBarContainer.setIsAllowedToAutoHide(!enabled);
    if (mToolbarManager != null) mToolbarManager.onAccessibilityStatusChanged(enabled);
    if (mContextualSearchManager != null) {
        mContextualSearchManager.onAccessibilityModeChanged(enabled);
    }
}
 
Example #20
Source File: ChromeActivity.java    From delion with Apache License 2.0 3 votes vote down vote up
/**
 * Called when the accessibility status of this device changes.  This might be triggered by
 * touch exploration or general accessibility status updates.  It is an aggregate of two other
 * accessibility update methods.
 * @see #onAccessibilityModeChanged(boolean)
 * @see #onTouchExplorationStateChanged(boolean)
 * @param enabled Whether or not accessibility and touch exploration are currently enabled.
 */
protected void onAccessibilityModeChanged(boolean enabled) {
    InfoBarContainer.setIsAllowedToAutoHide(!enabled);
    if (mToolbarManager != null) mToolbarManager.onAccessibilityStatusChanged(enabled);
    if (mContextualSearchManager != null) {
        mContextualSearchManager.onAccessibilityModeChanged(enabled);
    }
}
 
Example #21
Source File: ChromeActivity.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 * Called when the accessibility status of this device changes.  This might be triggered by
 * touch exploration or general accessibility status updates.  It is an aggregate of two other
 * accessibility update methods.
 * @see #onAccessibilityModeChanged(boolean)
 * @see #onTouchExplorationStateChanged(boolean)
 * @param enabled Whether or not accessibility and touch exploration are currently enabled.
 */
protected void onAccessibilityModeChanged(boolean enabled) {
    InfoBarContainer.setIsAllowedToAutoHide(!enabled);
    if (mToolbarManager != null) mToolbarManager.onAccessibilityStatusChanged(enabled);
    if (mContextualSearchManager != null) {
        mContextualSearchManager.onAccessibilityModeChanged(enabled);
    }
}
 
Example #22
Source File: TabBase.java    From android-chromium with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 *
 * @return The infobar container.
 */
public final InfoBarContainer getInfoBarContainer() {
    return mInfoBarContainer;
}
 
Example #23
Source File: TabBase.java    From android-chromium with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 *
 * @return The infobar container.
 */
public final InfoBarContainer getInfoBarContainer() {
    return mInfoBarContainer;
}