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

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

Issue 2335023002: Adding a previews IO-thread blacklist (Closed)
Patch Set: tbansal comments Created 4 years, 3 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 2016 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 #ifndef COMPONENTS_PREVIEWS_CORE_PREVIEWS_OPT_OUT_STORE_H_
6 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_OPT_OUT_STORE_H_
7
8 #include <stdint.h>
9
10 #include <memory>
11 #include <string>
12 #include <unordered_map>
13 #include <vector>
14
15 #include "base/callback.h"
16 #include "base/time/time.h"
17 #include "components/previews/core/previews_black_list_item.h"
18
19 class GURL;
20
21 namespace previews {
22
23 enum class PreviewsType {
24 NONE = 0,
25 OFFLINE = 1,
26 LAST = 2,
27 };
28
29 typedef std::unordered_map<std::string, std::unique_ptr<PreviewsBlackListItem>>
30 BlackListItemMap;
31
32 typedef base::Callback<void(std::unique_ptr<BlackListItemMap>)>
33 LoadBlackListCallback;
34
35 // PreviewsOptOutStore keeps opt out information for the previews.
36 // Ability to create multiple instances of the store as well as behavior of
37 // asynchronous operations when the object is being destroyed, before such
38 // operation finishes will depend on implementation. It is possible to issue
39 // multiple asynchronous operations in parallel and maintain ordering.
40 class PreviewsOptOutStore {
41 public:
42 virtual ~PreviewsOptOutStore() {}
43
44 // Adds a new navigation to the store. |opt_out| is whether the user opted out
45 // of the preview.
46 virtual void AddPreviewNavigation(bool opt_out,
47 const std::string& host_name,
48 PreviewsType type,
49 base::Time now) = 0;
50
51 // Asynchronously loads a map of host names to PreviewsBlackListItem for that
52 // host from the store. And runs |callback| once loading is finished.
53 virtual void LoadBlackList(LoadBlackListCallback callback) = 0;
54 };
55
56 } // namespace previews
57
58 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_OPT_OUT_STORE_H_
OLDNEW
« no previous file with comments | « components/previews/core/previews_io_data_unittest.cc ('k') | components/previews/core/previews_ui_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698