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

Unified Diff: chrome/browser/offline_pages/prefetch/prefetch_gcm_app_handler.h

Issue 2864293003: [Offline Pages] Add a GCMAppHandler for offline page prefetch. (Closed)
Patch Set: Refactor to remove GCM dependency. 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: chrome/browser/offline_pages/prefetch/prefetch_gcm_app_handler.h
diff --git a/chrome/browser/offline_pages/prefetch/prefetch_gcm_app_handler.h b/chrome/browser/offline_pages/prefetch/prefetch_gcm_app_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..d827e129963cc7a057ddae29248d86dbab2d9e5a
--- /dev/null
+++ b/chrome/browser/offline_pages/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 CHROME_BROWSER_OFFLINE_PAGES_PREFETCH_PREFETCH_GCM_APP_HANDLER_H_
+#define CHROME_BROWSER_OFFLINE_PAGES_PREFETCH_PREFETCH_GCM_APP_HANDLER_H_
+
+#include <vector>
fgorski 2017/05/16 20:03:01 #include <string> instead is more appropriate I th
dewittj 2017/05/16 22:58:22 Done.
+
+#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/offline_pages/core/prefetch/prefetch_service.h"
+#include "components/offline_pages/core/prefetch/prefetch_service_impl.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 PrefetchServiceImpl::GCMAppHandler {
+ 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;
+
+ const std::string& app_id() const { return app_id_; }
+
+ private:
+ std::string app_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrefetchGCMAppHandler);
+};
+
+} // namespace offline_pages
+
+#endif // CHROME_BROWSER_OFFLINE_PAGES_PREFETCH_PREFETCH_GCM_APP_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698