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

Unified Diff: components/ntp_snippets/reading_list/reading_list_distillation_state_util.cc

Issue 2780793002: Add extra information for ReadingList ContentSuggestion (Closed)
Patch Set: Address comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/reading_list/reading_list_distillation_state_util.cc
diff --git a/components/ntp_snippets/reading_list/reading_list_distillation_state_util.cc b/components/ntp_snippets/reading_list/reading_list_distillation_state_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..996c50d76375224ca8500974502d8c19082372dc
--- /dev/null
+++ b/components/ntp_snippets/reading_list/reading_list_distillation_state_util.cc
@@ -0,0 +1,49 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/ntp_snippets/reading_list/reading_list_distillation_state_util.h"
+
+namespace ntp_snippets {
+
+ReadingListEntry::DistillationState ReadingListStateFromSuggestionState(
+ ReadingListSuggestionExtra::ReadingListSuggestionDistilledState
+ distilled_state) {
+ switch (distilled_state) {
+ case ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
+ PROCESSING:
+ return ReadingListEntry::PROCESSING;
+ break;
Marc Treib 2017/03/29 08:24:58 No "break" required after "return"
gambard 2017/03/29 09:54:07 Done.
+ case ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
+ SUCCESS:
+ return ReadingListEntry::PROCESSED;
+ break;
+ case ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
+ FAILURE:
+ return ReadingListEntry::DISTILLATION_ERROR;
+ break;
+ }
+}
Marc Treib 2017/03/29 08:24:58 I think some compilers (Windows?) will force you t
gambard 2017/03/29 09:54:07 Done.
+
+ReadingListSuggestionExtra::ReadingListSuggestionDistilledState
+SuggestionStateFromReadingListState(
+ ReadingListEntry::DistillationState distilled_state) {
+ switch (distilled_state) {
+ case ReadingListEntry::WILL_RETRY:
+ case ReadingListEntry::PROCESSING:
+ case ReadingListEntry::WAITING:
+ return ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
+ PROCESSING;
+ break;
+ case ReadingListEntry::PROCESSED:
+ return ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
+ SUCCESS;
+ break;
+ case ReadingListEntry::DISTILLATION_ERROR:
+ return ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
+ FAILURE;
+ break;
+ }
Marc Treib 2017/03/29 08:24:58 Same here: No "break" after "return", and NOTREACH
gambard 2017/03/29 09:54:07 Done.
+}
+
+} // namespace ntp_snippets

Powered by Google App Engine
This is Rietveld 408576698