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

Side by Side Diff: chrome/browser/notifications/notification_permission_context.cc

Issue 2723983004: Add PermissionManager::GetPermissionStatusForFrame function (Closed)
Patch Set: Add PermissionManager::GetPermissionStatusForFrame function Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ContentSettingsType content_settings_type) 164 ContentSettingsType content_settings_type)
165 : PermissionContextBase(profile, content_settings_type), 165 : PermissionContextBase(profile, content_settings_type),
166 weak_factory_ui_thread_(this) { 166 weak_factory_ui_thread_(this) {
167 DCHECK(content_settings_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS || 167 DCHECK(content_settings_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS ||
168 content_settings_type == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING); 168 content_settings_type == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING);
169 } 169 }
170 170
171 NotificationPermissionContext::~NotificationPermissionContext() {} 171 NotificationPermissionContext::~NotificationPermissionContext() {}
172 172
173 ContentSetting NotificationPermissionContext::GetPermissionStatusInternal( 173 ContentSetting NotificationPermissionContext::GetPermissionStatusInternal(
174 content::RenderFrameHost* render_frame_host,
174 const GURL& requesting_origin, 175 const GURL& requesting_origin,
175 const GURL& embedding_origin) const { 176 const GURL& embedding_origin) const {
176 // Push messaging is only allowed to be granted on top-level origins. 177 // Push messaging is only allowed to be granted on top-level origins.
177 if (content_settings_type() == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING 178 if (content_settings_type() == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING
178 && requesting_origin != embedding_origin) { 179 && requesting_origin != embedding_origin) {
179 return CONTENT_SETTING_BLOCK; 180 return CONTENT_SETTING_BLOCK;
180 } 181 }
181 182
182 return PermissionContextBase::GetPermissionStatusInternal(requesting_origin, 183 return PermissionContextBase::GetPermissionStatusInternal(
183 embedding_origin); 184 render_frame_host, requesting_origin, embedding_origin);
184 } 185 }
185 186
186 void NotificationPermissionContext::ResetPermission( 187 void NotificationPermissionContext::ResetPermission(
187 const GURL& requesting_origin, 188 const GURL& requesting_origin,
188 const GURL& embedder_origin) { 189 const GURL& embedder_origin) {
189 DesktopNotificationProfileUtil::ClearSetting(profile(), requesting_origin); 190 DesktopNotificationProfileUtil::ClearSetting(profile(), requesting_origin);
190 } 191 }
191 192
192 void NotificationPermissionContext::CancelPermissionRequest( 193 void NotificationPermissionContext::CancelPermissionRequest(
193 content::WebContents* web_contents, 194 content::WebContents* web_contents,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 requesting_origin); 253 requesting_origin);
253 } else { 254 } else {
254 DesktopNotificationProfileUtil::DenyPermission(profile(), 255 DesktopNotificationProfileUtil::DenyPermission(profile(),
255 requesting_origin); 256 requesting_origin);
256 } 257 }
257 } 258 }
258 259
259 bool NotificationPermissionContext::IsRestrictedToSecureOrigins() const { 260 bool NotificationPermissionContext::IsRestrictedToSecureOrigins() const {
260 return content_settings_type() == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING; 261 return content_settings_type() == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING;
261 } 262 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698