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

Unified Diff: components/offline_pages/core/prefetch/prefetch_gcm_app_handler.h

Issue 2864293003: [Offline Pages] Add a GCMAppHandler for offline page prefetch. (Closed)
Patch Set: Fix windows 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/core/prefetch/prefetch_gcm_app_handler.h
diff --git a/components/offline_pages/core/prefetch/prefetch_gcm_app_handler.h b/components/offline_pages/core/prefetch/prefetch_gcm_app_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..beea579658e5cfbfd442662eb0fc257166dd2517
--- /dev/null
+++ b/components/offline_pages/core/prefetch/prefetch_gcm_app_handler.h
@@ -0,0 +1,50 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_GCM_APP_HANDLER_H_
+#define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_GCM_APP_HANDLER_H_
+
+#include <string>
+
+#include "components/gcm_driver/common/gcm_messages.h"
+#include "components/gcm_driver/gcm_app_handler.h"
+#include "components/gcm_driver/gcm_driver.h"
+#include "components/gcm_driver/gcm_profile_service.h"
+#include "components/offline_pages/core/prefetch/prefetch_gcm_handler.h"
+#include "url/gurl.h"
+
+namespace offline_pages {
+
+// Receives GCM messages and other channel status messages on behalf of the
+// prefetch system.
+class PrefetchGCMAppHandler : public gcm::GCMAppHandler,
+ public PrefetchGCMHandler {
+ public:
+ PrefetchGCMAppHandler();
+ ~PrefetchGCMAppHandler() override;
+
+ // gcm::GCMAppHandler implementation.
+ void ShutdownHandler() override;
+ void OnStoreReset() override;
+ void OnMessage(const std::string& app_id,
+ const gcm::IncomingMessage& message) override;
+ void OnMessagesDeleted(const std::string& app_id) override;
+ void OnSendError(
+ const std::string& app_id,
+ const gcm::GCMClient::SendErrorDetails& send_error_details) override;
+ void OnSendAcknowledged(const std::string& app_id,
+ const std::string& message_id) override;
+ bool CanHandle(const std::string& app_id) const override;
+
+ // offline_pages::PrefetchGCMHandler implementation.
+ gcm::GCMAppHandler* AsGCMAppHandler() override;
+ std::string GetAppId() const override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PrefetchGCMAppHandler);
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_GCM_APP_HANDLER_H_
« no previous file with comments | « components/offline_pages/core/prefetch/BUILD.gn ('k') | components/offline_pages/core/prefetch/prefetch_gcm_app_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698