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

Unified Diff: chrome/browser/notifications/notification_platform_bridge_mac.mm

Issue 2827543003: Display ETLD+1 instead of the full domain in MacOSX native notifications (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/notification_platform_bridge_mac.mm
diff --git a/chrome/browser/notifications/notification_platform_bridge_mac.mm b/chrome/browser/notifications/notification_platform_bridge_mac.mm
index b3357a6ceb216506db1525ac67c10aba3b35f6dd..c2c3ecb1431f650c519b751b4dc3cbc58b6d26bf 100644
--- a/chrome/browser/notifications/notification_platform_bridge_mac.mm
+++ b/chrome/browser/notifications/notification_platform_bridge_mac.mm
@@ -36,6 +36,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/crash/content/app/crashpad.h"
#include "components/url_formatter/elide_url.h"
+#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "third_party/WebKit/public/platform/modules/notifications/WebNotificationConstants.h"
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
#include "ui/base/l10n/l10n_util_mac.h"
@@ -195,14 +196,16 @@ void NotificationPlatformBridgeMac::Display(
notification.context_message().empty() &&
notification_type != NotificationCommon::EXTENSION;
- base::string16 subtitle =
+ NSString* subtitle =
Peter Beverloo 2017/04/18 13:43:45 Could we maybe split this out into a helper functi
Miguel Garcia 2017/04/18 14:44:24 Done.
requires_attribution
- ? url_formatter::FormatOriginForSecurityDisplay(
- url::Origin(notification.origin_url()),
- url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS)
- : notification.context_message();
-
- [builder setSubTitle:base::SysUTF16ToNSString(subtitle)];
+ ? base::SysUTF8ToNSString(
+ net::registry_controlled_domains::GetDomainAndRegistry(
+ notification.origin_url(),
+ net::registry_controlled_domains::
+ INCLUDE_PRIVATE_REGISTRIES))
Peter Beverloo 2017/04/18 13:43:45 The concern I have with this is that IP addresses
Miguel Garcia 2017/04/18 14:44:24 True, localhost was also affected so I went with a
+ : base::SysUTF16ToNSString(notification.context_message());
+
+ [builder setSubTitle:subtitle];
if (!notification.icon().IsEmpty()) {
[builder setIcon:notification.icon().ToNSImage()];
}
« no previous file with comments | « no previous file | chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698