| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/notifications/notification_permission_context.h" | 5 #include "chrome/browser/notifications/notification_permission_context.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 void NotificationPermissionContext::CancelPermissionRequest( | 190 void NotificationPermissionContext::CancelPermissionRequest( |
| 191 content::WebContents* web_contents, | 191 content::WebContents* web_contents, |
| 192 const PermissionRequestID& id) { | 192 const PermissionRequestID& id) { |
| 193 if (profile()->IsOffTheRecord()) { | 193 if (profile()->IsOffTheRecord()) { |
| 194 VisibilityTimerTabHelper::FromWebContents(web_contents)->CancelTask(id); | 194 VisibilityTimerTabHelper::FromWebContents(web_contents)->CancelTask(id); |
| 195 } else { | 195 } else { |
| 196 PermissionContextBase::CancelPermissionRequest(web_contents, id); | 196 PermissionContextBase::CancelPermissionRequest(web_contents, id); |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 bool NotificationPermissionContext::IsAllowedInWorkers() const { |
| 201 return true; |
| 202 } |
| 203 |
| 200 void NotificationPermissionContext::DecidePermission( | 204 void NotificationPermissionContext::DecidePermission( |
| 201 content::WebContents* web_contents, | 205 content::WebContents* web_contents, |
| 202 const PermissionRequestID& id, | 206 const PermissionRequestID& id, |
| 203 const GURL& requesting_origin, | 207 const GURL& requesting_origin, |
| 204 const GURL& embedding_origin, | 208 const GURL& embedding_origin, |
| 205 bool user_gesture, | 209 bool user_gesture, |
| 206 const BrowserPermissionCallback& callback) { | 210 const BrowserPermissionCallback& callback) { |
| 207 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 211 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 208 | 212 |
| 209 // Notifications permission is always denied in incognito. To prevent sites | 213 // Notifications permission is always denied in incognito. To prevent sites |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 requesting_origin); | 254 requesting_origin); |
| 251 } else { | 255 } else { |
| 252 DesktopNotificationProfileUtil::DenyPermission(profile(), | 256 DesktopNotificationProfileUtil::DenyPermission(profile(), |
| 253 requesting_origin); | 257 requesting_origin); |
| 254 } | 258 } |
| 255 } | 259 } |
| 256 | 260 |
| 257 bool NotificationPermissionContext::IsRestrictedToSecureOrigins() const { | 261 bool NotificationPermissionContext::IsRestrictedToSecureOrigins() const { |
| 258 return content_settings_type() == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING; | 262 return content_settings_type() == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING; |
| 259 } | 263 } |
| OLD | NEW |