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

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

Issue 2864293003: [Offline Pages] Add a GCMAppHandler for offline page prefetch. (Closed)
Patch Set: Fix windows compile. 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.cc
diff --git a/components/offline_pages/core/prefetch/prefetch_gcm_app_handler.cc b/components/offline_pages/core/prefetch/prefetch_gcm_app_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..824e726406c6383880f01bc0283f491044929de9
--- /dev/null
+++ b/components/offline_pages/core/prefetch/prefetch_gcm_app_handler.cc
@@ -0,0 +1,65 @@
+// 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.
+
+#include "components/offline_pages/core/prefetch/prefetch_gcm_app_handler.h"
+
+#include "base/memory/ptr_util.h"
+#include "components/offline_pages/core/prefetch/prefetch_service.h"
+
+namespace offline_pages {
+namespace {
+const char kPrefetchingOfflinePagesAppId[] =
+ "com.google.chrome.OfflinePagePrefetch";
+}
+
+// static
+void PrefetchGCMAppHandler::AddAppHandlerToPrefetchService(
+ PrefetchService* prefetch_service,
+ gcm::GCMProfileService* gcm_profile_service) {
+ if (!prefetch_service)
+ return;
+ PrefetchGCMAppHandler* prefetch_gcm_handler = new PrefetchGCMAppHandler();
+ gcm_profile_service->driver()->AddAppHandler(prefetch_gcm_handler->app_id(),
+ prefetch_gcm_handler);
+ prefetch_service->AddPrefetchGCMHandler(
+ base::WrapUnique(prefetch_gcm_handler));
+}
+
+PrefetchGCMAppHandler::PrefetchGCMAppHandler()
+ : app_id_(kPrefetchingOfflinePagesAppId) {}
+PrefetchGCMAppHandler::~PrefetchGCMAppHandler() = default;
+
+void PrefetchGCMAppHandler::ShutdownHandler() {
+ NOTIMPLEMENTED();
+}
+
+void PrefetchGCMAppHandler::OnStoreReset() {
+ NOTIMPLEMENTED();
+}
+
+void PrefetchGCMAppHandler::OnMessage(const std::string& app_id,
+ const gcm::IncomingMessage& message) {
+ NOTIMPLEMENTED();
+}
+
+void PrefetchGCMAppHandler::OnMessagesDeleted(const std::string& app_id) {
+ NOTIMPLEMENTED();
+}
+
+void PrefetchGCMAppHandler::OnSendError(
+ const std::string& app_id,
+ const gcm::GCMClient::SendErrorDetails& send_error_details) {
+ NOTIMPLEMENTED();
+}
+
+void PrefetchGCMAppHandler::OnSendAcknowledged(const std::string& app_id,
+ const std::string& message_id) {
+ NOTIMPLEMENTED();
+}
+
+bool PrefetchGCMAppHandler::CanHandle(const std::string& app_id) const {
+ return app_id == app_id_;
+}
+
+} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698