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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/previews/previews_service.h" 5 #include "chrome/browser/previews/previews_service.h"
6 6
7 #include "base/files/file_path.h"
8 #include "base/memory/ptr_util.h"
9 #include "base/sequenced_task_runner.h"
10 #include "base/threading/sequenced_worker_pool.h"
11 #include "chrome/common/chrome_constants.h"
12 #include "components/previews/core/previews_io_data.h"
13 #include "components/previews/core/previews_opt_out_store.h"
14 #include "components/previews/core/previews_opt_out_store_sql.h"
7 #include "components/previews/core/previews_ui_service.h" 15 #include "components/previews/core/previews_ui_service.h"
8 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
9 17
10 PreviewsService::PreviewsService() { 18 PreviewsService::PreviewsService() {
11 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 19 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
12 } 20 }
13 21
14 PreviewsService::~PreviewsService() { 22 PreviewsService::~PreviewsService() {
15 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 23 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
16 } 24 }
17 25
18 void PreviewsService::set_previews_ui_service( 26 void PreviewsService::Initialize(
19 std::unique_ptr<previews::PreviewsUIService> previews_ui_service) { 27 previews::PreviewsIOData* previews_io_data,
28 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
29 const base::FilePath& profile_path) {
20 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 30 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
21 previews_ui_service_ = std::move(previews_ui_service); 31
32 // Get the background thread to run SQLite on.
33 scoped_refptr<base::SequencedTaskRunner> background_task_runner =
34 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
35 content::BrowserThread::GetBlockingPool()->GetSequenceToken());
36
37 previews_ui_service_ = base::MakeUnique<previews::PreviewsUIService>(
38 previews_io_data, io_task_runner,
39 base::MakeUnique<previews::PreviewsOptOutStoreSQL>(
40 io_task_runner, background_task_runner,
41 profile_path.Append(chrome::kPreviewsOptOutDBFilename)));
22 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698