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

Side by Side 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, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/ntp_snippets/reading_list/reading_list_distillation_state_u til.h"
6
7 #include "base/logging.h"
8
9 namespace ntp_snippets {
10
11 ReadingListEntry::DistillationState ReadingListStateFromSuggestionState(
12 ReadingListSuggestionExtra::ReadingListSuggestionDistilledState
13 distilled_state) {
14 switch (distilled_state) {
15 case ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
16 PENDING:
17 return ReadingListEntry::WAITING;
18 case ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
19 SUCCESS:
20 return ReadingListEntry::PROCESSED;
21 case ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
22 FAILURE:
23 return ReadingListEntry::DISTILLATION_ERROR;
24 }
25 NOTREACHED();
26 return ReadingListEntry::PROCESSING;
27 }
28
29 ReadingListSuggestionExtra::ReadingListSuggestionDistilledState
30 SuggestionStateFromReadingListState(
31 ReadingListEntry::DistillationState distilled_state) {
32 switch (distilled_state) {
33 case ReadingListEntry::WILL_RETRY:
34 case ReadingListEntry::PROCESSING:
35 case ReadingListEntry::WAITING:
36 return ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
37 PENDING;
38 case ReadingListEntry::PROCESSED:
39 return ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
40 SUCCESS;
41 case ReadingListEntry::DISTILLATION_ERROR:
42 return ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
43 FAILURE;
44 }
45 NOTREACHED();
46 return ReadingListSuggestionExtra::ReadingListSuggestionDistilledState::
47 PENDING;
48 }
49
50 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698