Do not request permission when autoplay is allowed for the page #520
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix brave/brave-browser#1120
When we allow autoplay for a page and reload it, if there are frames from different origins in this page need the autoplay permission, it will prompt the "autoplay is blocked" message in the URL bar.
The URL being shown in that bubble will always be this page's origin per https://github.com/brave/brave-core/blob/master/browser/ui/content_settings/brave_autoplay_content_setting_bubble_model.cc#L58.
The expected behavior here should be that we only need to allow for the entire page.
To fix this, this PR revise the logic in AllowAutoplay so we won't request permission when autoplay is already allowed per content setting, so those confusing prompt for subframes in different origin won't be there after the page's origin (primary_url) is allowed.
Submitter Checklist:
git rebase -i
to squash commits (if needed).Test Plan:
Reddit
Google Drive
(Please note that we still cannot play mp4 files from google drive, there seems to be a separate issue causing that, which won't be fixed by this PR)
Reviewer Checklist: