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

Unified Diff: chrome/browser/notifications/persistent_notification_handler.cc

Issue 2300093002: Make //content responsible for generating notification Ids (Closed)
Patch Set: comments Created 4 years, 3 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: chrome/browser/notifications/persistent_notification_handler.cc
diff --git a/chrome/browser/notifications/persistent_notification_handler.cc b/chrome/browser/notifications/persistent_notification_handler.cc
index 37db8aa5a9ca25d2060c7d21d613a22f9f6ce5e9..810b0f1ea8ec00e0beaf36d6bc1983a1c20b78d1 100644
--- a/chrome/browser/notifications/persistent_notification_handler.cc
+++ b/chrome/browser/notifications/persistent_notification_handler.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/notifications/persistent_notification_handler.h"
#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
#include "chrome/browser/notifications/platform_notification_service_impl.h"
#include "chrome/browser/profiles/profile.h"
@@ -16,36 +15,25 @@ void PersistentNotificationHandler::OnClose(Profile* profile,
const std::string& origin,
const std::string& notification_id,
bool by_user) {
- // No need to propage back Close events from JS.
if (!by_user)
- return;
+ return; // no need to propagate back programmatic close events
- int64_t persistent_notification_id;
- GURL notification_origin(origin);
+ const GURL notification_origin(origin);
DCHECK(notification_origin.is_valid());
- if (!base::StringToInt64(notification_id, &persistent_notification_id)) {
- LOG(ERROR) << "Unable to convert notification ID: " << notification_id
- << " to integer.";
- return;
- }
+
PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClose(
- profile, persistent_notification_id, notification_origin, by_user);
+ profile, notification_id, notification_origin, by_user);
}
void PersistentNotificationHandler::OnClick(Profile* profile,
const std::string& origin,
const std::string& notification_id,
int action_index) {
- int64_t persistent_notification_id;
- if (!base::StringToInt64(notification_id, &persistent_notification_id)) {
- LOG(ERROR) << "Unable to convert notification ID: " << notification_id
- << " to integer.";
- return;
- }
- GURL notification_origin(origin);
+ const GURL notification_origin(origin);
DCHECK(notification_origin.is_valid());
+
PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick(
- profile, persistent_notification_id, notification_origin, action_index);
+ profile, notification_id, notification_origin, action_index);
}
void PersistentNotificationHandler::OpenSettings(Profile* profile) {

Powered by Google App Engine
This is Rietveld 408576698