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

Unified Diff: components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GCMListener.java

Issue 1063633004: [GCM] Move GCMListener into chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN and make onMessageReceived public Created 5 years, 8 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/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GCMListener.java
diff --git a/components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GCMListener.java b/components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GCMListener.java
deleted file mode 100644
index aae446ba3f5b8496a8ebe086bb5fd20684131709..0000000000000000000000000000000000000000
--- a/components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GCMListener.java
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2014 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.
-
-package org.chromium.components.gcm_driver;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.util.Log;
-
-import com.google.ipc.invalidation.external.client.contrib.MultiplexingGcmListener;
-
-import org.chromium.base.ThreadUtils;
-
-/**
- * Receives GCM registration events and messages rebroadcast by MultiplexingGcmListener.
- */
-public class GCMListener extends MultiplexingGcmListener.AbstractListener {
- /**
- * Receiver for broadcasts by the multiplexed GCM service. It forwards them to
- * GCMListener.
- *
- * This class is public so that it can be instantiated by the Android runtime.
- */
- public static class Receiver extends MultiplexingGcmListener.AbstractListener.Receiver {
- @Override
- protected Class<?> getServiceClass() {
- return GCMListener.class;
- }
- }
-
- private static final String TAG = "GCMListener";
-
- public GCMListener() {
- super(TAG);
- }
-
- @Override
- protected void onRegistered(String registrationId) {
- // Ignore this, since we register using GoogleCloudMessagingV2.
- }
-
- @Override
- protected void onUnregistered(String registrationId) {
- // Ignore this, since we register using GoogleCloudMessagingV2.
- }
-
- @Override
- protected void onMessage(final Intent intent) {
- final String bundleSubtype = "subtype";
- final String bundleDataForPushApi = "data";
- Bundle extras = intent.getExtras();
- if (!extras.containsKey(bundleSubtype)) {
- Log.w(TAG, "Received push message with no subtype");
- return;
- }
- final String appId = extras.getString(bundleSubtype);
- ThreadUtils.runOnUiThread(new Runnable() {
- @Override public void run() {
- GCMDriver.onMessageReceived(getApplicationContext(), appId,
- intent.getExtras());
- }
- });
- }
-
- @Override
- protected void onDeletedMessages(int total) {
- // TODO(johnme): Refactor/replace MultiplexingGcmListener so it passes us the extras and
- // hence the subtype (aka appId).
- Log.w(TAG, "Push messages were deleted, but we can't tell the Service Worker, as we"
- + " don't have access to the intent extras so we can't get the appId");
- return;
- //ThreadUtils.runOnUiThread(new Runnable() {
- // @Override public void run() {
- // GCMDriver.onMessagesDeleted(getApplicationContext(), appId);
- // }
- //});
- }
-}

Powered by Google App Engine
This is Rietveld 408576698