Commit dafc5322 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Clank: use PrefService instead of PrefServiceBridge in dom_distiller

Bug: 1071603
Change-Id: I5661376a98450f3250f9fc6d7614c5558830f983
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2290957Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#787024}
parent 17d969f9
......@@ -10,8 +10,10 @@ import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.preferences.PrefServiceBridge;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.components.navigation_interception.InterceptNavigationDelegate;
import org.chromium.components.user_prefs.UserPrefs;
import org.chromium.content_public.browser.WebContents;
/**
......@@ -97,9 +99,12 @@ public class DomDistillerTabUtils {
* @return True if heuristic is ADABOOST_MODEL, and "Simplified view for accessibility"
* is disabled.
*/
public static boolean shouldExcludeMobileFriendly() {
public static boolean shouldExcludeMobileFriendly(Tab tab) {
if (sExcludeMobileFriendlyForTesting != null) return sExcludeMobileFriendlyForTesting;
return !PrefServiceBridge.getInstance().getBoolean(Pref.READER_FOR_ACCESSIBILITY)
WebContents webContents = tab.getWebContents();
assert webContents != null;
return !UserPrefs.get(Profile.fromWebContents(webContents))
.getBoolean(Pref.READER_FOR_ACCESSIBILITY)
&& getDistillerHeuristics() == DistillerHeuristicsType.ADABOOST_MODEL;
}
......
......@@ -500,9 +500,9 @@ public class ReaderModeManager extends EmptyTabObserver implements UserData {
// Make sure the page didn't navigate while waiting for a response.
if (!tab.getUrlString().equals(mDistillerUrl)) return;
boolean excludedMobileFriendly =
DomDistillerTabUtils.shouldExcludeMobileFriendly() && isMobileOptimized;
if (isDistillable && !excludedMobileFriendly) {
if (isDistillable
&& !(isMobileOptimized
&& DomDistillerTabUtils.shouldExcludeMobileFriendly(tabToObserve))) {
mDistillationStatus = DistillationStatus.POSSIBLE;
tryShowingInfoBar();
} else {
......
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