Chromium Code Reviews| Index: components/previews/core/previews_opt_out_store.h |
| diff --git a/components/previews/core/previews_opt_out_store.h b/components/previews/core/previews_opt_out_store.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..aca2af783430b3776f2ffb93848386cb1d879fad |
| --- /dev/null |
| +++ b/components/previews/core/previews_opt_out_store.h |
| @@ -0,0 +1,58 @@ |
| +// 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_CORE_PREVIEWS_OPT_OUT_STORE_H_ |
| +#define COMPONENTS_PREVIEWS_CORE_PREVIEWS_OPT_OUT_STORE_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include <memory> |
| +#include <string> |
| +#include <unordered_map> |
| +#include <vector> |
| + |
| +#include "base/callback.h" |
| +#include "base/time/time.h" |
| +#include "components/previews/core/previews_black_list_item.h" |
| + |
| +class GURL; |
| + |
| +namespace previews { |
| + |
| +enum class PreviewsType { |
| + NONE = 0, |
| + OFFLINE = 1, |
| + LAST = 2, |
| +}; |
| + |
| +typedef std::unordered_map<std::string, std::unique_ptr<PreviewsBlackListItem>> |
| + 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 is possible to issue |
| +// multiple asynchronous operations in parallel and maintain ordering. |
| +class PreviewsOptOutStore { |
| + public: |
| + virtual ~PreviewsOptOutStore() {} |
| + |
| + // Adds a new navigation to the store. |opt_out| is whether the uesr opted out |
|
tbansal1
2016/09/22 21:12:28
typo in uesr.
RyanSturm
2016/09/23 17:23:25
Done.
|
| + // of the preview or navigated away from the page by another way. |
|
tbansal1
2016/09/22 21:12:28
"navigated away from the page by another way" is v
RyanSturm
2016/09/23 17:23:25
Done.
|
| + virtual void AddPreviewNavigation(bool opt_out, |
| + const std::string& host_name, |
| + PreviewsType type, |
| + base::Time now) = 0; |
| + |
| + // Asynchronously loads a map of host names to PreviewsBlackListItem for that |
| + // host from the store. |
|
tbansal1
2016/09/22 21:12:28
Say something about the arguments of the method. e
RyanSturm
2016/09/23 17:23:25
Done.
|
| + virtual void LoadBlackList(LoadBlackListCallback callback) = 0; |
| +}; |
| + |
| +} // namespace previews |
| + |
| +#endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_OPT_OUT_STORE_H_ |