Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Issue 2187233002: Add ContentSuggestionsCategoryFactory; Store categories as ints (Closed)

Created:
4 years, 4 months ago by Philipp Keck
Modified:
4 years, 4 months ago
CC:
chromium-reviews, ntp-dev+reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add ContentSuggestionsCategoryFactory; Store categories as ints Replace the ContentSuggestionsCategory enum with a thin wrapper class around an int to allow for categories to be added dynamically at runtime. Add a ContentSuggestionsCategoryFactory, which creates instances and keeps track of the ordering of the categories. Adjust the ContentSuggestionsService to use the category ordering provided by the new factory. Adjust ContentSuggestionsProvider to use the factory for recovering categories from combined IDs and move the provided_categories_ field to subclasses. Adjust the SnippetsBridge to use the new factory. BUG=632320 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Committed: https://crrev.com/31b07944fef8601f52778ce509ac8a5059bfd853 Cr-Commit-Position: refs/heads/master@{#408942}

Patch Set 1 #

Total comments: 94

Patch Set 2 : Marc's comments #

Patch Set 3 : Marc's new comments #

Total comments: 7

Patch Set 4 : Document remote categories order #

Total comments: 8

Patch Set 5 : Tim's and Bernhard's comments #

Patch Set 6 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+496 lines, -202 lines) Patch
M chrome/browser/android/ntp/ntp_snippets_bridge.cc View 1 3 chunks +4 lines, -2 lines 0 comments Download
M chrome/browser/android/ntp/offline_page_suggestions_provider_factory.cc View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/resources/snippets_internals.html View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/snippets_internals_message_handler.cc View 1 2 3 4 5 3 chunks +11 lines, -11 lines 0 comments Download
M components/ntp_snippets.gypi View 1 chunk +3 lines, -0 lines 0 comments Download
M components/ntp_snippets/BUILD.gn View 1 chunk +3 lines, -0 lines 0 comments Download
M components/ntp_snippets/content_suggestions_category.h View 1 2 3 4 1 chunk +50 lines, -2 lines 0 comments Download
A components/ntp_snippets/content_suggestions_category.cc View 1 1 chunk +34 lines, -0 lines 0 comments Download
A components/ntp_snippets/content_suggestions_category_factory.h View 1 2 3 4 1 chunk +62 lines, -0 lines 0 comments Download
A components/ntp_snippets/content_suggestions_category_factory.cc View 1 2 3 4 1 chunk +85 lines, -0 lines 0 comments Download
M components/ntp_snippets/content_suggestions_category_status.h View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download
M components/ntp_snippets/content_suggestions_provider.h View 1 3 chunks +15 lines, -11 lines 0 comments Download
M components/ntp_snippets/content_suggestions_provider.cc View 3 chunks +5 lines, -10 lines 0 comments Download
M components/ntp_snippets/content_suggestions_service.h View 1 4 chunks +26 lines, -9 lines 0 comments Download
M components/ntp_snippets/content_suggestions_service.cc View 1 7 chunks +20 lines, -9 lines 0 comments Download
M components/ntp_snippets/content_suggestions_service_unittest.cc View 1 8 chunks +127 lines, -121 lines 0 comments Download
M components/ntp_snippets/ntp_snippets_service.h View 1 2 3 4 5 4 chunks +5 lines, -0 lines 0 comments Download
M components/ntp_snippets/ntp_snippets_service.cc View 1 2 3 4 5 9 chunks +16 lines, -12 lines 0 comments Download
M components/ntp_snippets/ntp_snippets_service_unittest.cc View 1 2 3 4 5 4 chunks +6 lines, -3 lines 0 comments Download
M components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h View 1 4 chunks +5 lines, -0 lines 0 comments Download
M components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc View 1 5 chunks +13 lines, -8 lines 0 comments Download

Messages

Total messages: 34 (12 generated)
Philipp Keck
PTAL
4 years, 4 months ago (2016-07-28 08:21:55 UTC) #2
Marc Treib
Might be worth filing a separate bug for dynamic categories/ordering, WDYT? https://codereview.chromium.org/2187233002/diff/1/chrome/browser/android/ntp/ntp_snippets_bridge.h File chrome/browser/android/ntp/ntp_snippets_bridge.h (right): ...
4 years, 4 months ago (2016-07-28 11:41:46 UTC) #3
tschumann
https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category.h File components/ntp_snippets/content_suggestions_category.h (right): https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category.h#newcode49 components/ntp_snippets/content_suggestions_category.h:49: inline bool operator==(const KnownSuggestionsCategories& left, On 2016/07/28 11:41:45, Marc ...
4 years, 4 months ago (2016-07-28 12:50:14 UTC) #6
Marc Treib
https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category.h File components/ntp_snippets/content_suggestions_category.h (right): https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category.h#newcode69 components/ntp_snippets/content_suggestions_category.h:69: std::ostream& operator<<(std::ostream& os, On 2016/07/28 12:50:14, tschumann wrote: > ...
4 years, 4 months ago (2016-07-28 12:54:02 UTC) #7
Philipp Keck
Thanks for your comments. Created a new bug. https://codereview.chromium.org/2187233002/diff/1/chrome/browser/android/ntp/ntp_snippets_bridge.h File chrome/browser/android/ntp/ntp_snippets_bridge.h (right): https://codereview.chromium.org/2187233002/diff/1/chrome/browser/android/ntp/ntp_snippets_bridge.h#newcode81 chrome/browser/android/ntp/ntp_snippets_bridge.h:81: ntp_snippets::ContentSuggestionsCategoryFactory* ...
4 years, 4 months ago (2016-07-28 13:50:55 UTC) #9
Marc Treib
LGTM, thanks! https://codereview.chromium.org/2187233002/diff/1/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc File chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc (right): https://codereview.chromium.org/2187233002/diff/1/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc#newcode137 chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc:137: content_suggestions_service->category_factory()); On 2016/07/28 13:50:53, Philipp Keck wrote: ...
4 years, 4 months ago (2016-07-28 14:31:17 UTC) #10
Philipp Keck
https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.cc File components/ntp_snippets/content_suggestions_category_factory.cc (right): https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.cc#newcode22 components/ntp_snippets/content_suggestions_category_factory.cc:22: DCHECK_GE(static_cast<int>(known_category), 0); On 2016/07/28 14:31:16, Marc Treib wrote: > ...
4 years, 4 months ago (2016-07-28 14:55:47 UTC) #11
Philipp Keck
bauerb@chromium.org: Please review changes in chrome/browser/resources/snippets_internals.html chrome/browser/ui/webui/snippets_internals_message_handler.cc
4 years, 4 months ago (2016-07-28 14:56:29 UTC) #13
tschumann
https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category.h File components/ntp_snippets/content_suggestions_category.h (right): https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category.h#newcode69 components/ntp_snippets/content_suggestions_category.h:69: std::ostream& operator<<(std::ostream& os, On 2016/07/28 13:50:54, Philipp Keck wrote: ...
4 years, 4 months ago (2016-07-28 15:03:45 UTC) #14
Marc Treib
https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.h File components/ntp_snippets/content_suggestions_category_factory.h (right): https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.h#newcode26 components/ntp_snippets/content_suggestions_category_factory.h:26: ContentSuggestionsCategory FromRemoteCategory(int remote_id); On 2016/07/28 15:03:45, tschumann wrote: > ...
4 years, 4 months ago (2016-07-28 15:13:26 UTC) #15
Philipp Keck
https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category.h File components/ntp_snippets/content_suggestions_category.h (right): https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category.h#newcode69 components/ntp_snippets/content_suggestions_category.h:69: std::ostream& operator<<(std::ostream& os, On 2016/07/28 15:03:45, tschumann wrote: > ...
4 years, 4 months ago (2016-07-28 15:15:25 UTC) #16
Philipp Keck
https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.h File components/ntp_snippets/content_suggestions_category_factory.h (right): https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.h#newcode26 components/ntp_snippets/content_suggestions_category_factory.h:26: ContentSuggestionsCategory FromRemoteCategory(int remote_id); On 2016/07/28 15:13:26, Marc Treib wrote: ...
4 years, 4 months ago (2016-07-28 15:25:59 UTC) #17
tschumann
https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.h File components/ntp_snippets/content_suggestions_category_factory.h (right): https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.h#newcode26 components/ntp_snippets/content_suggestions_category_factory.h:26: ContentSuggestionsCategory FromRemoteCategory(int remote_id); On 2016/07/28 15:25:58, Philipp Keck wrote: ...
4 years, 4 months ago (2016-07-28 15:36:10 UTC) #18
Bernhard Bauer
lgtm https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.cc File components/ntp_snippets/content_suggestions_category_factory.cc (right): https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.cc#newcode22 components/ntp_snippets/content_suggestions_category_factory.cc:22: DCHECK_GE(static_cast<int>(known_category), 0); On 2016/07/28 15:15:25, Philipp Keck wrote: ...
4 years, 4 months ago (2016-07-28 15:39:27 UTC) #19
Philipp Keck
https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.cc File components/ntp_snippets/content_suggestions_category_factory.cc (right): https://codereview.chromium.org/2187233002/diff/1/components/ntp_snippets/content_suggestions_category_factory.cc#newcode22 components/ntp_snippets/content_suggestions_category_factory.cc:22: DCHECK_GE(static_cast<int>(known_category), 0); On 2016/07/28 15:39:26, Bernhard Bauer wrote: > ...
4 years, 4 months ago (2016-07-28 16:59:59 UTC) #20
tschumann
lgtm didn't look close at the implementation (trusting Marc :-)) but interface and direction looks ...
4 years, 4 months ago (2016-07-28 17:05:16 UTC) #23
Marc Treib
https://codereview.chromium.org/2187233002/diff/60001/components/ntp_snippets/content_suggestions_category.h File components/ntp_snippets/content_suggestions_category.h (right): https://codereview.chromium.org/2187233002/diff/60001/components/ntp_snippets/content_suggestions_category.h#newcode25 components/ntp_snippets/content_suggestions_category.h:25: REMOTE_CATEGORIES_OFFSET = 10000, On 2016/07/28 16:59:58, Philipp Keck wrote: ...
4 years, 4 months ago (2016-07-29 08:20:35 UTC) #26
Philipp Keck
https://codereview.chromium.org/2187233002/diff/60001/components/ntp_snippets/content_suggestions_category.h File components/ntp_snippets/content_suggestions_category.h (right): https://codereview.chromium.org/2187233002/diff/60001/components/ntp_snippets/content_suggestions_category.h#newcode25 components/ntp_snippets/content_suggestions_category.h:25: REMOTE_CATEGORIES_OFFSET = 10000, On 2016/07/29 08:20:35, Marc Treib wrote: ...
4 years, 4 months ago (2016-07-29 08:24:28 UTC) #27
Philipp Keck
The build previously failed because of the IOS factory. That is now removed (https://codereview.chromium.org/2194793004/), so ...
4 years, 4 months ago (2016-08-01 10:41:44 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2187233002/100001
4 years, 4 months ago (2016-08-01 10:42:21 UTC) #31
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 4 months ago (2016-08-01 11:35:20 UTC) #32
commit-bot: I haz the power
4 years, 4 months ago (2016-08-01 11:37:11 UTC) #34
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/31b07944fef8601f52778ce509ac8a5059bfd853
Cr-Commit-Position: refs/heads/master@{#408942}

Powered by Google App Engine
This is Rietveld 408576698