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

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

Issue 2974573002: Refactor WebApkServiceConnectionManager. (Closed)
Patch Set: Check bindService()'s return value. 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(
pkotwicz 2017/07/14 23:20:04 The order of the functions in the .h file should m
Xi Han 2017/07/17 20:45:31 The following four functions are overriding functi
pkotwicz 2017/07/18 17:30:46 You can change the order of the functions in the .
Xi Han 2017/07/18 22:36:51 In .cc file, the OnQueryWebApkPackage() is called
pkotwicz 2017/07/19 16:09:13 From the Chromium style guide: "Function declarati
Xi Han 2017/07/21 20:36:33 Done.
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 void OnQueryWebApkPackageInternal(const std::string& notification_id,
109 const std::string& profile_id,
110 bool incognito,
111 const Notification& notification,
112 const std::string& webapk_package);
pkotwicz 2017/07/18 17:30:46 This function does not seem to be implemented in t
Xi Han 2017/07/18 22:36:51 I renamed it to DisplayInternal() in patch set 9,
113
100 // Mapping of notification id to renegerated notification info. 114 // Mapping of notification id to renegerated notification info.
101 // TODO(peter): Remove this map once notification delegate ids for Web 115 // TODO(peter): Remove this map once notification delegate ids for Web
102 // notifications are created by the content/ layer. 116 // notifications are created by the content/ layer.
103 std::map<std::string, RegeneratedNotificationInfo> 117 std::map<std::string, RegeneratedNotificationInfo>
104 regenerated_notification_infos_; 118 regenerated_notification_infos_;
105 119
106 base::android::ScopedJavaGlobalRef<jobject> java_object_; 120 base::android::ScopedJavaGlobalRef<jobject> java_object_;
107 121
122 // Factory for the creating refs in callbacks.
123 base::WeakPtrFactory<NotificationPlatformBridgeAndroid> weak_ptr_factory_;
124
108 DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridgeAndroid); 125 DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridgeAndroid);
109 }; 126 };
110 127
111 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_ANDROID_H_ 128 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698