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

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

Issue 1071773003: Remove persistent notifications from the database when they close. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-db-Integrate
Patch Set: rebase Created 5 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/notifications/persistent_notification_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/notifications/notification_ui_manager_android.h" 5 #include "chrome/browser/notifications/notification_ui_manager_android.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/android/jni_array.h" 9 #include "base/android/jni_array.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 return true; 74 return true;
75 } 75 }
76 76
77 bool NotificationUIManagerAndroid::OnNotificationClosed( 77 bool NotificationUIManagerAndroid::OnNotificationClosed(
78 JNIEnv* env, 78 JNIEnv* env,
79 jobject java_object, 79 jobject java_object,
80 jlong persistent_notification_id, 80 jlong persistent_notification_id,
81 jstring java_origin, 81 jstring java_origin,
82 jstring java_tag) { 82 jstring java_tag) {
83 // TODO(peter): Implement handling when a notification has been closed. The 83 GURL origin(ConvertJavaStringToUTF8(env, java_origin));
84 // notification database has to reflect this in its own state. 84 std::string tag = ConvertJavaStringToUTF8(env, java_tag);
85
86 // The notification was closed by the platform, so clear all local state.
87 regenerated_notification_infos_.erase(persistent_notification_id);
88
89 // TODO(peter): Rather than assuming that the last used profile is the
90 // appropriate one for this notification, the used profile should be
91 // stored as part of the notification's data. See https://crbug.com/437574.
92 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClose(
93 ProfileManager::GetLastUsedProfile(),
94 persistent_notification_id,
95 origin);
96
85 return true; 97 return true;
86 } 98 }
87 99
88 void NotificationUIManagerAndroid::Add(const Notification& notification, 100 void NotificationUIManagerAndroid::Add(const Notification& notification,
89 Profile* profile) { 101 Profile* profile) {
90 JNIEnv* env = AttachCurrentThread(); 102 JNIEnv* env = AttachCurrentThread();
91 103
92 // The Android notification UI manager only supports Web Notifications, which 104 // The Android notification UI manager only supports Web Notifications, which
93 // have a PersistentNotificationDelegate. The persistent id of the 105 // have a PersistentNotificationDelegate. The persistent id of the
94 // notification is exposed through it's interface. 106 // notification is exposed through it's interface.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return false; 212 return false;
201 } 213 }
202 214
203 void NotificationUIManagerAndroid::CancelAll() { 215 void NotificationUIManagerAndroid::CancelAll() {
204 NOTREACHED(); 216 NOTREACHED();
205 } 217 }
206 218
207 bool NotificationUIManagerAndroid::RegisterNotificationUIManager(JNIEnv* env) { 219 bool NotificationUIManagerAndroid::RegisterNotificationUIManager(JNIEnv* env) {
208 return RegisterNativesImpl(env); 220 return RegisterNativesImpl(env);
209 } 221 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/notifications/persistent_notification_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698