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

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

Issue 2749693003: Reland of Moving previews code from components/ to chrome/ (Closed)
Patch Set: fixed vector copy Created 3 years, 9 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
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 a30ab6ff0764bcf6ce4ce0f443918ca1e6429f42..f6e85331562eaf47f76ed321e31020e3682036ea 100644
--- a/components/previews/core/previews_io_data.h
+++ b/components/previews/core/previews_io_data.h
@@ -8,6 +8,7 @@
#include <memory>
#include <string>
+#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
@@ -27,6 +28,8 @@ class PreviewsBlackList;
class PreviewsOptOutStore;
class PreviewsUIService;
+typedef base::Callback<bool(PreviewsType)> PreviewsIsEnabledCallback;
+
// 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.
@@ -40,7 +43,8 @@ class PreviewsIOData : public PreviewsDecider {
// 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);
+ std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store,
+ const PreviewsIsEnabledCallback& is_enabled_callback);
// Adds a navigation to |url| to the black list with result |opt_out|.
void AddPreviewNavigation(const GURL& url, bool opt_out, PreviewsType type);
@@ -75,6 +79,9 @@ class PreviewsIOData : public PreviewsDecider {
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
+ // Whether the preview is enabled. Valid after Initialize() is called.
+ PreviewsIsEnabledCallback is_enabled_callback_;
+
base::WeakPtrFactory<PreviewsIOData> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(PreviewsIOData);
« no previous file with comments | « components/previews/core/previews_experiments_unittest.cc ('k') | components/previews/core/previews_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698