зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1280539 - don't open topsites into reader view if stored as offline reader-view page r=sebastian
By default, i.e. for most lists in the homepanels, we want to open the offline reader-view version of a page if the page is stored as an offline reader-view bookmark (TwoLinePageRow shows the bookmark and offline status for pages, not only in bookmarks, but also in the list of top sites, awesomescreen results, and history). The only exception is the topsites grid, where we don't offer any indication of the bookmark or offline status of a page. For now the expectation is that topsites open the normal version of a page, so we need to bypass the usual flow for that case. (It's possible the UI around this would change in future, but with the current UI this is probably the most obvious / least frustrating behaviour.) MozReview-Commit-ID: BMpGG4KQ62w --HG-- extra : rebase_source : a223304451e46e1c0429c5b3bcd9be6d43bf9428 extra : amend_source : 462ea5b54781fd8c534a4a4a484fd60714e3f40d
This commit is contained in:
Родитель
67c3ad7930
Коммит
ac79e826e2
|
@ -3846,7 +3846,16 @@ public class BrowserApp extends GeckoApp
|
|||
intent.setData(Uri.parse(url));
|
||||
startActivity(intent);
|
||||
} else {
|
||||
final String pageURL = SavedReaderViewHelper.getReaderURLIfCached(getContext(), url);
|
||||
// By default this listener is used for lists where the offline reader-view icon
|
||||
// is shown - hence we need to redirect to the reader-view page by default.
|
||||
// However there are some cases where we might not want to use this, e.g.
|
||||
// for topsites where we do not indicate that a page is an offline reader-view bookmark too.
|
||||
final String pageURL;
|
||||
if (!flags.contains(OnUrlOpenListener.Flags.NO_READER_VIEW)) {
|
||||
pageURL = SavedReaderViewHelper.getReaderURLIfCached(getContext(), url);
|
||||
} else {
|
||||
pageURL = url;
|
||||
}
|
||||
|
||||
if (!maybeSwitchToTab(pageURL, flags)) {
|
||||
openUrlAndStopEditing(pageURL);
|
||||
|
|
|
@ -78,7 +78,12 @@ public class HomePager extends ViewPager {
|
|||
public interface OnUrlOpenListener {
|
||||
public enum Flags {
|
||||
ALLOW_SWITCH_TO_TAB,
|
||||
OPEN_WITH_INTENT
|
||||
OPEN_WITH_INTENT,
|
||||
/**
|
||||
* Ensure that the raw URL is opened. If not set, then the reader view version of the page
|
||||
* might be opened if the URL is stored as an offline reader-view bookmark.
|
||||
*/
|
||||
NO_READER_VIEW
|
||||
}
|
||||
|
||||
public void onUrlOpen(String url, EnumSet<Flags> flags);
|
||||
|
|
|
@ -222,7 +222,7 @@ public class TopSitesPanel extends HomeFragment {
|
|||
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, method, extra);
|
||||
|
||||
mUrlOpenListener.onUrlOpen(url, EnumSet.noneOf(OnUrlOpenListener.Flags.class));
|
||||
mUrlOpenListener.onUrlOpen(url, EnumSet.of(OnUrlOpenListener.Flags.NO_READER_VIEW));
|
||||
}
|
||||
} else {
|
||||
if (mEditPinnedSiteListener != null) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче