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

Unified Diff: chrome/browser/previews/previews_service.cc

Issue 2390773003: Adding a SQL implementation of the backing store for previews opt outs (Closed)
Patch Set: table change 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
Index: chrome/browser/previews/previews_service.cc
diff --git a/chrome/browser/previews/previews_service.cc b/chrome/browser/previews/previews_service.cc
index 2ce57a74f2519aeb182f7303e9554673072f2f2b..ae9f773ab6b0165c1bfd1c3eb6481585bd3aca59 100644
--- a/chrome/browser/previews/previews_service.cc
+++ b/chrome/browser/previews/previews_service.cc
@@ -1,22 +1,42 @@
// 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.
#include "chrome/browser/previews/previews_service.h"
+#include "base/files/file_path.h"
+#include "base/memory/ptr_util.h"
+#include "base/sequenced_task_runner.h"
+#include "base/threading/sequenced_worker_pool.h"
+#include "chrome/common/chrome_constants.h"
+#include "components/previews/core/previews_io_data.h"
+#include "components/previews/core/previews_opt_out_store.h"
+#include "components/previews/core/previews_opt_out_store_sql.h"
#include "components/previews/core/previews_ui_service.h"
#include "content/public/browser/browser_thread.h"
PreviewsService::PreviewsService() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
}
PreviewsService::~PreviewsService() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
}
-void PreviewsService::set_previews_ui_service(
- std::unique_ptr<previews::PreviewsUIService> previews_ui_service) {
+void PreviewsService::Initialize(
+ previews::PreviewsIOData* previews_io_data,
+ const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
+ const base::FilePath& profile_path) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- previews_ui_service_ = std::move(previews_ui_service);
+
+ // Get the background thread to run SQLite on.
+ scoped_refptr<base::SequencedTaskRunner> background_task_runner =
+ content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
+ content::BrowserThread::GetBlockingPool()->GetSequenceToken());
+
+ previews_ui_service_ = base::MakeUnique<previews::PreviewsUIService>(
+ previews_io_data, io_task_runner,
+ base::MakeUnique<previews::PreviewsOptOutStoreSQL>(
+ io_task_runner, background_task_runner,
+ profile_path.Append(chrome::kPreviewsOptOutDBFilename)));
}

Powered by Google App Engine
This is Rietveld 408576698