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

Side by Side Diff: components/previews/core/previews_ui_service.cc

Issue 2387823002: Adding ClearBlackList to the PreviewsBlackList and plumbing to UI (Closed)
Patch Set: tbansal comments 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
« no previous file with comments | « components/previews/core/previews_ui_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/previews/core/previews_ui_service.h" 5 #include "components/previews/core/previews_ui_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "components/previews/core/previews_io_data.h" 9 #include "components/previews/core/previews_io_data.h"
10 #include "url/gurl.h"
10 11
11 namespace previews { 12 namespace previews {
12 13
13 PreviewsUIService::PreviewsUIService( 14 PreviewsUIService::PreviewsUIService(
14 PreviewsIOData* previews_io_data, 15 PreviewsIOData* previews_io_data,
15 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, 16 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
16 std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store) 17 std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store)
17 : io_task_runner_(io_task_runner), weak_factory_(this) { 18 : io_task_runner_(io_task_runner), weak_factory_(this) {
18 previews_io_data->Initialize(weak_factory_.GetWeakPtr(), 19 previews_io_data->Initialize(weak_factory_.GetWeakPtr(),
19 std::move(previews_opt_out_store)); 20 std::move(previews_opt_out_store));
20 } 21 }
21 22
22 PreviewsUIService::~PreviewsUIService() { 23 PreviewsUIService::~PreviewsUIService() {
23 DCHECK(thread_checker_.CalledOnValidThread()); 24 DCHECK(thread_checker_.CalledOnValidThread());
24 } 25 }
25 26
26 void PreviewsUIService::SetIOData(base::WeakPtr<PreviewsIOData> io_data) { 27 void PreviewsUIService::SetIOData(base::WeakPtr<PreviewsIOData> io_data) {
27 DCHECK(thread_checker_.CalledOnValidThread()); 28 DCHECK(thread_checker_.CalledOnValidThread());
28 io_data_ = io_data; 29 io_data_ = io_data;
29 } 30 }
30 31
32 void PreviewsUIService::AddPreviewNavigation(const GURL& url,
33 PreviewsType type,
34 bool opt_out) {
35 DCHECK(thread_checker_.CalledOnValidThread());
36 io_task_runner_->PostTask(
37 FROM_HERE, base::Bind(&PreviewsIOData::AddPreviewNavigation, io_data_,
38 url, opt_out, type));
39 }
40
41 void PreviewsUIService::ClearBlackList(base::Time begin_time,
42 base::Time end_time) {
43 DCHECK(thread_checker_.CalledOnValidThread());
44 io_task_runner_->PostTask(
45 FROM_HERE, base::Bind(&PreviewsIOData::ClearBlackList, io_data_,
46 begin_time, end_time));
47 }
48
31 } // namespace previews 49 } // namespace previews
OLDNEW
« no previous file with comments | « components/previews/core/previews_ui_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698