import org.chromium.chrome.browser.contextmenu.ContextMenuPopulator;
import org.chromium.chrome.browser.contextmenu.ContextMenuPopulatorWrapper;
import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegate;
-import org.chromium.chrome.browser.dom_distiller.FeedbackReporter;
+import org.chromium.chrome.browser.dom_distiller.DomDistillerFeedbackReporter;
import org.chromium.chrome.browser.infobar.AutoLoginProcessor;
import org.chromium.chrome.browser.infobar.InfoBarContainer;
import org.chromium.chrome.browser.profiles.Profile;
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;
private WebContentsObserverAndroid mWebContentsObserver;
private VoiceSearchTabHelper mVoiceSearchTabHelper;
private TabChromeWebContentsDelegateAndroid mWebContentsDelegate;
- private FeedbackReporter mFeedbackReporter;
+ private DomDistillerFeedbackReporter mDomDistillerFeedbackReporter;
/**
* If this tab was opened from another tab, store the id of the tab that
*/
private boolean mGroupedWithParent = true;
+ private boolean mIsClosing = false;
+
/**
* A default {@link ChromeContextMenuItemDelegate} that supports some of the context menu
* functionality.
* 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;
}
/**
}
/**
- * Reloads the current page content if it is a {@link ContentView}.
+ * Reloads the current page content.
*/
public void reload() {
// TODO(dtrainor): Should we try to rebuild the ContentView if it's frozen?
}
/**
- * Reloads the current page content if it is a {@link ContentView}.
+ * Reloads the current page content.
* This version ignores the cache and reloads from the network.
*/
public void reloadIgnoringCache() {
* @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;
}
/**
}
/**
- * @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}.
/**
* 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
mAppBannerManager = new AppBannerManager(this);
}
- if (FeedbackReporter.isEnabled() && mFeedbackReporter == null) {
- mFeedbackReporter = new FeedbackReporter(this);
+ if (DomDistillerFeedbackReporter.isEnabled() && mDomDistillerFeedbackReporter == null) {
+ mDomDistillerFeedbackReporter = new DomDistillerFeedbackReporter(this);
}
for (TabObserver observer : mObservers) observer.onContentChanged(this);
*/
@CalledByNative
public String getUrl() {
- return mContentView != null ? mContentView.getUrl() : "";
+ return mContentViewCore != null ? mContentViewCore.getUrl() : "";
}
/**
*/
@CalledByNative
public String getTitle() {
- return getPageInfo() != null ? getPageInfo().getTitle() : "";
+ if (mNativePage != null) return mNativePage.getTitle();
+ if (mContentViewCore != null) return mContentViewCore.getTitle();
+ return "";
}
/**
}
/**
- * Restores the tab if it is frozen or crashed.
- * @return true iff tab restore was triggered.
+ * Loads the tab if it's not loaded (e.g. because it was killed in background).
+ * @return true iff tab load was triggered
*/
@CalledByNative
- public boolean restoreIfNeeded() {
+ public boolean loadIfNeeded() {
return false;
}
/**
+ * @return Whether or not the tab is in the closing process.
+ */
+ public boolean isClosing() {
+ return mIsClosing;
+ }
+
+ /**
+ * @param closing Whether or not the tab is in the closing process.
+ */
+ public void setClosing(boolean closing) {
+ mIsClosing = closing;
+ }
+
+ /**
* @return The id of the tab that caused this tab to be opened.
*/
public int getParentId() {
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();
}