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

Side by Side Diff: components/previews/core/previews_black_list.h

Issue 2439203002: Adding a short blacklist period after every previews opt out (Closed)
Patch Set: tbansal commetns Created 4 years, 1 month 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
« no previous file with comments | « no previous file | components/previews/core/previews_black_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_H_ 5 #ifndef COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_H_
6 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_H_ 6 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <queue> 11 #include <queue>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/optional.h"
18 #include "base/threading/thread_checker.h" 19 #include "base/threading/thread_checker.h"
20 #include "base/time/time.h"
19 #include "components/previews/core/previews_experiments.h" 21 #include "components/previews/core/previews_experiments.h"
20 #include "components/previews/core/previews_opt_out_store.h" 22 #include "components/previews/core/previews_opt_out_store.h"
21 23
22 class GURL; 24 class GURL;
23 25
24 namespace base { 26 namespace base {
25 class Clock; 27 class Clock;
26 } 28 }
27 29
28 namespace previews { 30 namespace previews {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // Enqueues a task to run when when loading black list information has 99 // Enqueues a task to run when when loading black list information has
98 // completed. Maintains the order that tasks were called in. 100 // completed. Maintains the order that tasks were called in.
99 void QueuePendingTask(base::Closure callback); 101 void QueuePendingTask(base::Closure callback);
100 102
101 // Map maintaining the in-memory black list. 103 // Map maintaining the in-memory black list.
102 std::unique_ptr<BlackListItemMap> black_list_item_map_; 104 std::unique_ptr<BlackListItemMap> black_list_item_map_;
103 105
104 // Whether the black list is done being loaded from the backing store. 106 // Whether the black list is done being loaded from the backing store.
105 bool loaded_; 107 bool loaded_;
106 108
109 // The time of the last opt out for this session.
110 base::Optional<base::Time> last_opt_out_time_;
111
107 // The backing store of the black list information. 112 // The backing store of the black list information.
108 std::unique_ptr<PreviewsOptOutStore> opt_out_store_; 113 std::unique_ptr<PreviewsOptOutStore> opt_out_store_;
109 114
110 // Callbacks to be run after loading information from the backing store has 115 // Callbacks to be run after loading information from the backing store has
111 // completed. 116 // completed.
112 std::queue<base::Closure> pending_callbacks_; 117 std::queue<base::Closure> pending_callbacks_;
113 118
114 std::unique_ptr<base::Clock> clock_; 119 std::unique_ptr<base::Clock> clock_;
115 120
116 base::ThreadChecker thread_checker_; 121 base::ThreadChecker thread_checker_;
117 122
118 base::WeakPtrFactory<PreviewsBlackList> weak_factory_; 123 base::WeakPtrFactory<PreviewsBlackList> weak_factory_;
119 124
120 DISALLOW_COPY_AND_ASSIGN(PreviewsBlackList); 125 DISALLOW_COPY_AND_ASSIGN(PreviewsBlackList);
121 }; 126 };
122 127
123 } // namespace previews 128 } // namespace previews
124 129
125 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_H_ 130 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | components/previews/core/previews_black_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698