org.chromium.base.ObserverList.RewindableIterator Java Examples

The following examples show how to use org.chromium.base.ObserverList.RewindableIterator. 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: TabWebContentsObserver.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void didAttachInterstitialPage() {
    mTab.getInfoBarContainer().setVisibility(View.INVISIBLE);
    mTab.showRenderedPage();
    mTab.updateThemeColorIfNeeded(false);

    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidAttachInterstitialPage(mTab);
    }
    mTab.notifyLoadProgress(mTab.getProgress());

    mTab.updateFullscreenEnabledState();

    PolicyAuditor auditor = AppHooks.get().getPolicyAuditor();
    auditor.notifyCertificateFailure(
            PolicyAuditor.nativeGetCertificateFailure(mTab.getWebContents()),
            mTab.getApplicationContext());
}
 
Example #2
Source File: TabWebContentsDelegateAndroid.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void navigationStateChanged(int flags) {
    if ((flags & InvalidateTypes.TAB) != 0) {
        int mediaType = MediaCaptureNotificationService.getMediaType(
                isCapturingAudio(), isCapturingVideo(), isCapturingScreen());
        MediaCaptureNotificationService.updateMediaNotificationForTab(
                mTab.getApplicationContext(), mTab.getId(), mediaType, mTab.getUrl());
    }
    if ((flags & InvalidateTypes.TITLE) != 0) {
        // Update cached title then notify observers.
        mTab.updateTitle();
    }
    if ((flags & InvalidateTypes.URL) != 0) {
        RewindableIterator<TabObserver> observers = mTab.getTabObservers();
        while (observers.hasNext()) {
            observers.next().onUrlUpdated(mTab);
        }
    }
}
 
Example #3
Source File: TabWebContentsObserver.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void didDetachInterstitialPage() {
    mTab.getInfoBarContainer().setVisibility(View.VISIBLE);
    mTab.updateThemeColorIfNeeded(false);

    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidDetachInterstitialPage(mTab);
    }
    mTab.notifyLoadProgress(mTab.getProgress());

    mTab.updateFullscreenEnabledState();

    if (!mTab.maybeShowNativePage(mTab.getUrl(), false)) {
        mTab.showRenderedPage();
    }
}
 
Example #4
Source File: TabWebContentsObserver.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void didAttachInterstitialPage() {
    mTab.getInfoBarContainer().setVisibility(View.INVISIBLE);
    mTab.showRenderedPage();
    mTab.updateThemeColorIfNeeded(false);

    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidAttachInterstitialPage(mTab);
    }
    mTab.notifyLoadProgress(mTab.getProgress());

    mTab.updateFullscreenEnabledState();

    PolicyAuditor auditor =
            ((ChromeApplication) mTab.getApplicationContext()).getPolicyAuditor();
    auditor.notifyCertificateFailure(
            PolicyAuditor.nativeGetCertificateFailure(mTab.getWebContents()),
            mTab.getApplicationContext());
}
 
Example #5
Source File: TabWebContentsObserver.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void didNavigateMainFrame(String url, String baseUrl,
        boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) {
    FullscreenManager fullscreenManager = mTab.getFullscreenManager();
    if (isNavigationToDifferentPage && fullscreenManager != null) {
        fullscreenManager.setPersistentFullscreenMode(false);
    }

    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidNavigateMainFrame(
                mTab, url, baseUrl, isNavigationToDifferentPage,
                isFragmentNavigation, statusCode);
    }

    mTab.stopSwipeRefreshHandler();
}
 
Example #6
Source File: TabWebContentsObserver.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame, int errorCode,
        String description, String failingUrl, boolean wasIgnoredByHandler) {
    mTab.updateThemeColorIfNeeded(true);
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidFailLoad(mTab, isProvisionalLoad, isMainFrame, errorCode,
                description, failingUrl);
    }

    if (isMainFrame) mTab.didFailPageLoad(errorCode);

    PolicyAuditor auditor =
            ((ChromeApplication) mTab.getApplicationContext()).getPolicyAuditor();
    auditor.notifyAuditEvent(mTab.getApplicationContext(), AuditEvent.OPEN_URL_FAILURE,
            failingUrl, description);
    if (errorCode == BLOCKED_BY_ADMINISTRATOR) {
        auditor.notifyAuditEvent(
                mTab.getApplicationContext(), AuditEvent.OPEN_URL_BLOCKED, failingUrl, "");
    }
}
 
Example #7
Source File: TabWebContentsObserver.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void didDetachInterstitialPage() {
    mTab.getInfoBarContainer().setVisibility(View.VISIBLE);
    mTab.updateThemeColorIfNeeded(false);

    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidDetachInterstitialPage(mTab);
    }
    mTab.notifyLoadProgress(mTab.getProgress());

    mTab.updateFullscreenEnabledState();

    if (!mTab.maybeShowNativePage(mTab.getUrl(), false)) {
        mTab.showRenderedPage();
    }
}
 
Example #8
Source File: TabWebContentsDelegateAndroid.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void navigationStateChanged(int flags) {
    if ((flags & InvalidateTypes.TAB) != 0) {
        MediaCaptureNotificationService.updateMediaNotificationForTab(
                mTab.getApplicationContext(), mTab.getId(), isCapturingAudio(),
                isCapturingVideo(), mTab.getUrl());
    }
    if ((flags & InvalidateTypes.TITLE) != 0) {
        // Update cached title then notify observers.
        mTab.updateTitle();
    }
    if ((flags & InvalidateTypes.URL) != 0) {
        RewindableIterator<TabObserver> observers = mTab.getTabObservers();
        while (observers.hasNext()) {
            observers.next().onUrlUpdated(mTab);
        }
    }
}
 
Example #9
Source File: TabWebContentsDelegateAndroid.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void navigationStateChanged(int flags) {
    if ((flags & InvalidateTypes.TAB) != 0) {
        int mediaType = MediaCaptureNotificationService.getMediaType(
                isCapturingAudio(), isCapturingVideo(), isCapturingScreen());
        MediaCaptureNotificationService.updateMediaNotificationForTab(
                mTab.getApplicationContext(), mTab.getId(), mediaType, mTab.getUrl());
    }
    if ((flags & InvalidateTypes.TITLE) != 0) {
        // Update cached title then notify observers.
        mTab.updateTitle();
    }
    if ((flags & InvalidateTypes.URL) != 0) {
        RewindableIterator<TabObserver> observers = mTab.getTabObservers();
        while (observers.hasNext()) {
            observers.next().onUrlUpdated(mTab);
        }
    }
}
 
Example #10
Source File: TabWebContentsObserver.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame, int errorCode,
        String description, String failingUrl, boolean wasIgnoredByHandler) {
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidFailLoad(mTab, isProvisionalLoad, isMainFrame, errorCode,
                description, failingUrl);
    }

    if (isMainFrame) mTab.didFailPageLoad(errorCode);

    PolicyAuditor auditor =
            ((ChromeApplication) mTab.getApplicationContext()).getPolicyAuditor();
    auditor.notifyAuditEvent(mTab.getApplicationContext(), AuditEvent.OPEN_URL_FAILURE,
            failingUrl, description);
    if (errorCode == BLOCKED_BY_ADMINISTRATOR) {
        auditor.notifyAuditEvent(
                mTab.getApplicationContext(), AuditEvent.OPEN_URL_BLOCKED, failingUrl, "");
    }
}
 
Example #11
Source File: TabWebContentsObserver.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void didDetachInterstitialPage() {
    mTab.getInfoBarContainer().setVisibility(View.VISIBLE);
    mTab.updateThemeColorIfNeeded(false);

    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidDetachInterstitialPage(mTab);
    }
    mTab.notifyLoadProgress(mTab.getProgress());

    mTab.updateFullscreenEnabledState();

    if (!mTab.maybeShowNativePage(mTab.getUrl(), false)) {
        mTab.showRenderedPage();
    }
}
 
Example #12
Source File: TabWebContentsObserver.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void didAttachInterstitialPage() {
    mTab.getInfoBarContainer().setVisibility(View.INVISIBLE);
    mTab.showRenderedPage();
    mTab.updateThemeColorIfNeeded(false);

    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidAttachInterstitialPage(mTab);
    }
    mTab.notifyLoadProgress(mTab.getProgress());

    mTab.updateFullscreenEnabledState();

    PolicyAuditor auditor =
            ((ChromeApplication) mTab.getApplicationContext()).getPolicyAuditor();
    auditor.notifyCertificateFailure(
            PolicyAuditor.nativeGetCertificateFailure(mTab.getWebContents()),
            mTab.getApplicationContext());
}
 
Example #13
Source File: TabWebContentsObserver.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void didNavigateMainFrame(String url, String baseUrl,
        boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) {
    FullscreenManager fullscreenManager = mTab.getFullscreenManager();
    if (isNavigationToDifferentPage && fullscreenManager != null) {
        fullscreenManager.setPersistentFullscreenMode(false);
    }

    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidNavigateMainFrame(
                mTab, url, baseUrl, isNavigationToDifferentPage,
                isFragmentNavigation, statusCode);
    }

    mTab.stopSwipeRefreshHandler();
}
 
Example #14
Source File: TabContextMenuPopulator.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void buildContextMenu(ContextMenu menu, Context context, ContextMenuParams params) {
    mPopulator.buildContextMenu(menu, context, params);
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onContextMenuShown(mTab, menu);
    }
}
 
Example #15
Source File: TabWebContentsDelegateAndroid.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void visibleSSLStateChanged() {
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onSSLStateUpdated(mTab);
    }
}
 
Example #16
Source File: Tab.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/** Stop the current navigation. */
public void stopLoading() {
    if (isLoading()) {
        RewindableIterator<TabObserver> observers = getTabObservers();
        while (observers.hasNext()) observers.next().onPageLoadFinished(this);
    }
    if (getWebContents() != null) getWebContents().stop();
}
 
Example #17
Source File: Tab.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Performs any subclass-specific tasks when the Tab crashes.
 */
void handleTabCrash() {
    mIsLoading = false;

    if (mTabUma != null) mTabUma.onRendererCrashed();

    boolean sadTabShown = isShowingSadTab();
    RewindableIterator<TabObserver> observers = getTabObservers();
    while (observers.hasNext()) {
        observers.next().onCrash(this, sadTabShown);
    }
    mIsBeingRestored = false;
}
 
Example #18
Source File: Tab.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Toggles fullscreen mode and notifies all observers.
 * @param enableFullscreen Whether fullscreen should be enabled.
 */
public void toggleFullscreenMode(boolean enableFullscreen) {
    if (mFullscreenManager != null) {
        mFullscreenManager.setPersistentFullscreenMode(enableFullscreen);
    }

    RewindableIterator<TabObserver> observers = getTabObservers();
    while (observers.hasNext()) {
        observers.next().onToggleFullscreenMode(this, enableFullscreen);
    }
}
 
Example #19
Source File: Tab.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Determines if the theme color has changed and notifies the listeners if it has.
 * @param didWebContentsThemeColorChange If the theme color of the web contents is known to have
 *                                       changed.
 */
void updateThemeColorIfNeeded(boolean didWebContentsThemeColorChange) {
    int themeColor = calculateThemeColor(didWebContentsThemeColorChange);
    if (themeColor == mThemeColor) return;
    mThemeColor = themeColor;
    RewindableIterator<TabObserver> observers = getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidChangeThemeColor(this, themeColor);
    }
}
 
Example #20
Source File: Tab.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Notify observers when provisional load starts.
 * @param isMainFrame    Whether the load is happening for the main frame.
 * @param validatedUrl   The validated URL that is being navigated to.
 */
void handleDidStartProvisionalLoadForFrame(boolean isMainFrame, String validatedUrl) {
    RewindableIterator<TabObserver> observers = getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidStartProvisionalLoadForFrame(this, isMainFrame, validatedUrl);
    }
}
 
Example #21
Source File: Tab.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Determines if the theme color has changed and notifies the listeners if it has.
 * @param didWebContentsThemeColorChange If the theme color of the web contents is known to have
 *                                       changed.
 */
void updateThemeColorIfNeeded(boolean didWebContentsThemeColorChange) {
    int themeColor = calculateThemeColor(didWebContentsThemeColorChange);
    if (themeColor == mThemeColor) return;
    mThemeColor = themeColor;
    RewindableIterator<TabObserver> observers = getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidChangeThemeColor(this, themeColor);
    }
}
 
Example #22
Source File: TabWebContentsDelegateAndroid.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void visibleSSLStateChanged() {
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onSSLStateUpdated(mTab);
    }
}
 
Example #23
Source File: TabBlimpContentsObserver.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * All UI updates related to navigation state should be notified from this method.
 */
@Override
public void onNavigationStateChanged() {
    mTab.updateTitle();
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onUrlUpdated(mTab);
    }
}
 
Example #24
Source File: TabWebContentsObserver.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void didFailLoad(
        boolean isMainFrame, int errorCode, String description, String failingUrl) {
    mTab.updateThemeColorIfNeeded(true);
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidFailLoad(mTab, isMainFrame, errorCode, description, failingUrl);
    }

    if (isMainFrame) mTab.didFailPageLoad(errorCode);

    recordErrorInPolicyAuditor(failingUrl, description, errorCode);
}
 
Example #25
Source File: TabWebContentsObserver.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void didStartNavigation(
        String url, boolean isInMainFrame, boolean isSameDocument, boolean isErrorPage) {
    if (isInMainFrame && !isSameDocument) {
        mTab.didStartPageLoad(url, isErrorPage);
    }

    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidStartNavigation(
                mTab, url, isInMainFrame, isSameDocument, isErrorPage);
    }
}
 
Example #26
Source File: TabWebContentsObserver.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void didFirstVisuallyNonEmptyPaint() {
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().didFirstVisuallyNonEmptyPaint(mTab);
    }
}
 
Example #27
Source File: TabContextMenuPopulator.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public List<Pair<Integer, List<ContextMenuItem>>> buildContextMenu(
        ContextMenu menu, Context context, ContextMenuParams params) {
    List<Pair<Integer, List<ContextMenuItem>>> itemGroups =
            mPopulator.buildContextMenu(menu, context, params);
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onContextMenuShown(mTab, menu);
    }
    return itemGroups;
}
 
Example #28
Source File: TabWebContentsDelegateAndroid.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpdateUrl(String url) {
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onUpdateUrl(mTab, url);
    }
}
 
Example #29
Source File: Tab.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/** Stop the current navigation. */
public void stopLoading() {
    if (isLoading()) {
        RewindableIterator<TabObserver> observers = getTabObservers();
        while (observers.hasNext()) {
            observers.next().onPageLoadFinished(this);
        }
    }
    if (getWebContents() != null) getWebContents().stop();
}
 
Example #30
Source File: TabContextMenuPopulator.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void buildContextMenu(ContextMenu menu, Context context, ContextMenuParams params) {
    mPopulator.buildContextMenu(menu, context, params);
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onContextMenuShown(mTab, menu);
    }
}