Adding support for opening URL in new tab from Content
Currently after enabling Tab manager in Chrome, links which supposed to be opened on new tab is not working correctly. This change takes care of opening the link in new tab whenever applicable. Review URL: https://codereview.chromium.org/723973002 Cr-Commit-Position: refs/heads/master@{#304012}
This commit is contained in:
chrome/android
java
src
org
chromium
shell
java
src
org
chromium
chrome
shell
@ -32,6 +32,11 @@ public class ChromeWebContentsDelegateAndroid extends WebContentsDelegateAndroid
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void webContentsCreated(long sourceWebContents, long openerRenderFrameId,
|
||||
String frameName, String targetUrl, long newWebContents) {
|
||||
}
|
||||
|
||||
// Helper functions used to create types that are part of the public interface
|
||||
@CalledByNative
|
||||
private static Rect createRect(int x, int y, int right, int bottom) {
|
||||
|
@ -75,4 +75,8 @@ public class EmptyTabObserver implements TabObserver {
|
||||
|
||||
@Override
|
||||
public void onDidChangeThemeColor(int color) { }
|
||||
|
||||
@Override
|
||||
public void webContentsCreated(Tab tab, long sourceWebContents, long openerRenderFrameId,
|
||||
String frameName, String targetUrl, long newWebContents) { }
|
||||
}
|
||||
|
@ -252,6 +252,15 @@ public class Tab {
|
||||
public void visibleSSLStateChanged() {
|
||||
for (TabObserver observer : mObservers) observer.onSSLStateUpdated(Tab.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void webContentsCreated(long sourceWebContents, long openerRenderFrameId,
|
||||
String frameName, String targetUrl, long newWebContents) {
|
||||
for (TabObserver observer : mObservers) {
|
||||
observer.webContentsCreated(Tab.this, sourceWebContents, openerRenderFrameId,
|
||||
frameName, targetUrl, newWebContents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class TabContextMenuPopulator extends ContextMenuPopulatorWrapper {
|
||||
|
@ -182,4 +182,7 @@ public interface TabObserver {
|
||||
* @param color the new color in ARGB format.
|
||||
*/
|
||||
public void onDidChangeThemeColor(int color);
|
||||
|
||||
public void webContentsCreated(Tab tab, long sourceWebContents, long openerRenderFrameId,
|
||||
String frameName, String targetUrl, long newWebContents);
|
||||
}
|
||||
|
@ -147,5 +147,11 @@ public class ChromeShellTab extends Tab {
|
||||
public boolean isFullscreenForTabOrPending() {
|
||||
return mIsFullscreen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void webContentsCreated(long sourceWebContents, long openerRenderFrameId,
|
||||
String frameName, String targetUrl, long newWebContents) {
|
||||
mTabManager.createTab(targetUrl, TabLaunchType.FROM_LINK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user