OLD | NEW |
---|---|
(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 PROCESSING: | |
17 return ReadingListEntry::PROCESSING; | |
Olivier
2017/03/30 08:51:11
WAITING seems to be a moew default state than PROC
gambard
2017/03/30 08:59:09
Done.
| |
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 PROCESSING; | |
Olivier
2017/03/30 08:51:11
nit: PROCESSING does not really match WILL_RETRY |
gambard
2017/03/30 08:59:09
Done.
| |
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 PROCESSING; | |
48 } | |
49 | |
50 } // namespace ntp_snippets | |
OLD | NEW |