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

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

Issue 942103003: Handle notification preferences intent from gear icon. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 5 years, 9 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 "base/strings/string16.h"
14 #include "chrome/browser/notifications/notification_ui_manager.h" 15 #include "chrome/browser/notifications/notification_ui_manager.h"
15 16
16 class ProfileNotification; 17 class ProfileNotification;
17 18
18 // Implementation of the Notification UI Manager for Android, which defers to 19 // Implementation of the Notification UI Manager for Android, which defers to
19 // the Android framework for displaying notifications. 20 // the Android framework for displaying notifications.
20 class NotificationUIManagerAndroid : public NotificationUIManager { 21 class NotificationUIManagerAndroid : public NotificationUIManager {
21 public: 22 public:
23 // Holds all information required to show or close a platform notification.
24 struct RegeneratedNotificationInfo {
Peter Beverloo 2015/02/25 18:26:09 Why is this public?
Michael van Ouwerkerk 2015/02/25 19:00:19 Done.
25 RegeneratedNotificationInfo(base::string16 tag,
Peter Beverloo 2015/02/25 18:26:09 const&
Michael van Ouwerkerk 2015/02/25 19:00:19 Done.
26 int platform_id,
27 std::string origin)
Peter Beverloo 2015/02/25 18:26:10 const&
Michael van Ouwerkerk 2015/02/25 19:00:19 Done.
28 : tag(tag), platform_id(platform_id), origin(origin) {}
29 base::string16 tag;
30 int platform_id;
31 std::string origin;
32 };
33
22 NotificationUIManagerAndroid(); 34 NotificationUIManagerAndroid();
23 ~NotificationUIManagerAndroid() override; 35 ~NotificationUIManagerAndroid() override;
24 36
25 // Called by the Java implementation when a notification has been clicked on. 37 // Called by the Java implementation when a notification has been clicked on.
26 bool OnNotificationClicked(JNIEnv* env, 38 bool OnNotificationClicked(JNIEnv* env,
27 jobject java_object, 39 jobject java_object,
28 jstring notification_id, 40 jstring notification_id,
29 jint platform_id, 41 jint platform_id,
30 jbyteArray serialized_notification_data); 42 jbyteArray serialized_notification_data);
31 43
(...skipping 28 matching lines...) Expand all
60 void AddProfileNotification(ProfileNotification* profile_notification); 72 void AddProfileNotification(ProfileNotification* profile_notification);
61 void RemoveProfileNotification(ProfileNotification* profile_notification); 73 void RemoveProfileNotification(ProfileNotification* profile_notification);
62 74
63 // Returns the ProfileNotification for the |id|, or NULL if no such 75 // Returns the ProfileNotification for the |id|, or NULL if no such
64 // notification is found. 76 // notification is found.
65 ProfileNotification* FindProfileNotification(const std::string& id) const; 77 ProfileNotification* FindProfileNotification(const std::string& id) const;
66 78
67 // Map from a notification id to the associated ProfileNotification*. 79 // Map from a notification id to the associated ProfileNotification*.
68 std::map<std::string, ProfileNotification*> profile_notifications_; 80 std::map<std::string, ProfileNotification*> profile_notifications_;
69 81
70 // Map from notification id to the associated platform Id. 82 // Map from notification id to RegeneratedNotificationInfo.
71 std::map<std::string, int> platform_notifications_; 83 std::map<std::string, RegeneratedNotificationInfo>
84 regenerated_notification_infos_;
72 85
73 base::android::ScopedJavaGlobalRef<jobject> java_object_; 86 base::android::ScopedJavaGlobalRef<jobject> java_object_;
74 87
75 DISALLOW_COPY_AND_ASSIGN(NotificationUIManagerAndroid); 88 DISALLOW_COPY_AND_ASSIGN(NotificationUIManagerAndroid);
76 }; 89 };
77 90
78 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_ANDROID_H_ 91 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698