Chromium Code Reviews| Index: components/previews/previews_opt_out_store.h |
| diff --git a/components/previews/previews_opt_out_store.h b/components/previews/previews_opt_out_store.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..63e619d633e923118dadb5e6d28b94e132b7dabf |
| --- /dev/null |
| +++ b/components/previews/previews_opt_out_store.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_PREVIEWS_PREVIEWS_OPT_OUT_STORE_H_ |
| +#define COMPONENTS_PREVIEWS_PREVIEWS_OPT_OUT_STORE_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include <vector> |
| + |
| +#include "base/callback.h" |
| +#include "components/previews/previews_black_list_item.h" |
| + |
| +class GURL; |
| + |
| +namespace base { |
| +class Time; |
| +} |
| + |
| +namespace previews { |
| + |
| +enum class PreviewsType { |
| + NONE = 0, |
| + OFFLINE = 1, |
| + LAST = 2, |
| +}; |
| + |
| +typedef std::map<std::string, std::unique_ptr<PreviewsBlackListItem>> |
|
tbansal1
2016/09/14 21:36:26
#include map
memory
string
RyanSturm
2016/09/14 22:41:26
Done.
|
| + BlackListItemMap; |
| + |
| +typedef base::Callback<void(std::unique_ptr<BlackListItemMap>)> |
| + LoadBlackListCallback; |
| + |
| +// PreviewsOptOutStore keeps opt out information for the previews. |
| +// Ability to create multiple instances of the store as well as behavior of |
| +// asynchronous operations when the object is being destroyed, before such |
| +// operation finishes will depend on implementation. It should be possible to |
|
tbansal1
2016/09/14 21:36:26
"should be" sounds vague.
s/should be/is/?
RyanSturm
2016/09/14 22:41:26
Done.
|
| +// issue multiple asynchronous operations in parallel and maintain ordering. |
| +class PreviewsOptOutStore { |
| + public: |
| + PreviewsOptOutStore(); |
| + virtual ~PreviewsOptOutStore(); |
| + |
| + // Adds a new navigation to the store. |opt_out| is whether the uesr opted out |
| + // of the preview or navigated away from the page by another way. |
| + virtual void AddPreviewNavigation(bool opt_out, |
| + const std::string& host_name, |
| + PreviewsType type, |
| + const base::Time& now) = 0; |
|
tbansal1
2016/09/14 21:36:26
Pass Time by value and just include the base/time/
RyanSturm
2016/09/14 22:41:26
Done.
|
| + |
| + // Asynchronously loads a map of host names to PreviewsBlackListItem for that |
| + // host from the store. |
| + virtual void LoadBlackList(LoadBlackListCallback callback) = 0; |
| +}; |
| + |
| +} // namespace previews |
| + |
| +#endif // COMPONENTS_PREVIEWS_PREVIEWS_OPT_OUT_STORE_H_ |