From 53b5c9193b7d5d54b8a683db1efda87c3ada7986 Mon Sep 17 00:00:00 2001 From: Filip Gorski Date: Tue, 2 Feb 2016 11:12:19 -0800 Subject: [Offline pages] Fixing restoring bookmarks filter, when offline pages disabled Ensures that when enhanced bookmarks UI is restoring the past filter for content saved offline, and offline pages are disabled, it is treating the state as invalid and reverts to the all bookmarks state. BUG=581976 Review URL: https://codereview.chromium.org/1656103002 Cr-Commit-Position: refs/heads/master@{#372983} (cherry picked from commit d1b363e7940c0b5cbc5eebd333af929b0d60032a) Review URL: https://codereview.chromium.org/1662563002 . Cr-Commit-Position: refs/branch-heads/2623@{#241} Cr-Branched-From: 92d77538a86529ca35f9220bd3cd512cbea1f086-refs/heads/master@{#369907} --- .../browser/enhancedbookmarks/EnhancedBookmarkUIState.java | 10 ++++++++-- .../chrome/browser/enhancedbookmarks/EnhancedBookmarkTest.java | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUIState.java b/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUIState.java index 20dbdf0..21557dd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUIState.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUIState.java @@ -8,6 +8,7 @@ import android.net.Uri; import android.text.TextUtils; import org.chromium.chrome.browser.UrlConstants; +import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; import org.chromium.components.bookmarks.BookmarkId; /** @@ -151,8 +152,13 @@ class EnhancedBookmarkUIState { && !mFolder.equals(bookmarkModel.getRootFolderId()); } - if (mState == STATE_FILTER && mFilter == null) return false; + if (mState == STATE_FILTER) { + if (mFilter == null) return false; + if (mFilter == EnhancedBookmarkFilter.OFFLINE_PAGES) { + return OfflinePageBridge.isEnabled(); + } + } return true; } -} \ No newline at end of file +} diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkTest.java index e21b815..5bfccce 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkTest.java @@ -241,4 +241,12 @@ public class EnhancedBookmarkTest extends ChromeActivityTestCaseBase