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 "android_webview/browser/aw_permission_manager.h" | 5 #include "android_webview/browser/aw_permission_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 if (pending_request->IsCompleted()) | 482 if (pending_request->IsCompleted()) |
483 pending_requests_.Remove(request_id); | 483 pending_requests_.Remove(request_id); |
484 } | 484 } |
485 | 485 |
486 void AwPermissionManager::ResetPermission(PermissionType permission, | 486 void AwPermissionManager::ResetPermission(PermissionType permission, |
487 const GURL& requesting_origin, | 487 const GURL& requesting_origin, |
488 const GURL& embedding_origin) { | 488 const GURL& embedding_origin) { |
489 result_cache_->ClearResult(permission, requesting_origin, embedding_origin); | 489 result_cache_->ClearResult(permission, requesting_origin, embedding_origin); |
490 } | 490 } |
491 | 491 |
492 PermissionStatus AwPermissionManager::GetPermissionStatus( | 492 PermissionStatus AwPermissionManager::GetPermissionStatusForFrame( |
493 PermissionType permission, | 493 PermissionType permission, |
494 const GURL& requesting_origin, | 494 content::RenderFrameHost* render_frame_host, |
495 const GURL& embedding_origin) { | 495 const GURL& requesting_origin) { |
496 // Method is called outside the Permissions API only for this permission. | 496 // Method is called outside the Permissions API only for this permission. |
497 if (permission == PermissionType::PROTECTED_MEDIA_IDENTIFIER) { | 497 if (permission == PermissionType::PROTECTED_MEDIA_IDENTIFIER) { |
| 498 content::WebContents* web_contents = |
| 499 content::WebContents::FromRenderFrameHost(render_frame_host); |
| 500 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); |
498 return result_cache_->GetResult(permission, requesting_origin, | 501 return result_cache_->GetResult(permission, requesting_origin, |
499 embedding_origin); | 502 embedding_origin); |
500 } else if (permission == PermissionType::MIDI) { | 503 } else if (permission == PermissionType::MIDI) { |
501 return PermissionStatus::GRANTED; | 504 return PermissionStatus::GRANTED; |
502 } | 505 } |
503 | 506 |
504 return PermissionStatus::DENIED; | 507 return PermissionStatus::DENIED; |
505 } | 508 } |
506 | 509 |
| 510 PermissionStatus AwPermissionManager::GetPermissionStatusForWorker( |
| 511 PermissionType permission, |
| 512 const GURL& requesting_origin) { |
| 513 // Only PROTECTED_MEDIA_IDENTIFIER and MIDI are ever granted by |
| 514 // GetPermissionStatusForFrame and these can't be used from workers so just |
| 515 // deny all permissions. |
| 516 return PermissionStatus::DENIED; |
| 517 } |
| 518 |
507 int AwPermissionManager::SubscribePermissionStatusChange( | 519 int AwPermissionManager::SubscribePermissionStatusChange( |
508 PermissionType permission, | 520 PermissionType permission, |
509 const GURL& requesting_origin, | 521 const GURL& requesting_origin, |
510 const GURL& embedding_origin, | 522 const GURL& embedding_origin, |
511 const base::Callback<void(PermissionStatus)>& callback) { | 523 const base::Callback<void(PermissionStatus)>& callback) { |
512 return kNoPendingOperation; | 524 return kNoPendingOperation; |
513 } | 525 } |
514 | 526 |
515 void AwPermissionManager::UnsubscribePermissionStatusChange( | 527 void AwPermissionManager::UnsubscribePermissionStatusChange( |
516 int subscription_id) { | 528 int subscription_id) { |
(...skipping 26 matching lines...) Expand all Loading... |
543 ->GetLastCommittedURL().GetOrigin(); | 555 ->GetLastCommittedURL().GetOrigin(); |
544 } | 556 } |
545 | 557 |
546 AwBrowserPermissionRequestDelegate* AwPermissionManager::GetDelegate( | 558 AwBrowserPermissionRequestDelegate* AwPermissionManager::GetDelegate( |
547 int render_process_id, int render_frame_id) { | 559 int render_process_id, int render_frame_id) { |
548 return AwBrowserPermissionRequestDelegate::FromID(render_process_id, | 560 return AwBrowserPermissionRequestDelegate::FromID(render_process_id, |
549 render_frame_id); | 561 render_frame_id); |
550 } | 562 } |
551 | 563 |
552 } // namespace android_webview | 564 } // namespace android_webview |
OLD | NEW |