Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(930)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/Tab.java

Issue 877163005: [Android] Fix new tab not to show 'about:blank' at the beginning (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
« no previous file with comments | « no previous file | chrome/browser/ui/toolbar/toolbar_model_impl.cc » ('j') | chrome/browser/ui/toolbar/toolbar_model_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698