12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- // Copyright 2019 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 REMOTING_CLIENT_JNI_JNI_NOTIFICATION_PRESENTER_H_
- #define REMOTING_CLIENT_JNI_JNI_NOTIFICATION_PRESENTER_H_
- #include <jni.h>
- #include "base/android/jni_weak_ref.h"
- #include "base/memory/scoped_refptr.h"
- #include "base/task/sequenced_task_runner.h"
- #include "remoting/client/notification/notification_client.h"
- #include "third_party/abseil-cpp/absl/types/optional.h"
- namespace remoting {
- // C++ counterpart for org.chromium.chromoting.jni.NotificationPresenter.
- class JniNotificationPresenter final {
- public:
- explicit JniNotificationPresenter(
- const JavaObjectWeakGlobalRef& java_presenter);
- JniNotificationPresenter(const JniNotificationPresenter&) = delete;
- JniNotificationPresenter& operator=(const JniNotificationPresenter&) = delete;
- ~JniNotificationPresenter();
- void FetchNotification(JNIEnv* env,
- const base::android::JavaParamRef<jstring>& username);
- void Destroy(JNIEnv* env);
- private:
- void OnNotificationFetched(absl::optional<NotificationMessage> notification);
- JavaObjectWeakGlobalRef java_presenter_;
- NotificationClient notification_client_;
- scoped_refptr<base::SequencedTaskRunner> sequence_;
- };
- } // namespace remoting
- #endif // REMOTING_CLIENT_JNI_JNI_NOTIFICATION_PRESENTER_H_
|