OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_ITEM_H_ | 5 #ifndef COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_ITEM_H_ |
6 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_ITEM_H_ | 6 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_ITEM_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 26 matching lines...) Expand all Loading... |
37 void AddPreviewNavigation(bool opt_out, base::Time entry_time); | 37 void AddPreviewNavigation(bool opt_out, base::Time entry_time); |
38 | 38 |
39 // Whether the host name corresponding to |this| should be disallowed from | 39 // Whether the host name corresponding to |this| should be disallowed from |
40 // showing previews. | 40 // showing previews. |
41 bool IsBlackListed(base::Time now) const; | 41 bool IsBlackListed(base::Time now) const; |
42 | 42 |
43 base::Optional<base::Time> most_recent_opt_out_time() const { | 43 base::Optional<base::Time> most_recent_opt_out_time() const { |
44 return most_recent_opt_out_time_; | 44 return most_recent_opt_out_time_; |
45 } | 45 } |
46 | 46 |
| 47 size_t OptOutRecordsSizeForTesting() const; |
| 48 |
47 private: | 49 private: |
48 // A previews navigation to this host is represented by time and whether the | 50 // A previews navigation to this host is represented by time and whether the |
49 // navigation was an opt out. | 51 // navigation was an opt out. |
50 struct OptOutRecord { | 52 struct OptOutRecord { |
51 OptOutRecord(base::Time entry_time, bool opt_out); | 53 OptOutRecord(base::Time entry_time, bool opt_out); |
52 ~OptOutRecord() {} | 54 ~OptOutRecord() {} |
53 const base::Time | 55 const base::Time |
54 entry_time; // The time that the opt out state was determined. | 56 entry_time; // The time that the opt out state was determined. |
55 const bool opt_out; // Whether the user opt out of the preview. | 57 const bool opt_out; // Whether the user opt out of the preview. |
56 }; | 58 }; |
(...skipping 14 matching lines...) Expand all Loading... |
71 | 73 |
72 // The total number of opt outs currently in |opt_out_records_|. | 74 // The total number of opt outs currently in |opt_out_records_|. |
73 int total_opt_out_; | 75 int total_opt_out_; |
74 | 76 |
75 DISALLOW_COPY_AND_ASSIGN(PreviewsBlackListItem); | 77 DISALLOW_COPY_AND_ASSIGN(PreviewsBlackListItem); |
76 }; | 78 }; |
77 | 79 |
78 } // namespace previews | 80 } // namespace previews |
79 | 81 |
80 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_ITEM_H_ | 82 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_ITEM_H_ |
OLD | NEW |