OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "components/offline_pages/core/prefetch/prefetch_dispatcher.h" | 13 #include "components/offline_pages/core/prefetch/prefetch_dispatcher.h" |
14 #include "components/offline_pages/core/task_queue.h" | 14 #include "components/offline_pages/core/task_queue.h" |
15 | 15 |
16 namespace offline_pages { | 16 namespace offline_pages { |
17 class PrefetchService; | 17 class PrefetchService; |
18 | 18 |
19 class PrefetchDispatcherImpl : public PrefetchDispatcher { | 19 class PrefetchDispatcherImpl : public PrefetchDispatcher { |
20 public: | 20 public: |
21 PrefetchDispatcherImpl(); | 21 PrefetchDispatcherImpl(); |
22 ~PrefetchDispatcherImpl() override; | 22 ~PrefetchDispatcherImpl() override; |
23 | 23 |
24 // PrefetchDispatcher implementation: | 24 // PrefetchDispatcher implementation: |
25 void SetService(PrefetchService* service) override; | 25 void SetService(PrefetchService* service) override; |
26 void AddCandidatePrefetchURLs( | 26 void AddCandidatePrefetchURLs( |
| 27 const std::string& name_space, |
27 const std::vector<PrefetchURL>& prefetch_urls) override; | 28 const std::vector<PrefetchURL>& prefetch_urls) override; |
28 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override; | 29 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override; |
29 void RemovePrefetchURLsByClientId(const ClientId& client_id) override; | 30 void RemovePrefetchURLsByClientId(const ClientId& client_id) override; |
30 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override; | 31 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override; |
31 void StopBackgroundTask() override; | 32 void StopBackgroundTask() override; |
32 void GCMOperationCompletedMessageReceived( | 33 void GCMOperationCompletedMessageReceived( |
33 const std::string& operation_name) override; | 34 const std::string& operation_name) override; |
34 void RequestFinishBackgroundTaskForTest() override; | 35 void RequestFinishBackgroundTaskForTest() override; |
35 | 36 |
36 private: | 37 private: |
37 friend class PrefetchDispatcherTest; | 38 friend class PrefetchDispatcherTest; |
38 | 39 |
39 void DisposeTask(); | 40 void DisposeTask(); |
40 | 41 |
41 PrefetchService* service_; | 42 PrefetchService* service_; |
42 TaskQueue task_queue_; | 43 TaskQueue task_queue_; |
43 std::unique_ptr<ScopedBackgroundTask> task_; | 44 std::unique_ptr<ScopedBackgroundTask> task_; |
44 | 45 |
45 DISALLOW_COPY_AND_ASSIGN(PrefetchDispatcherImpl); | 46 DISALLOW_COPY_AND_ASSIGN(PrefetchDispatcherImpl); |
46 }; | 47 }; |
47 | 48 |
48 } // namespace offline_pages | 49 } // namespace offline_pages |
49 | 50 |
50 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ | 51 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ |
OLD | NEW |