OLD | NEW |
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_io_data.h" | 5 #include "components/previews/core/previews_io_data.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
13 #include "base/time/default_clock.h" | 13 #include "base/time/default_clock.h" |
14 #include "components/previews/core/previews_black_list.h" | 14 #include "components/previews/core/previews_black_list.h" |
15 #include "components/previews/core/previews_opt_out_store.h" | 15 #include "components/previews/core/previews_opt_out_store.h" |
16 #include "components/previews/core/previews_ui_service.h" | 16 #include "components/previews/core/previews_ui_service.h" |
| 17 #include "url/gurl.h" |
17 | 18 |
18 namespace previews { | 19 namespace previews { |
19 | 20 |
20 PreviewsIOData::PreviewsIOData( | 21 PreviewsIOData::PreviewsIOData( |
21 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, | 22 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, |
22 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) | 23 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) |
23 : ui_task_runner_(ui_task_runner), | 24 : ui_task_runner_(ui_task_runner), |
24 io_task_runner_(io_task_runner), | 25 io_task_runner_(io_task_runner), |
25 weak_factory_(this) {} | 26 weak_factory_(this) {} |
26 | 27 |
(...skipping 16 matching lines...) Expand all Loading... |
43 std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store) { | 44 std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store) { |
44 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 45 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
45 previews_black_list_.reset( | 46 previews_black_list_.reset( |
46 new PreviewsBlackList(std::move(previews_opt_out_store), | 47 new PreviewsBlackList(std::move(previews_opt_out_store), |
47 base::MakeUnique<base::DefaultClock>())); | 48 base::MakeUnique<base::DefaultClock>())); |
48 ui_task_runner_->PostTask( | 49 ui_task_runner_->PostTask( |
49 FROM_HERE, base::Bind(&PreviewsUIService::SetIOData, previews_ui_service_, | 50 FROM_HERE, base::Bind(&PreviewsUIService::SetIOData, previews_ui_service_, |
50 weak_factory_.GetWeakPtr())); | 51 weak_factory_.GetWeakPtr())); |
51 } | 52 } |
52 | 53 |
| 54 void PreviewsIOData::AddPreviewNavigation(const GURL& url, |
| 55 bool opt_out, |
| 56 PreviewsType type) { |
| 57 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| 58 previews_black_list_->AddPreviewNavigation(url, opt_out, type); |
| 59 } |
| 60 |
| 61 void PreviewsIOData::ClearBlackList(base::Time begin_time, |
| 62 base::Time end_time) { |
| 63 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| 64 previews_black_list_->ClearBlackList(begin_time, end_time); |
| 65 } |
| 66 |
53 } // namespace previews | 67 } // namespace previews |
OLD | NEW |