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

Unified Diff: content/child/notifications/notification_manager.cc

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: 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 side-by-side diff with in-line comments
Download patch
Index: content/child/notifications/notification_manager.cc
diff --git a/content/child/notifications/notification_manager.cc b/content/child/notifications/notification_manager.cc
index 6f5e8fefdb49b9bf4b086661e4ba56c772ef8d16..29a32323fc8f5d78ef57fd9251422443123d17e5 100644
--- a/content/child/notifications/notification_manager.cc
+++ b/content/child/notifications/notification_manager.cc
@@ -5,6 +5,7 @@
#include "content/child/notifications/notification_manager.h"
#include "base/lazy_instance.h"
+#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_local.h"
@@ -164,10 +165,23 @@ void NotificationManager::close(blink::WebNotificationDelegate* delegate) {
void NotificationManager::closePersistent(
const blink::WebSerializedOrigin& origin,
- const blink::WebString& persistent_notification_id) {
+ const blink::WebString& persistent_notification_id_string) {
+ // TODO(peter): Blink should store the persistent_notification_id as an
+ // int64_t instead of a string. The id, created by Chromium, is a decimal
+ // number that fits in an int64_t, so convert it until the API updates.
+ base::string16 string_value = persistent_notification_id_string;
+
+ int64_t persistent_notification_id = 0;
+ if (!base::StringToInt64(string_value,
+ &persistent_notification_id)) {
+ DLOG(ERROR) << "Unable to close persistent notification; invalid id: "
johnme 2015/04/02 17:21:07 Nit: NOTREACHED() << ...?
Peter Beverloo 2015/04/07 17:46:11 Done.
+ << string_value;
+ return;
+ }
+
thread_safe_sender_->Send(new PlatformNotificationHostMsg_ClosePersistent(
GURL(origin.string()),
- base::UTF16ToUTF8(persistent_notification_id)));
+ persistent_notification_id));
}
void NotificationManager::notifyDelegateDestroyed(

Powered by Google App Engine
This is Rietveld 408576698