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 3 // found in the LICENSE file. 4 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_GCM_HANDLER_H_ 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_GCM_HANDLER_H_ 7 8 #include <string> 9 10 #include "components/gcm_driver/instance_id/instance_id.h" 11 12 namespace gcm { 13 class GCMAppHandler; 14 } // namespace gcm 15 16 namespace offline_pages { 17 18 class PrefetchService; 19 20 // Provides a GCM interface for PrefetchService. 21 class PrefetchGCMHandler { 22 public: 23 PrefetchGCMHandler() = default; 24 virtual ~PrefetchGCMHandler() = default; 25 26 // Sets the prefetch service. Must be called before using the handler. 27 virtual void SetService(PrefetchService* service) = 0; 28 29 // Returns the GCMAppHandler for this object. Can return |nullptr| in unit 30 // tests. 31 virtual gcm::GCMAppHandler* AsGCMAppHandler() = 0; 32 33 // The app ID to register with at the GCM layer. 34 virtual std::string GetAppId() const = 0; 35 }; 36 37 } // namespace offline_pages 38 39 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_GCM_HANDLER_H_ 40