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_SERVICE_IMPL_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_IMPL_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_IMPL_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
fgorski
2017/05/16 20:03:02
#include <memory>
| |
9 | 9 |
10 #include "components/offline_pages/core/prefetch/prefetch_service.h" | 10 #include "components/offline_pages/core/prefetch/prefetch_service.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 namespace offline_pages { | 13 namespace offline_pages { |
14 | 14 |
15 class PrefetchServiceImpl : public PrefetchService { | 15 class PrefetchServiceImpl : public PrefetchService { |
16 public: | 16 public: |
17 PrefetchServiceImpl(); | 17 // An interface allowing the prefetch service to hold a GCM App Handler for |
18 // lifetime purposes. TODO(dewittj): Add an interface method for getting an | |
19 // InstandID token. | |
20 class GCMAppHandler { | |
Dmitry Titov
2017/05/16 19:33:23
Does it deserve a separate file? Most of the subob
fgorski
2017/05/16 20:03:02
If this is only about life cycle, why not user dat
dewittj
2017/05/16 22:58:22
Added TODO and left interface here.
| |
21 public: | |
22 virtual ~GCMAppHandler() = default; | |
23 }; | |
24 | |
25 PrefetchServiceImpl(std::unique_ptr<GCMAppHandler> gcm_app_handler); | |
fgorski
2017/05/16 20:03:01
explicit in case you stick with the interface
dewittj
2017/05/16 22:58:22
Done.
| |
18 ~PrefetchServiceImpl() override; | 26 ~PrefetchServiceImpl() override; |
19 | 27 |
20 // PrefetchService implementation: | 28 // PrefetchService implementation: |
21 void AddCandidatePrefetchURLs( | 29 void AddCandidatePrefetchURLs( |
22 const std::vector<PrefetchURL>& suggested_urls) override; | 30 const std::vector<PrefetchURL>& suggested_urls) override; |
23 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override; | 31 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override; |
24 void RemovePrefetchURLsByClientId(const ClientId& client_id) override; | 32 void RemovePrefetchURLsByClientId(const ClientId& client_id) override; |
25 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override; | 33 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override; |
26 void StopBackgroundTask(ScopedBackgroundTask* task) override; | 34 void StopBackgroundTask(ScopedBackgroundTask* task) override; |
27 | 35 |
28 // KeyedService implementation: | 36 // KeyedService implementation: |
29 void Shutdown() override; | 37 void Shutdown() override; |
30 | 38 |
31 private: | 39 private: |
40 std::unique_ptr<GCMAppHandler> gcm_app_handler_; | |
41 | |
32 DISALLOW_COPY_AND_ASSIGN(PrefetchServiceImpl); | 42 DISALLOW_COPY_AND_ASSIGN(PrefetchServiceImpl); |
33 }; | 43 }; |
34 | 44 |
35 } // namespace offline_pages | 45 } // namespace offline_pages |
36 | 46 |
37 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_IMPL_H_ | 47 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_IMPL_H_ |
OLD | NEW |