Search in sources :

Example 1 with PolicyAuditor

use of org.chromium.chrome.browser.policy.PolicyAuditor in project AndroidChromium by JackyAndroid.

the class TabWebContentsObserver method didFailLoad.

@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, "");
    }
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) PolicyAuditor(org.chromium.chrome.browser.policy.PolicyAuditor)

Example 2 with PolicyAuditor

use of org.chromium.chrome.browser.policy.PolicyAuditor in project AndroidChromium by JackyAndroid.

the class TabWebContentsObserver method didAttachInterstitialPage.

@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());
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) PolicyAuditor(org.chromium.chrome.browser.policy.PolicyAuditor)

Example 3 with PolicyAuditor

use of org.chromium.chrome.browser.policy.PolicyAuditor in project AndroidChromium by JackyAndroid.

the class TabWebContentsDelegateAndroid method addNewContents.

@CalledByNative
public boolean addNewContents(WebContents sourceWebContents, WebContents webContents, int disposition, Rect initialPosition, boolean userGesture) {
    assert mWebContentsUrlMapping.first == webContents;
    TabCreator tabCreator = mTab.getActivity().getTabCreator(mTab.isIncognito());
    assert tabCreator != null;
    // Grab the URL, which might not be available via the Tab.
    String url = mWebContentsUrlMapping.second;
    mWebContentsUrlMapping = null;
    // Skip opening a new Tab if it doesn't make sense.
    if (mTab.isClosing())
        return false;
    // Creating new Tabs asynchronously requires starting a new Activity to create the Tab,
    // so the Tab returned will always be null.  There's no way to know synchronously
    // whether the Tab is created, so assume it's always successful.
    boolean createdSuccessfully = tabCreator.createTabWithWebContents(mTab, webContents, mTab.getId(), TabLaunchType.FROM_LONGPRESS_FOREGROUND, url);
    boolean success = tabCreator.createsTabsAsynchronously() || createdSuccessfully;
    if (success && disposition == WindowOpenDisposition.NEW_POPUP) {
        PolicyAuditor auditor = ((ChromeApplication) mTab.getApplicationContext()).getPolicyAuditor();
        auditor.notifyAuditEvent(mTab.getApplicationContext(), AuditEvent.OPEN_POPUP_URL_SUCCESS, url, "");
    }
    return success;
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) TabCreator(org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator) PolicyAuditor(org.chromium.chrome.browser.policy.PolicyAuditor) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 4 with PolicyAuditor

use of org.chromium.chrome.browser.policy.PolicyAuditor in project AndroidChromium by JackyAndroid.

the class TabWebContentsObserver method didFinishLoad.

@Override
public void didFinishLoad(long frameId, String validatedUrl, boolean isMainFrame) {
    if (isMainFrame)
        mTab.didFinishPageLoad();
    PolicyAuditor auditor = ((ChromeApplication) mTab.getApplicationContext()).getPolicyAuditor();
    auditor.notifyAuditEvent(mTab.getApplicationContext(), AuditEvent.OPEN_URL_SUCCESS, validatedUrl, "");
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) PolicyAuditor(org.chromium.chrome.browser.policy.PolicyAuditor)

Aggregations

ChromeApplication (org.chromium.chrome.browser.ChromeApplication)4 PolicyAuditor (org.chromium.chrome.browser.policy.PolicyAuditor)4 CalledByNative (org.chromium.base.annotations.CalledByNative)1 TabCreator (org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator)1