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

Unified Diff: chrome/browser/android/gcm_android.h

Issue 237323002: [NOT FOR REVIEW] Plumb Android GCM to Push API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « chrome/browser/android/chrome_jni_registrar.cc ('k') | chrome/browser/android/gcm_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/gcm_android.h
diff --git a/chrome/browser/android/gcm_android.h b/chrome/browser/android/gcm_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6ba2015bb773073e97b3e776bd07964c6108100
--- /dev/null
+++ b/chrome/browser/android/gcm_android.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2013 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_ANDROID_GCM_ANDROID_H_
+#define CHROME_BROWSER_ANDROID_GCM_ANDROID_H_
+
+#include <string>
+#include <vector>
+
+#include "base/android/jni_android.h"
+#include "base/android/scoped_java_ref.h"
+//#include "base/callback.h"
+#include "base/memory/singleton.h"
+#include "content/public/browser/push_messaging_service.h"
+
+namespace content{
+ class PushMessagingMessageFilter;
+}
+
+class GcmPlatformImplAndroid : public content::PushMessagingService {
+ public:
+ // Initiates registration with GCM. No caching of registrations is done,
+ // except any provided by the underlying GoogleCloudMessaging API.
+ void Register(
+ const std::string& app_unique_id_currently_ignored,
+ const std::vector<std::string>& sender_ids,
+ const content::PushMessagingService::RegisterCallback& callback) OVERRIDE;
+ // Not yet implemented.
+ //void UnregisterApp(const std::string& app_unique_id_currently_ignored);
+
+ void SetObserver(content::PushMessagingMessageFilter* observer);
+
+ // Methods called from Java via JNI.
+ void OnRegistrationFinished(JNIEnv* env, jobject obj, jstring data);
+ void OnMessageReceived(JNIEnv* env, jobject obj, jstring data);
+ void OnMessagesDeletedByServer(JNIEnv* env, jobject obj);
+
+ // Static functions.
+ static GcmPlatformImplAndroid* GetInstance();
+ static bool RegisterGcmPlatformImplAndroid(JNIEnv* env);
+
+ private:
+ friend struct DefaultSingletonTraits<GcmPlatformImplAndroid>;
+
+ GcmPlatformImplAndroid();
+ virtual ~GcmPlatformImplAndroid();
+
+ base::android::ScopedJavaGlobalRef<jobject> java_ref_;
+ content::PushMessagingMessageFilter* observer_;
+ content::PushMessagingService::RegisterCallback register_cb_;
+
+ DISALLOW_COPY_AND_ASSIGN(GcmPlatformImplAndroid);
+};
+
+#endif // CHROME_BROWSER_ANDROID_GCM_ANDROID_H_
« no previous file with comments | « chrome/browser/android/chrome_jni_registrar.cc ('k') | chrome/browser/android/gcm_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698