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

Side by Side Diff: chrome/browser/notifications/notification_platform_bridge_android.h

Issue 2974573002: Refactor WebApkServiceConnectionManager. (Closed)
Patch Set: pkotwicz@‘s comments. Created 3 years, 5 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 unified diff | Download patch
OLDNEW
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_PLATFORM_BRIDGE_ANDROID_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_ANDROID_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_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 "base/memory/weak_ptr.h"
16 #include "chrome/browser/notifications/displayed_notifications_dispatch_callback .h" 17 #include "chrome/browser/notifications/displayed_notifications_dispatch_callback .h"
17 #include "chrome/browser/notifications/notification_common.h" 18 #include "chrome/browser/notifications/notification_common.h"
18 #include "chrome/browser/notifications/notification_platform_bridge.h" 19 #include "chrome/browser/notifications/notification_platform_bridge.h"
19 20
20 namespace user_prefs { 21 namespace user_prefs {
21 class PrefRegistrySyncable; 22 class PrefRegistrySyncable;
22 } 23 }
23 24
24 // Implementation of the NotificationPlatformBridge for Android, which defers to 25 // Implementation of the NotificationPlatformBridge for Android, which defers to
25 // the Android framework for displaying notifications. 26 // the Android framework for displaying notifications.
(...skipping 29 matching lines...) Expand all
55 void OnNotificationClosed( 56 void OnNotificationClosed(
56 JNIEnv* env, 57 JNIEnv* env,
57 const base::android::JavaParamRef<jobject>& java_object, 58 const base::android::JavaParamRef<jobject>& java_object,
58 const base::android::JavaParamRef<jstring>& java_notification_id, 59 const base::android::JavaParamRef<jstring>& java_notification_id,
59 const base::android::JavaParamRef<jstring>& java_origin, 60 const base::android::JavaParamRef<jstring>& java_origin,
60 const base::android::JavaParamRef<jstring>& java_profile_id, 61 const base::android::JavaParamRef<jstring>& java_profile_id,
61 jboolean incognito, 62 jboolean incognito,
62 const base::android::JavaParamRef<jstring>& java_tag, 63 const base::android::JavaParamRef<jstring>& java_tag,
63 jboolean by_user); 64 jboolean by_user);
64 65
66 // Called after querying the webapk package is done on Java side.
67 void OnQueryWebApkPackage(
68 JNIEnv* env,
69 const base::android::JavaParamRef<jobject>& java_object,
70 const base::android::JavaParamRef<jstring>& java_webapk_package,
71 const jlong jcallback_pointer);
72
65 // NotificationPlatformBridge implementation. 73 // NotificationPlatformBridge implementation.
66 void Display(NotificationCommon::Type notification_type, 74 void Display(NotificationCommon::Type notification_type,
67 const std::string& notification_id, 75 const std::string& notification_id,
68 const std::string& profile_id, 76 const std::string& profile_id,
69 bool incognito, 77 bool incognito,
70 const Notification& notification) override; 78 const Notification& notification) override;
71 void Close(const std::string& profile_id, 79 void Close(const std::string& profile_id,
72 const std::string& notification_id) override; 80 const std::string& notification_id) override;
73 void GetDisplayed( 81 void GetDisplayed(
74 const std::string& profile_id, 82 const std::string& profile_id,
(...skipping 15 matching lines...) Expand all
90 RegeneratedNotificationInfo(const std::string& origin, 98 RegeneratedNotificationInfo(const std::string& origin,
91 const std::string& tag, 99 const std::string& tag,
92 const std::string& webapk_package); 100 const std::string& webapk_package);
93 ~RegeneratedNotificationInfo(); 101 ~RegeneratedNotificationInfo();
94 102
95 std::string origin; 103 std::string origin;
96 std::string tag; 104 std::string tag;
97 std::string webapk_package; 105 std::string webapk_package;
98 }; 106 };
99 107
108 // Display a notification.
109 void DisplayInternal(const std::string& notification_id,
110 const std::string& profile_id,
111 bool incognito,
112 const Notification& notification,
113 const std::string& webapk_package);
114
100 // Mapping of notification id to renegerated notification info. 115 // Mapping of notification id to renegerated notification info.
101 // TODO(peter): Remove this map once notification delegate ids for Web 116 // TODO(peter): Remove this map once notification delegate ids for Web
102 // notifications are created by the content/ layer. 117 // notifications are created by the content/ layer.
103 std::map<std::string, RegeneratedNotificationInfo> 118 std::map<std::string, RegeneratedNotificationInfo>
104 regenerated_notification_infos_; 119 regenerated_notification_infos_;
105 120
106 base::android::ScopedJavaGlobalRef<jobject> java_object_; 121 base::android::ScopedJavaGlobalRef<jobject> java_object_;
107 122
123 // Factory for the creating refs in callbacks.
124 base::WeakPtrFactory<NotificationPlatformBridgeAndroid> weak_ptr_factory_;
125
108 DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridgeAndroid); 126 DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridgeAndroid);
109 }; 127 };
110 128
111 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_ANDROID_H_ 129 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698