Commit fd24a957 authored by mdjones's avatar mdjones Committed by Commit bot

Test that base page is available in Reader Mode

If there is no web contents to distill, stop trying to open the
Reader Mode panel.

BUG=666277

Review-Url: https://codereview.chromium.org/2510093004
Cr-Commit-Position: refs/heads/master@{#434812}
parent 1acc2c42
...@@ -86,10 +86,16 @@ public class ReaderModePanel extends OverlayPanel { ...@@ -86,10 +86,16 @@ public class ReaderModePanel extends OverlayPanel {
mContentViewDelegate.setOverlayPanelContentViewCore(contentView); mContentViewDelegate.setOverlayPanelContentViewCore(contentView);
WebContents distilledWebContents = contentView.getWebContents(); WebContents distilledWebContents = contentView.getWebContents();
if (distilledWebContents == null) return; if (distilledWebContents == null) {
closePanel(StateChangeReason.UNKNOWN, false);
return;
}
WebContents sourceWebContents = mManagerDelegate.getBasePageWebContents(); WebContents sourceWebContents = mManagerDelegate.getBasePageWebContents();
if (sourceWebContents == null) return; if (sourceWebContents == null) {
closePanel(StateChangeReason.UNKNOWN, false);
return;
}
DomDistillerTabUtils.distillAndView(sourceWebContents, distilledWebContents); DomDistillerTabUtils.distillAndView(sourceWebContents, distilledWebContents);
} }
...@@ -255,7 +261,7 @@ public class ReaderModePanel extends OverlayPanel { ...@@ -255,7 +261,7 @@ public class ReaderModePanel extends OverlayPanel {
if (!mTimerRunning && animatingToOpenState) { if (!mTimerRunning && animatingToOpenState) {
mStartTime = System.currentTimeMillis(); mStartTime = System.currentTimeMillis();
mTimerRunning = true; mTimerRunning = true;
if (mManagerDelegate != null) { if (mManagerDelegate != null && mManagerDelegate.getBasePageWebContents() != null) {
String url = mManagerDelegate.getBasePageWebContents().getUrl(); String url = mManagerDelegate.getBasePageWebContents().getUrl();
RapporServiceBridge.sampleDomainAndRegistryFromURL( RapporServiceBridge.sampleDomainAndRegistryFromURL(
"DomDistiller.OpenPanel", url); "DomDistiller.OpenPanel", url);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment