| 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> |
| 9 | 9 |
| 10 #include "components/gcm_driver/common/gcm_messages.h" |
| 11 #include "components/gcm_driver/gcm_app_handler.h" |
| 10 #include "components/offline_pages/core/prefetch/prefetch_service.h" | 12 #include "components/offline_pages/core/prefetch/prefetch_service.h" |
| 11 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 12 | 14 |
| 13 namespace offline_pages { | 15 namespace offline_pages { |
| 14 | 16 |
| 15 class PrefetchServiceImpl : public PrefetchService { | 17 class PrefetchServiceImpl : public PrefetchService, public gcm::GCMAppHandler { |
| 16 public: | 18 public: |
| 17 PrefetchServiceImpl(); | 19 PrefetchServiceImpl(); |
| 18 ~PrefetchServiceImpl() override; | 20 ~PrefetchServiceImpl() override; |
| 19 | 21 |
| 22 std::string GetGCMAppId(); |
| 23 |
| 24 // GCMAppHandler implementation: |
| 25 void ShutdownHandler() override; |
| 26 void OnStoreReset() override; |
| 27 void OnMessage(const std::string& app_id, |
| 28 const gcm::IncomingMessage& message) override; |
| 29 void OnMessagesDeleted(const std::string& app_id) override; |
| 30 void OnSendError( |
| 31 const std::string& app_id, |
| 32 const gcm::GCMClient::SendErrorDetails& send_error_details) override; |
| 33 void OnSendAcknowledged(const std::string& app_id, |
| 34 const std::string& message_id) override; |
| 35 |
| 20 // PrefetchService implementation: | 36 // PrefetchService implementation: |
| 21 void AddCandidatePrefetchURLs( | 37 void AddCandidatePrefetchURLs( |
| 22 const std::vector<PrefetchURL>& suggested_urls) override; | 38 const std::vector<PrefetchURL>& suggested_urls) override; |
| 23 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override; | 39 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override; |
| 24 void RemovePrefetchURLsByClientId(const ClientId& client_id) override; | 40 void RemovePrefetchURLsByClientId(const ClientId& client_id) override; |
| 25 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override; | 41 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override; |
| 26 void StopBackgroundTask(ScopedBackgroundTask* task) override; | 42 void StopBackgroundTask(ScopedBackgroundTask* task) override; |
| 27 | 43 |
| 28 // KeyedService implementation: | 44 // KeyedService implementation: |
| 29 void Shutdown() override; | 45 void Shutdown() override; |
| 30 | 46 |
| 31 private: | 47 private: |
| 32 DISALLOW_COPY_AND_ASSIGN(PrefetchServiceImpl); | 48 DISALLOW_COPY_AND_ASSIGN(PrefetchServiceImpl); |
| 33 }; | 49 }; |
| 34 | 50 |
| 35 } // namespace offline_pages | 51 } // namespace offline_pages |
| 36 | 52 |
| 37 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_IMPL_H_ | 53 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_IMPL_H_ |
| OLD | NEW |