| 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( |
| 392 PermissionType permission, | 408 PermissionType permission, |
| 393 const GURL& requesting_origin, | 409 const GURL& requesting_origin, |
| 394 const GURL& embedding_origin) { | 410 const GURL& embedding_origin) { |
| 395 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 411 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 396 if (IsConstantPermission(permission)) | 412 if (IsConstantPermission(permission)) |
| 397 return GetPermissionStatusForConstantPermission(permission); | 413 return GetPermissionStatusForConstantPermission(permission); |
| 398 | 414 |
| 399 PermissionContextBase* context = GetPermissionContext(permission); | 415 PermissionContextBase* context = GetPermissionContext(permission); |
| 400 if (!context) | 416 if (!context) |
| 401 return PermissionStatus::DENIED; | 417 return PermissionStatus::DENIED; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // Add the callback to |callbacks| which will be run after the loop to | 510 // Add the callback to |callbacks| which will be run after the loop to |
| 495 // prevent re-entrance issues. | 511 // prevent re-entrance issues. |
| 496 callbacks.push_back( | 512 callbacks.push_back( |
| 497 base::Bind(subscription->callback, | 513 base::Bind(subscription->callback, |
| 498 ContentSettingToPermissionStatus(new_value))); | 514 ContentSettingToPermissionStatus(new_value))); |
| 499 } | 515 } |
| 500 | 516 |
| 501 for (const auto& callback : callbacks) | 517 for (const auto& callback : callbacks) |
| 502 callback.Run(); | 518 callback.Run(); |
| 503 } | 519 } |
| OLD | NEW |