| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_ANDROID_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_ANDROID_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "chrome/browser/notifications/notification_platform_bridge.h" | 16 #include "chrome/browser/notifications/notification_platform_bridge.h" |
| 17 | 17 |
| 18 // Implementation of the NotificationPlatformBridge for Android, which defers to | 18 // Implementation of the NotificationPlatformBridge for Android, which defers to |
| 19 // the Android framework for displaying notifications. | 19 // the Android framework for displaying notifications. |
| 20 // | 20 // |
| 21 // Prior to Android Marshmellow, Android did not have the ability to retrieve | 21 // Prior to Android Marshmellow, Android did not have the ability to retrieve |
| 22 // the notifications currently showing for an app without a rather intrusive | 22 // the notifications currently showing for an app without a rather intrusive |
| 23 // permission. The GetDisplayed() method may return false because of this. | 23 // permission. The GetDisplayed() method may return false because of this. |
| 24 // | 24 // |
| 25 // The Android implementation *is* reliable for adding and canceling | 25 // The Android implementation *is* reliable for adding and canceling |
| 26 // single notifications based on their delegate id. Finally, events for | 26 // single notifications based on their delegate id. Finally, events for |
| 27 // persistent Web Notifications will be forwarded directly to the associated | 27 // persistent Web Notifications will be forwarded directly to the associated |
| 28 // event handlers, as such notifications may outlive the browser process on | 28 // event handlers, as such notifications may outlive the browser process on |
| 29 // Android. | 29 // Android. |
| 30 class NotificationUIManagerAndroid : public NotificationPlatformBridge { | 30 class NotificationPlatformBridgeAndroid : public NotificationPlatformBridge { |
| 31 public: | 31 public: |
| 32 NotificationUIManagerAndroid(); | 32 NotificationPlatformBridgeAndroid(); |
| 33 ~NotificationUIManagerAndroid() override; | 33 ~NotificationPlatformBridgeAndroid() override; |
| 34 | 34 |
| 35 // Called by the Java implementation when the notification has been clicked. | 35 // Called by the Java implementation when the notification has been clicked. |
| 36 void OnNotificationClicked( | 36 void OnNotificationClicked( |
| 37 JNIEnv* env, | 37 JNIEnv* env, |
| 38 const base::android::JavaParamRef<jobject>& java_object, | 38 const base::android::JavaParamRef<jobject>& java_object, |
| 39 jlong persistent_notification_id, | 39 jlong persistent_notification_id, |
| 40 const base::android::JavaParamRef<jstring>& java_origin, | 40 const base::android::JavaParamRef<jstring>& java_origin, |
| 41 const base::android::JavaParamRef<jstring>& java_profile_id, | 41 const base::android::JavaParamRef<jstring>& java_profile_id, |
| 42 jboolean incognito, | 42 jboolean incognito, |
| 43 const base::android::JavaParamRef<jstring>& java_tag, | 43 const base::android::JavaParamRef<jstring>& java_tag, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 using RegeneratedNotificationInfo = std::pair<std::string, std::string>; | 76 using RegeneratedNotificationInfo = std::pair<std::string, std::string>; |
| 77 | 77 |
| 78 // Mapping of a persistent notification id to renegerated notification info. | 78 // Mapping of a persistent notification id to renegerated notification info. |
| 79 // TODO(peter): Remove this map once notification delegate ids for Web | 79 // TODO(peter): Remove this map once notification delegate ids for Web |
| 80 // notifications are created by the content/ layer. | 80 // notifications are created by the content/ layer. |
| 81 std::map<int64_t, RegeneratedNotificationInfo> | 81 std::map<int64_t, RegeneratedNotificationInfo> |
| 82 regenerated_notification_infos_; | 82 regenerated_notification_infos_; |
| 83 | 83 |
| 84 base::android::ScopedJavaGlobalRef<jobject> java_object_; | 84 base::android::ScopedJavaGlobalRef<jobject> java_object_; |
| 85 | 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(NotificationUIManagerAndroid); | 86 DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridgeAndroid); |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_ANDROID_H_ | 89 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_ANDROID_H_ |
| OLD | NEW |