Java Code Examples for org.chromium.chrome.browser.infobar.InfoBarContainer#setIsObscuredByOtherView()

The following examples show how to use org.chromium.chrome.browser.infobar.InfoBarContainer#setIsObscuredByOtherView() . 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 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 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: 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 5
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 6
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 7
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 8
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 9
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();
}