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/permissions/permission_manager.h" | 5 #include "chrome/browser/permissions/permission_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 382 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
383 PermissionContextBase* context = GetPermissionContext(permission); | 383 PermissionContextBase* context = GetPermissionContext(permission); |
384 if (!context) | 384 if (!context) |
385 return; | 385 return; |
386 | 386 |
387 context->ResetPermission(requesting_origin.GetOrigin(), | 387 context->ResetPermission(requesting_origin.GetOrigin(), |
388 embedding_origin.GetOrigin()); | 388 embedding_origin.GetOrigin()); |
389 } | 389 } |
390 | 390 |
391 PermissionStatus PermissionManager::GetPermissionStatus( | 391 PermissionStatus PermissionManager::GetPermissionStatus( |
392 HostContentSettingsMap* host, | |
393 content::PermissionType permission, | |
394 const GURL& requesting_origin, | |
395 const GURL& embedding_origin) { | |
396 if (IsConstantPermission(permission)) | |
397 return GetPermissionStatusForConstantPermission(permission); | |
398 | |
399 PermissionContextBase* context = GetPermissionContext(permission); | |
400 if (!context) | |
401 return PermissionStatus::DENIED; | |
402 | |
403 return ContentSettingToPermissionStatus(context->GetPermissionStatus( | |
404 host, requesting_origin.GetOrigin(), embedding_origin.GetOrigin())); | |
405 } | |
406 | |
407 PermissionStatus PermissionManager::GetPermissionStatus( | |
408 PermissionType permission, | 392 PermissionType permission, |
409 const GURL& requesting_origin, | 393 const GURL& requesting_origin, |
410 const GURL& embedding_origin) { | 394 const GURL& embedding_origin) { |
411 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 395 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
412 if (IsConstantPermission(permission)) | 396 if (IsConstantPermission(permission)) |
413 return GetPermissionStatusForConstantPermission(permission); | 397 return GetPermissionStatusForConstantPermission(permission); |
414 | 398 |
415 PermissionContextBase* context = GetPermissionContext(permission); | 399 PermissionContextBase* context = GetPermissionContext(permission); |
416 if (!context) | 400 if (!context) |
417 return PermissionStatus::DENIED; | 401 return PermissionStatus::DENIED; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 // Add the callback to |callbacks| which will be run after the loop to | 494 // Add the callback to |callbacks| which will be run after the loop to |
511 // prevent re-entrance issues. | 495 // prevent re-entrance issues. |
512 callbacks.push_back( | 496 callbacks.push_back( |
513 base::Bind(subscription->callback, | 497 base::Bind(subscription->callback, |
514 ContentSettingToPermissionStatus(new_value))); | 498 ContentSettingToPermissionStatus(new_value))); |
515 } | 499 } |
516 | 500 |
517 for (const auto& callback : callbacks) | 501 for (const auto& callback : callbacks) |
518 callback.Run(); | 502 callback.Run(); |
519 } | 503 } |
OLD | NEW |