Chromium Code Reviews| 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..a3fbdef94684ac6a4c075b5571290289f66eb62a 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/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()); |
| + |
| + std::unique_ptr<previews::PreviewsOptOutStore> opt_out_store( |
| + new previews::PreviewsOptOutStoreSQL( |
| + io_task_runner, background_task_runner, |
| + profile_path.Append(chrome::kPreviewsOptOutDirname))); |
| + previews_ui_service_.reset(new previews::PreviewsUIService( |
|
Lei Zhang
2016/10/06 19:16:50
base::MakeUnique?
RyanSturm
2016/10/06 20:05:40
Done.
|
| + previews_io_data, io_task_runner, std::move(opt_out_store))); |
| } |