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

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

Issue 250923008: Remove PageInfo interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 7ba426f4e0c1f3ff804701a5d557617c5f84d8cb..33f1b73097c33afd0d785ac7a352ae41a4d89e62 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
@@ -32,7 +32,6 @@ import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.LoadUrlParams;
import org.chromium.content.browser.NavigationClient;
import org.chromium.content.browser.NavigationHistory;
-import org.chromium.content.browser.PageInfo;
import org.chromium.content.browser.WebContentsObserverAndroid;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.Clipboard;
@@ -453,8 +452,7 @@ public class Tab implements NavigationClient {
* be {@code null}, if the tab is frozen or being initialized or destroyed.
*/
public View getView() {
- PageInfo pageInfo = getPageInfo();
- return pageInfo != null ? pageInfo.getView() : null;
+ return mNativePage != null ? mNativePage.getView() : mContentView;
}
/**
@@ -535,7 +533,9 @@ public class Tab implements NavigationClient {
* @return The background color of the tab.
*/
public int getBackgroundColor() {
- return getPageInfo() != null ? getPageInfo().getBackgroundColor() : Color.WHITE;
+ if (mNativePage != null) return mNativePage.getBackgroundColor();
+ if (mContentViewCore != null) return mContentViewCore.getBackgroundColor();
+ return Color.WHITE;
}
/**
@@ -590,14 +590,6 @@ public class Tab implements NavigationClient {
}
/**
- * @return A {@link PageInfo} describing the current page. This is always not {@code null}
- * except during initialization, destruction, and when the tab is frozen.
- */
- public PageInfo getPageInfo() {
- return mNativePage != null ? mNativePage : mContentView;
- }
-
- /**
* @return The {@link NativePage} associated with the current page, or {@code null} if there is
* no current page or the current page is displayed using something besides
* {@link NativePage}.
@@ -768,7 +760,7 @@ public class Tab implements NavigationClient {
/**
* Completes the {@link ContentView} specific initialization around a native WebContents
- * pointer. {@link #getPageInfo()} will still return the {@link NativePage} if there is one.
+ * pointer. {@link #getNativePage()} will still return the {@link NativePage} if there is one.
* All initialization that needs to reoccur after a web contents swap should be added here.
* <p />
* NOTE: If you attempt to pass a native WebContents that does not have the same incognito
@@ -868,7 +860,9 @@ public class Tab implements NavigationClient {
*/
@CalledByNative
public String getTitle() {
- return getPageInfo() != null ? getPageInfo().getTitle() : "";
+ if (mNativePage != null) return mNativePage.getTitle();
+ if (mContentViewCore != null) return mContentViewCore.getTitle();
+ return "";
}
/**
@@ -929,7 +923,7 @@ public class Tab implements NavigationClient {
private void destroyNativePageInternal(NativePage nativePage) {
if (nativePage == null) return;
- assert getPageInfo() != nativePage : "Attempting to destroy active page.";
+ assert nativePage != mNativePage : "Attempting to destroy active page.";
nativePage.destroy();
}

Powered by Google App Engine
This is Rietveld 408576698