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

Side by Side Diff: components/offline_pages/core/prefetch/prefetch_service_impl.h

Issue 2864293003: [Offline Pages] Add a GCMAppHandler for offline page prefetch. (Closed)
Patch Set: Move Content Suggestions Observer to //components/offline_pages/core and modify lifetime management Created 3 years, 7 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 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 <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 "components/offline_pages/core/prefetch/suggested_articles_observer.h"
11 #include "url/gurl.h" 12 #include "url/gurl.h"
12 13
14 namespace ntp_snippets {
15 class ContentSuggestionsService;
16 }
17
13 namespace offline_pages { 18 namespace offline_pages {
14 19
15 class PrefetchServiceImpl : public PrefetchService { 20 class PrefetchServiceImpl : public PrefetchService {
16 public: 21 public:
17 PrefetchServiceImpl(); 22 // An interface allowing the prefetch service to hold a GCM App Handler for
23 // lifetime purposes. TODO(dewittj): Add an interface method for getting an
fgorski 2017/05/17 23:15:02 This comment is duplicated below, please remove on
dewittj 2017/05/22 22:00:08 Done.
24 // InstandID token.
25 class GCMAppHandler {
26 public:
27 virtual ~GCMAppHandler() = default;
28
29 // TODO(dewittj): Add methods for acquiring an Instance ID token to this
30 // interface.
31 };
32
33 explicit PrefetchServiceImpl(std::unique_ptr<GCMAppHandler> gcm_app_handler);
18 ~PrefetchServiceImpl() override; 34 ~PrefetchServiceImpl() override;
19 35
20 // PrefetchService implementation: 36 // PrefetchService implementation:
37 void ObserveContentSuggestionsService(
38 ntp_snippets::ContentSuggestionsService* service) override;
21 void AddCandidatePrefetchURLs( 39 void AddCandidatePrefetchURLs(
22 const std::vector<PrefetchURL>& suggested_urls) override; 40 const std::vector<PrefetchURL>& suggested_urls) override;
23 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override; 41 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override;
24 void RemovePrefetchURLsByClientId(const ClientId& client_id) override; 42 void RemovePrefetchURLsByClientId(const ClientId& client_id) override;
25 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override; 43 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override;
26 void StopBackgroundTask(ScopedBackgroundTask* task) override; 44 void StopBackgroundTask(ScopedBackgroundTask* task) override;
27 45
28 // KeyedService implementation: 46 // KeyedService implementation:
29 void Shutdown() override; 47 void Shutdown() override;
30 48
31 private: 49 private:
50 std::unique_ptr<SuggestedArticlesObserver> suggested_articles_observer_;
51 std::unique_ptr<GCMAppHandler> gcm_app_handler_;
52
32 DISALLOW_COPY_AND_ASSIGN(PrefetchServiceImpl); 53 DISALLOW_COPY_AND_ASSIGN(PrefetchServiceImpl);
33 }; 54 };
34 55
35 } // namespace offline_pages 56 } // namespace offline_pages
36 57
37 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_IMPL_H_ 58 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698