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

Unified Diff: ui/message_center/notification.h

Issue 1292003004: Elide origins displayed on web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style nit Created 5 years, 4 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
« no previous file with comments | « ui/message_center/message_center_tray_unittest.cc ('k') | ui/message_center/notification.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/notification.h
diff --git a/ui/message_center/notification.h b/ui/message_center/notification.h
index 122cd6760629823e67d51cc789869a27269cad54..3b6186212524f42c284e1b4661b6551f05345730 100644
--- a/ui/message_center/notification.h
+++ b/ui/message_center/notification.h
@@ -16,6 +16,7 @@
#include "ui/message_center/notification_delegate.h"
#include "ui/message_center/notification_types.h"
#include "ui/message_center/notifier_settings.h"
+#include "url/gurl.h"
namespace message_center {
@@ -62,6 +63,7 @@ class MESSAGE_CENTER_EXPORT Notification {
const base::string16& message,
const gfx::Image& icon,
const base::string16& display_source,
+ const GURL& origin_url,
const NotifierId& notifier_id,
const RichNotificationData& optional_fields,
NotificationDelegate* delegate);
@@ -92,6 +94,11 @@ class MESSAGE_CENTER_EXPORT Notification {
const base::string16& message() const { return message_; }
void set_message(const base::string16& message) { message_ = message; }
+ // The origin URL of the script which requested the notification.
+ // Can be empty if the notification is requested by an extension or
+ // Chrome app.
+ const GURL& origin_url() const { return origin_url_; }
+
// A display string for the source of the notification.
const base::string16& display_source() const { return display_source_; }
@@ -123,13 +130,17 @@ class MESSAGE_CENTER_EXPORT Notification {
optional_fields_.timestamp = timestamp;
}
- const base::string16& context_message() const {
+ const base::string16 context_message() const {
return optional_fields_.context_message;
}
+
void set_context_message(const base::string16& context_message) {
optional_fields_.context_message = context_message;
}
+ // Decides if the notification origin should be used as a context message
+ bool UseOriginAsContextMessage() const;
+
const std::vector<NotificationItem>& items() const {
return optional_fields_.items;
}
@@ -233,6 +244,10 @@ class MESSAGE_CENTER_EXPORT Notification {
base::string16 display_source_;
private:
+ // The origin URL of the script which requested the notification.
+ // Can be empty if requested through a chrome app or extension or if
+ // it's a system notification.
+ GURL origin_url_;
NotifierId notifier_id_;
unsigned serial_number_;
RichNotificationData optional_fields_;
« no previous file with comments | « ui/message_center/message_center_tray_unittest.cc ('k') | ui/message_center/notification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698