OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/notifications/notification_permission_context.h" | |
6 | |
7 #include "chrome/browser/notifications/desktop_notification_profile_util.h" | |
8 | |
9 NotificationPermissionContext::NotificationPermissionContext(Profile* profile) | |
10 : PermissionContextBase(profile, CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {} | |
11 | |
12 NotificationPermissionContext::~NotificationPermissionContext() {} | |
13 | |
14 // Unlike other permission types, granting a notification for a given origin | |
15 // will not take into account the |embedder_origin|, it will only be based | |
16 // on the requesting iframe origin. | |
17 // TODO(mukai) Consider why notifications behave differently than | |
18 // other permissions. crbug.com/416894 | |
mlamouri (slow - plz ping)
2015/06/29 10:57:42
nit: add "https://"
Peter Beverloo
2015/06/29 12:54:21
Done.
| |
19 void NotificationPermissionContext::UpdateContentSetting( | |
20 const GURL& requesting_origin, | |
21 const GURL& embedder_origin, | |
22 ContentSetting content_setting) { | |
23 DCHECK(content_setting == CONTENT_SETTING_ALLOW || | |
24 content_setting == CONTENT_SETTING_BLOCK); | |
25 | |
26 if (content_setting == CONTENT_SETTING_ALLOW) { | |
27 DesktopNotificationProfileUtil::GrantPermission(profile(), | |
dewittj
2015/06/26 16:37:15
I get that it's correct, but from a readability pe
Peter Beverloo
2015/06/26 17:42:44
Yes, in removing all the DesktopNotification* bits
| |
28 requesting_origin); | |
29 } else { | |
30 DesktopNotificationProfileUtil::DenyPermission(profile(), | |
mlamouri (slow - plz ping)
2015/06/29 10:57:42
I think we could get ride of or at least greatly r
Peter Beverloo
2015/06/29 12:54:21
As replied to Jusin - that'll be done in a follow
| |
31 requesting_origin); | |
32 } | |
33 } | |
34 | |
35 bool NotificationPermissionContext::IsRestrictedToSecureOrigins() const { | |
36 return false; | |
37 } | |
OLD | NEW |