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

Side by Side Diff: chrome/browser/permissions/permission_manager.cc

Issue 2745453002: Add requesting origin param to PermissionManager::GetPermissionStatusForFrame (Closed)
Patch Set: 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
« no previous file with comments | « chrome/browser/permissions/permission_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/permissions/permission_manager.h" 5 #include "chrome/browser/permissions/permission_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 PermissionResult PermissionManager::GetPermissionStatus( 333 PermissionResult PermissionManager::GetPermissionStatus(
334 ContentSettingsType permission, 334 ContentSettingsType permission,
335 const GURL& requesting_origin, 335 const GURL& requesting_origin,
336 const GURL& embedding_origin) { 336 const GURL& embedding_origin) {
337 return GetPermissionStatusHelper(permission, nullptr /* render_frame_host */, 337 return GetPermissionStatusHelper(permission, nullptr /* render_frame_host */,
338 requesting_origin, embedding_origin); 338 requesting_origin, embedding_origin);
339 } 339 }
340 340
341 PermissionResult PermissionManager::GetPermissionStatusForFrame( 341 PermissionResult PermissionManager::GetPermissionStatusForFrame(
342 ContentSettingsType permission, 342 ContentSettingsType permission,
343 content::RenderFrameHost* render_frame_host) { 343 content::RenderFrameHost* render_frame_host,
344 const GURL& requesting_origin) {
344 content::WebContents* web_contents = 345 content::WebContents* web_contents =
345 content::WebContents::FromRenderFrameHost(render_frame_host); 346 content::WebContents::FromRenderFrameHost(render_frame_host);
346 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); 347 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
347 return GetPermissionStatusHelper( 348 return GetPermissionStatusHelper(permission, render_frame_host,
348 permission, render_frame_host, 349 requesting_origin, embedding_origin);
349 render_frame_host->GetLastCommittedURL().GetOrigin(), embedding_origin);
350 } 350 }
351 351
352 int PermissionManager::RequestPermission( 352 int PermissionManager::RequestPermission(
353 PermissionType permission, 353 PermissionType permission,
354 content::RenderFrameHost* render_frame_host, 354 content::RenderFrameHost* render_frame_host,
355 const GURL& requesting_origin, 355 const GURL& requesting_origin,
356 bool user_gesture, 356 bool user_gesture,
357 const base::Callback<void(PermissionStatus)>& callback) { 357 const base::Callback<void(PermissionStatus)>& callback) {
358 ContentSettingsType content_settings_type = 358 ContentSettingsType content_settings_type =
359 PermissionTypeToContentSetting(permission); 359 PermissionTypeToContentSetting(permission);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 } 538 }
539 PermissionContextBase* context = GetPermissionContext(permission); 539 PermissionContextBase* context = GetPermissionContext(permission);
540 PermissionResult result = context->GetPermissionStatus( 540 PermissionResult result = context->GetPermissionStatus(
541 nullptr /* render_frame_host */, requesting_origin.GetOrigin(), 541 nullptr /* render_frame_host */, requesting_origin.GetOrigin(),
542 embedding_origin.GetOrigin()); 542 embedding_origin.GetOrigin());
543 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW || 543 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW ||
544 result.content_setting == CONTENT_SETTING_ASK || 544 result.content_setting == CONTENT_SETTING_ASK ||
545 result.content_setting == CONTENT_SETTING_BLOCK); 545 result.content_setting == CONTENT_SETTING_BLOCK);
546 return result; 546 return result;
547 } 547 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698