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

Unified Diff: components/previews/core/previews_io_data.h

Issue 2388253002: Use the previews black list for offline previews (Closed)
Patch Set: mmenke comments Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/previews/core/previews_decider.h ('k') | components/previews/core/previews_io_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/previews/core/previews_io_data.h
diff --git a/components/previews/core/previews_io_data.h b/components/previews/core/previews_io_data.h
index 5f1efd09b6bd53a8c5f87e5f6021122127f08d20..5dbf65c9fd494d6ed27f03f1a2bc51ec5b96b7c2 100644
--- a/components/previews/core/previews_io_data.h
+++ b/components/previews/core/previews_io_data.h
@@ -6,53 +6,62 @@
#define COMPONENTS_PREVIEWS_CORE_PREVIEWS_IO_DATA_H_
#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/time/time.h"
+#include "components/previews/core/previews_decider.h"
#include "components/previews/core/previews_opt_out_store.h"
class GURL;
+namespace net {
+class URLRequest;
+}
+
namespace previews {
class PreviewsBlackList;
class PreviewsUIService;
// A class to manage the IO portion of inter-thread communication between
// previews/ objects. Created on the UI thread, but used only on the IO thread
// after initialization.
-class PreviewsIOData {
+class PreviewsIOData : public PreviewsDecider {
public:
PreviewsIOData(
const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
- virtual ~PreviewsIOData();
+ ~PreviewsIOData() override;
// Stores |previews_ui_service| as |previews_ui_service_| and posts a task to
// InitializeOnIOThread on the IO thread.
void Initialize(base::WeakPtr<PreviewsUIService> previews_ui_service,
std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store);
// Adds a navigation to |url| to the black list with result |opt_out|.
void AddPreviewNavigation(const GURL& url, bool opt_out, PreviewsType type);
// Clears the history of the black list between |begin_time| and |end_time|,
// both inclusive.
void ClearBlackList(base::Time begin_time, base::Time end_time);
// The previews black list that decides whether a navigation can use previews.
PreviewsBlackList* black_list() const { return previews_black_list_.get(); }
+ // PreviewsDecider implementation:
+ bool ShouldAllowPreview(const net::URLRequest& request,
+ PreviewsType type) const override;
+
protected:
// Posts a task to SetIOData for |previews_ui_service_| on the UI thread with
// a weak pointer to |this|. Virtualized for testing.
virtual void InitializeOnIOThread(
std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store);
private:
// The UI thread portion of the inter-thread communication for previews.
base::WeakPtr<PreviewsUIService> previews_ui_service_;
« no previous file with comments | « components/previews/core/previews_decider.h ('k') | components/previews/core/previews_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698