Index: chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
index 5091dccfc0f094072c2e25a5e3868816c8e5ef91..63569bf84cd479b4fe2e74ca888cd0cf65abe80e 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
@@ -255,6 +255,11 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
private boolean mIsTitleDirectionRtl; |
/** |
+ * The original target URL we may show before web contents opens URL. |
+ */ |
+ private String mOriginalTargetUrl; |
Maria
2015/01/28 18:34:49
should this be final?
|
+ |
+ /** |
* The mInterceptNavigationDelegate will be consulted for top-level frame navigations. This |
* allows presenting the intent picker to the user so that a native Android application can be |
* used if available. |
@@ -626,6 +631,22 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
*/ |
public Tab(int id, int parentId, boolean incognito, Context context, WindowAndroid window, |
TabLaunchType type, TabState frozenState) { |
+ this(id, parentId, incognito, context, window, type, frozenState, null); |
+ } |
+ |
+ /** |
+ * Creates an instance of a {@link Tab}. |
+ * @param id The id this tab should be identified with. |
+ * @param parentId The id id of the tab that caused this tab to be opened. |
+ * @param incognito Whether or not this tab is incognito. |
+ * @param context An instance of a {@link Context}. |
+ * @param window An instance of a {@link WindowAndroid}. |
+ * @param frozenState State containing information about this Tab, if it was persisted. |
+ * @param targetUrl The initial URL that will be shown until we get the correct URL from |
+ * navigationStateChanged. |
+ */ |
+ public Tab(int id, int parentId, boolean incognito, Context context, WindowAndroid window, |
+ TabLaunchType type, TabState frozenState, String targetUrl) { |
// We need a valid Activity Context to build the ContentView with. |
assert context == null || context instanceof Activity; |
@@ -649,6 +670,8 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
assert type == TabLaunchType.FROM_RESTORE; |
restoreFieldsFromState(frozenState); |
} |
+ |
+ if (targetUrl != null) mOriginalTargetUrl = targetUrl; |
David Trainor- moved to gerrit
2015/01/28 19:42:42
Is there no way to populate this in initialize() f
|
} |
/** |
@@ -1486,7 +1509,11 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
mUrl = url; |
} |
- return mUrl != null ? mUrl : ""; |
+ if (TextUtils.isEmpty(mUrl)) { |
+ if (mOriginalTargetUrl != null) return mOriginalTargetUrl; |
David Trainor- moved to gerrit
2015/01/28 19:42:42
Should we always be returning this? Should we cle
|
+ return ""; |
+ } |
+ return mUrl; |
} |
/** |
@@ -2268,6 +2295,10 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
if (view != null) view.requestFocus(); |
} |
+ public String getOriginalTargetUrl() { |
David Trainor- moved to gerrit
2015/01/28 19:42:42
Javadoc
|
+ return mOriginalTargetUrl; |
+ } |
+ |
@CalledByNative |
protected void openNewTab(String url, String extraHeaders, byte[] postData, int disposition, |
boolean hasParent, boolean isRendererInitiated) { |