Implement a ContentSuggestionsProvider (see https://bugs.chromium.org/p/chromium/issues/detail?id=619560) that reads from the OfflinePageModel. https://docs.google.com/document/d/1DsI3e2QPKuWezngOkAozap15FeS6J3Axebl_NoVDVas/edit
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5044dec1802c333acca98268df660ccee3ddbd8d commit 5044dec1802c333acca98268df660ccee3ddbd8d Author: pke <pke@google.com> Date: Mon Jul 18 17:40:15 2016 Implement first version of OfflinePageSuggestionsProvider Implement a ContentSuggestionsProvider that reads from the OfflinePageModel, converts to ContentSuggestions and provides those to the ContentSuggestionsService. Add a chrome-flag to enable the provider and implement a factory that registers the provider with the service. The implementation is not usable by users, yet, because extraction of title, snippet text and image is not implemented. Those fields are filled with dummy data or left empty. Deduplication, sorting and discarding are also not implemented. But the OfflinePageSuggestionsProvider serves as an example for other ContentSuggestionsProvider implementations and it can be used to test multiple-section UI implementations. BUG= 628198 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation;master.tryserver.chromium.linux:closure_compilation Review-Url: https://codereview.chromium.org/2149453004 Cr-Commit-Position: refs/heads/master@{#406028} [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/app/generated_resources.grd [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/browser/about_flags.cc [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/browser/android/chrome_feature_list.cc [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/browser/android/chrome_feature_list.h [add] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/browser/android/ntp/offline_page_suggestions_provider_factory.cc [add] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/browser/android/ntp/offline_page_suggestions_provider_factory.h [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/browser/ntp_snippets/content_suggestions_service_factory.h [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/browser/ntp_snippets/ntp_snippets_service_factory.h [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/browser/profiles/profile_manager.cc [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/browser/resources/snippets_internals.html [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/browser/ui/webui/snippets_internals_message_handler.cc [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/chrome/chrome_browser.gypi [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/components/ntp_snippets.gypi [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/components/ntp_snippets/BUILD.gn [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/components/ntp_snippets/content_suggestions_category.h [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/components/ntp_snippets/ntp_snippets_service.cc [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/components/ntp_snippets/ntp_snippets_service.h [add] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/components/ntp_snippets/offline_pages/DEPS [add] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc [add] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h [modify] https://crrev.com/5044dec1802c333acca98268df660ccee3ddbd8d/components/offline_pages/background/BUILD.gn
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c7c00479f3e57375b15c430b4057a51f8c2ce3e5 commit c7c00479f3e57375b15c430b4057a51f8c2ce3e5 Author: pke <pke@google.com> Date: Fri Aug 12 08:24:11 2016 Make OfflinePage ContentSuggestions dismissable Make MakeUniqueID and friends const methods. Add a new pref to store the IDs of all dismissed offline pages. Add methods in OfflinePageSuggestionsProvider to store and load these IDs. Modify OnOfflinePagesLoaded to only forward non-dismissed items. Implement ClearDismissedSuggestionsForDebugging and a temporary version for GetDismissedSuggestionsForDebugging (the Snippets Internals will need refactoring for this to work properly). BUG= 628198 Review-Url: https://codereview.chromium.org/2236303002 Cr-Commit-Position: refs/heads/master@{#411579} [modify] https://crrev.com/c7c00479f3e57375b15c430b4057a51f8c2ce3e5/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc [modify] https://crrev.com/c7c00479f3e57375b15c430b4057a51f8c2ce3e5/chrome/browser/prefs/browser_prefs.cc [modify] https://crrev.com/c7c00479f3e57375b15c430b4057a51f8c2ce3e5/components/ntp_snippets/content_suggestions_provider.cc [modify] https://crrev.com/c7c00479f3e57375b15c430b4057a51f8c2ce3e5/components/ntp_snippets/content_suggestions_provider.h [modify] https://crrev.com/c7c00479f3e57375b15c430b4057a51f8c2ce3e5/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc [modify] https://crrev.com/c7c00479f3e57375b15c430b4057a51f8c2ce3e5/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h [modify] https://crrev.com/c7c00479f3e57375b15c430b4057a51f8c2ce3e5/components/ntp_snippets/pref_names.cc [modify] https://crrev.com/c7c00479f3e57375b15c430b4057a51f8c2ce3e5/components/ntp_snippets/pref_names.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c4fe8dd8b922142e6c3499369007688fd087bfcb commit c4fe8dd8b922142e6c3499369007688fd087bfcb Author: pke <pke@google.com> Date: Fri Aug 12 14:34:41 2016 Split OfflinePageSuggestions into two categories Add separate flags for enabling the recent tabs and downloads sections. Update flags shown on snippets-internals page. Modify the OfflinePageSuggestionsProvider to handle the two categories, especially to split the OfflinePageItems coming from the OfflinePageModel into two distinct lists ordered by the last accessed date. Use the title from the OfflinePageItem, if available; use the URL as a fallback otherwise. Add more-button actions for Recent Tabs and Downloads to open the respective native UIs. TBR=cpu@chromium.org (for generated_resources.grd) BUG= 628198 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Review-Url: https://codereview.chromium.org/2245583002 Cr-Commit-Position: refs/heads/master@{#411645} [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ActionListItem.java [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/chrome/app/generated_resources.grd [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/chrome/browser/about_flags.cc [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/chrome/browser/resources/snippets_internals.html [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/chrome/browser/ui/webui/snippets_internals_message_handler.cc [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/components/ntp_snippets/category.h [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/components/ntp_snippets/category_factory.cc [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/components/ntp_snippets/content_suggestions_service_unittest.cc [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/components/ntp_snippets/features.cc [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/components/ntp_snippets/features.h [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/components/ntp_snippets/pref_names.cc [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/components/ntp_snippets/pref_names.h [modify] https://crrev.com/c4fe8dd8b922142e6c3499369007688fd087bfcb/components/ntp_snippets_strings.grdp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/2a48f8508b52e518696495338ea4ed7f9b7e6060 commit 2a48f8508b52e518696495338ea4ed7f9b7e6060 Author: pke <pke@google.com> Date: Thu Aug 18 13:33:52 2016 Remove deleted offline page suggestions from opened NTPs Add OnSuggestionInvalidated methods to the ContentSuggestionsProvider, the ContentSuggestionsService and its observer and to the SnippetsBridge. Remove suggestions from the UI immediately when they're invalidated. Invalidate offline page suggestions when the referenced offline page is deleted, and also clear it from the dismissed_ids list. Add new unit tests for the UI layer and the service layer. BUG= 628198 Review-Url: https://codereview.chromium.org/2244793002 Cr-Commit-Position: refs/heads/master@{#412813} [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SuggestionsSource.java [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.java [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/chrome/browser/android/ntp/ntp_snippets_bridge.cc [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/chrome/browser/android/ntp/ntp_snippets_bridge.h [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/chrome/browser/ui/webui/snippets_internals_message_handler.cc [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/chrome/browser/ui/webui/snippets_internals_message_handler.h [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/components/ntp_snippets/category_factory.h [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/components/ntp_snippets/content_suggestions_provider.h [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/components/ntp_snippets/content_suggestions_service.cc [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/components/ntp_snippets/content_suggestions_service.h [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/components/ntp_snippets/content_suggestions_service_unittest.cc [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/components/ntp_snippets/mock_content_suggestions_provider_observer.h [modify] https://crrev.com/2a48f8508b52e518696495338ea4ed7f9b7e6060/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/0ad1a7e948c22a60d3f640205c2da2efffcd6113 commit 0ad1a7e948c22a60d3f640205c2da2efffcd6113 Author: pke <pke@google.com> Date: Thu Aug 18 14:49:21 2016 Refactor OfflinePageSuggestionsProvider dismissed ID handling Remove the members storing the IDs; access prefs directly instead. Change the read and store methods to take the category as a parameter to simplify the calling code. Move suggestion invalidation out of OfflinePageDeleted into a dedicated helper method to avoid code duplication. BUG= 628198 Review-Url: https://codereview.chromium.org/2251743002 Cr-Commit-Position: refs/heads/master@{#412823} [modify] https://crrev.com/0ad1a7e948c22a60d3f640205c2da2efffcd6113/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc [modify] https://crrev.com/0ad1a7e948c22a60d3f640205c2da2efffcd6113/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68 commit de0dd9f4b9a81eb0f168fbf1311a6b315f092b68 Author: pke <pke@google.com> Date: Tue Aug 23 09:18:11 2016 Make GetDismissedSuggestionsForDebugging asynchronous Use callback instead of return value for GetDismissedSuggestionsForDebugging in ContentSuggestionsProvider and ContentSuggestionsService. Change the implementations of all providers accordingly. Change the SnippetsInternals to fetch the dismissed suggestions asynchronously only if the corresponding UI is visible. Adjust unit tests. Change the implementation in OfflinePageSuggestionsProvider to return the actual suggestions instead of dummies. BUG= 628198 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Review-Url: https://codereview.chromium.org/2260783002 Cr-Commit-Position: refs/heads/master@{#413699} [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/chrome/browser/resources/snippets_internals.html [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/chrome/browser/resources/snippets_internals.js [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/chrome/browser/ui/webui/snippets_internals_message_handler.cc [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/chrome/browser/ui/webui/snippets_internals_message_handler.h [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.h [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/content_suggestions_provider.h [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/content_suggestions_service.cc [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/content_suggestions_service.h [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/content_suggestions_service_unittest.cc [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/ntp_snippets_service.cc [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/ntp_snippets_service.h [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/ntp_snippets_service_unittest.cc [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.cc [modify] https://crrev.com/de0dd9f4b9a81eb0f168fbf1311a6b315f092b68/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5fe00b8dfc81a113eb3d02641cf71daff59b5fa0 commit 5fe00b8dfc81a113eb3d02641cf71daff59b5fa0 Author: pke <pke@google.com> Date: Tue Aug 30 06:17:10 2016 Add OfflinePageSuggestionsProviderTest BUG= 628198 Review-Url: https://codereview.chromium.org/2279223002 Cr-Commit-Position: refs/heads/master@{#415211} [modify] https://crrev.com/5fe00b8dfc81a113eb3d02641cf71daff59b5fa0/components/ntp_snippets/BUILD.gn [modify] https://crrev.com/5fe00b8dfc81a113eb3d02641cf71daff59b5fa0/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h [add] https://crrev.com/5fe00b8dfc81a113eb3d02641cf71daff59b5fa0/components/ntp_snippets/offline_pages/offline_page_suggestions_provider_unittest.cc
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e92cad1f144ad608599fb56eba9dc49b20a31da4 commit e92cad1f144ad608599fb56eba9dc49b20a31da4 Author: perkj <perkj@chromium.org> Date: Tue Aug 30 07:27:10 2016 Revert of Add OfflinePageSuggestionsProviderTest (patchset #10 id:180001 of https://codereview.chromium.org/2279223002/ ) Reason for revert: Fails on Chrome os. https://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Tests%20%281%29/builds/25426 Original issue's description: > Add OfflinePageSuggestionsProviderTest > > BUG= 628198 > > Committed: https://crrev.com/5fe00b8dfc81a113eb3d02641cf71daff59b5fa0 > Cr-Commit-Position: refs/heads/master@{#415211} TBR=treib@chromium.org,tschumann@chromium.org,dsansome@chromium.org,pke@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= 628198 Review-Url: https://codereview.chromium.org/2297493002 Cr-Commit-Position: refs/heads/master@{#415231} [modify] https://crrev.com/e92cad1f144ad608599fb56eba9dc49b20a31da4/components/ntp_snippets/BUILD.gn [modify] https://crrev.com/e92cad1f144ad608599fb56eba9dc49b20a31da4/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h [delete] https://crrev.com/07846616d126fafc699b3c8e8edad379c16dfeda/components/ntp_snippets/offline_pages/offline_page_suggestions_provider_unittest.cc
Comment 1 by treib@chromium.org
, Jul 14 2016