| 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_
|
|
|