use of org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator in project AndroidChromium by JackyAndroid.
the class TabWebContentsDelegateAndroid method webContentsCreated.
@Override
public void webContentsCreated(WebContents sourceWebContents, long openerRenderFrameId, String frameName, String targetUrl, WebContents newWebContents) {
RewindableIterator<TabObserver> observers = mTab.getTabObservers();
while (observers.hasNext()) {
observers.next().webContentsCreated(mTab, sourceWebContents, openerRenderFrameId, frameName, targetUrl, newWebContents);
}
// The URL can't be taken from the WebContents if it's paused. Save it for later.
assert mWebContentsUrlMapping == null;
mWebContentsUrlMapping = Pair.create(newWebContents, targetUrl);
// TODO(dfalcantara): Re-remove this once crbug.com/508366 is fixed.
TabCreator tabCreator = mTab.getActivity().getTabCreator(mTab.isIncognito());
if (tabCreator != null && tabCreator.createsTabsAsynchronously()) {
DocumentWebContentsDelegate.getInstance().attachDelegate(newWebContents);
}
}
use of org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator 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;
}
Aggregations