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))); |
} |