New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 769168 link

Starred by 1 user

Issue metadata

Status: Archived
Owner:
Closed: Oct 22
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug

Blocking:
issue 726246



Sign in to add a comment

Improve formatting of notifier URLs in notification settings

Project Member Reported by tetsui@chromium.org, Sep 27 2017

Issue description

Currently we are showing verbose URLs as web notifier source texts. (e.g. https://example.com:443) We can use safe formatter here.

https://cs.chromium.org/chromium/src/chrome/browser/notifications/web_page_notifier_source.cc

formatter:
https://cs.chromium.org/chromium/src/components/url_formatter/url_formatter.h
 
notificationsettings.png
46.5 KB View Download

Comment 1 by peter@chromium.org, Sep 28 2017

We should make sure that this matches the attribution on the notification view.

In the current views we do this using NotificationView::FormatContextMessage(). The call to url_formatter::FormatUrlForSecurityDisplay() there is correct, so that could be copied.

BTW, where do we decide on how to render the context message (or origin URL) for the MD style notifications?

Comment 2 by tetsui@chromium.org, Sep 28 2017

In this case, each items are not GURL but ContentSettingsPattern (which may include wildcard), so I found we cannot use url_formatter directly.

In this line it passes ContentsSettingsPattern.ToString() to GURL(), which is failing on an item with wildcard. We may also have to fix that.
https://cs.chromium.org/chromium/src/chrome/browser/notifications/web_page_notifier_source.cc?l=43&rcl=06f1401e7bd52b5c597f40bf22c67c58c66cf48e

> BTW, where do we decide on how to render the context message (or origin URL) for the MD style notifications?

it uses |display_source|.
https://cs.chromium.org/chromium/src/ui/message_center/views/notification_view_md.cc?l=533&rcl=3b950aeae28ec523a6296ea39c1cb3e746d0f061

It comes from here, so it's GURL::host().
https://cs.chromium.org/chromium/src/chrome/browser/notifications/platform_notification_service_impl.cc?l=449&rcl=06f1401e7bd52b5c597f40bf22c67c58c66cf48e

It seems we should change this to FormatUrlForSecurityDisplay too?

Comment 3 by peter@chromium.org, Sep 28 2017

Right - the URL included in |display_source| indicates the pattern because of which permission has been granted, not where the notification comes from.

To give an example, a pattern might be "https://*:*", meaning that any https site can display notifications. It wouldn't be useful for the notification to display that.

Because of that Notifications can have an origin, which is available through Notification::origin_url():

https://cs.chromium.org/chromium/src/ui/message_center/notification.h?q=notification.h+f:mess&sq=package:chromium&dr=CSs&l=254

That should be used instead of the |display_source| when available.

On a tangent, do we still display context messages? If we don't, that's deprecation and we need to go through the right processes for that. (Which we already did for Mac.)

Comment 4 by tetsui@chromium.org, Sep 28 2017

We still use Notification::display_source for context titles such as "Download manager" so I don't think we can completely remove the attribute.
download1x.png
14.7 KB View Download
Status: Archived (was: Assigned)

Sign in to add a comment