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

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

Issue 1026853002: Integrate the notification database with the normal code path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-db-ConfirmShow
Patch Set: delete a now invalid test Created 5 years, 8 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_UI_MANAGER_ANDROID_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_ANDROID_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_ANDROID_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/android/scoped_java_ref.h" 13 #include "base/android/scoped_java_ref.h"
14 #include "chrome/browser/notifications/notification_ui_manager.h" 14 #include "chrome/browser/notifications/notification_ui_manager.h"
15 15
16 class ProfileNotification; 16 class ProfileNotification;
17 17
18 // Implementation of the Notification UI Manager for Android, which defers to 18 // Implementation of the Notification UI Manager for Android, which defers to
19 // the Android framework for displaying notifications. 19 // the Android framework for displaying notifications.
20 class NotificationUIManagerAndroid : public NotificationUIManager { 20 class NotificationUIManagerAndroid : public NotificationUIManager {
21 public: 21 public:
22 NotificationUIManagerAndroid(); 22 NotificationUIManagerAndroid();
23 ~NotificationUIManagerAndroid() override; 23 ~NotificationUIManagerAndroid() override;
24 24
25 // Called by the Java implementation when a notification has been clicked on. 25 // Called by the Java implementation when the notification has been clicked.
26 bool OnNotificationClicked(JNIEnv* env, 26 bool OnNotificationClicked(JNIEnv* env,
27 jobject java_object, 27 jobject java_object,
28 jstring notification_id, 28 jlong persistent_notification_id,
29 jbyteArray serialized_notification_data); 29 jstring java_origin,
30 jstring java_tag);
30 31
31 // Called by the Java implementation when a notification has been closed. 32 // Called by the Java implementation when the notification has been closed.
32 bool OnNotificationClosed(JNIEnv* env, 33 bool OnNotificationClosed(JNIEnv* env,
33 jobject java_object, 34 jobject java_object,
34 jstring notification_id); 35 jlong persistent_notification_id,
36 jstring java_origin,
37 jstring java_tag);
35 38
36 // NotificationUIManager implementation; 39 // NotificationUIManager implementation;
37 void Add(const Notification& notification, Profile* profile) override; 40 void Add(const Notification& notification, Profile* profile) override;
38 bool Update(const Notification& notification, 41 bool Update(const Notification& notification,
39 Profile* profile) override; 42 Profile* profile) override;
40 const Notification* FindById(const std::string& delegate_id, 43 const Notification* FindById(const std::string& delegate_id,
41 ProfileID profile_id) const override; 44 ProfileID profile_id) const override;
42 bool CancelById(const std::string& delegate_id, 45 bool CancelById(const std::string& delegate_id,
43 ProfileID profile_id) override; 46 ProfileID profile_id) override;
44 std::set<std::string> GetAllIdsByProfileAndSourceOrigin(Profile* profile, 47 std::set<std::string> GetAllIdsByProfileAndSourceOrigin(Profile* profile,
(...skipping 23 matching lines...) Expand all
68 ProfileNotification* FindProfileNotification(const std::string& id) const; 71 ProfileNotification* FindProfileNotification(const std::string& id) const;
69 72
70 // Returns the ProfileNotification for |profile| that has the same origin and 73 // Returns the ProfileNotification for |profile| that has the same origin and
71 // tag as |notification|. Returns NULL if no valid match is found. 74 // tag as |notification|. Returns NULL if no valid match is found.
72 ProfileNotification* FindNotificationToReplace( 75 ProfileNotification* FindNotificationToReplace(
73 const Notification& notification, Profile* profile) const; 76 const Notification& notification, Profile* profile) const;
74 77
75 // Map from a notification id to the associated ProfileNotification*. 78 // Map from a notification id to the associated ProfileNotification*.
76 std::map<std::string, ProfileNotification*> profile_notifications_; 79 std::map<std::string, ProfileNotification*> profile_notifications_;
77 80
78 // Holds the tag of a notification, and its origin. 81 // Pair containing a regenerated notification's origin and tag.
dewittj 2015/04/10 17:02:19 Can you add comments around what a "regenerated no
Peter Beverloo 2015/04/13 16:22:32 Done.
79 using RegeneratedNotificationInfo = std::pair<std::string, std::string>; 82 using RegeneratedNotificationInfo = std::pair<std::string, std::string>;
80 83
81 // Map from notification id to RegeneratedNotificationInfo. 84 // Map from persistent notification id to RegeneratedNotificationInfo.
82 std::map<std::string, RegeneratedNotificationInfo> 85 std::map<int64_t, RegeneratedNotificationInfo>
83 regenerated_notification_infos_; 86 regenerated_notification_infos_;
84 87
85 base::android::ScopedJavaGlobalRef<jobject> java_object_; 88 base::android::ScopedJavaGlobalRef<jobject> java_object_;
86 89
87 DISALLOW_COPY_AND_ASSIGN(NotificationUIManagerAndroid); 90 DISALLOW_COPY_AND_ASSIGN(NotificationUIManagerAndroid);
88 }; 91 };
89 92
90 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_ANDROID_H_ 93 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698