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

Unified Diff: chrome/browser/media/protected_media_identifier_permission_context.cc

Issue 955383003: ContentBrowserClient::RequestPermission replies with PermissionStatus instead of bool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android geolocation breakage Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/protected_media_identifier_permission_context.cc
diff --git a/chrome/browser/media/protected_media_identifier_permission_context.cc b/chrome/browser/media/protected_media_identifier_permission_context.cc
index 05e8a68a1195084934e7d8808f7ce4982128aa90..53496febc38ba2cadbf2db45a57fe21a1dec6f93 100644
--- a/chrome/browser/media/protected_media_identifier_permission_context.cc
+++ b/chrome/browser/media/protected_media_identifier_permission_context.cc
@@ -52,7 +52,7 @@ void ProtectedMediaIdentifierPermissionContext::RequestPermission(
if (!requesting_origin.is_valid() || !embedding_origin.is_valid() ||
!IsProtectedMediaIdentifierEnabled()) {
NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
- false /* persist */, false /* granted */);
+ false /* persist */, CONTENT_SETTING_BLOCK);
return;
}
@@ -65,24 +65,18 @@ void ProtectedMediaIdentifierPermissionContext::RequestPermission(
ContentSetting content_setting =
GetPermissionStatus(requesting_origin, embedding_origin);
- switch (content_setting) {
- case CONTENT_SETTING_BLOCK:
- NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
- false /* persist */, false /* granted */);
- return;
- case CONTENT_SETTING_ALLOW:
- NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
- false /* persist */, true /* granted */);
- return;
- default:
- break;
+ if (content_setting == CONTENT_SETTING_ALLOW ||
+ content_setting == CONTENT_SETTING_BLOCK) {
+ NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
+ false /* persist */, content_setting);
+ return;
}
// Since the dialog is modal, we only support one prompt per |web_contents|.
// Reject the new one if there is already one pending. See
// http://crbug.com/447005
if (pending_requests_.count(web_contents)) {
- callback.Run(false);
+ callback.Run(CONTENT_SETTING_DEFAULT);
return;
}
@@ -189,17 +183,25 @@ void ProtectedMediaIdentifierPermissionContext::OnPlatformVerificationResult(
DCHECK(request->second.second.Equals(id));
pending_requests_.erase(request);
- if (response == PlatformVerificationFlow::CONSENT_RESPONSE_NONE) {
- // Deny request and do not save to content settings.
- NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
- false, // Do not save to content settings.
- false); // Do not allow the permission.
- return;
+ ContentSetting content_setting;
+ bool persist; // Whether the ContentSetting should be saved.
+ switch (response) {
+ case PlatformVerificationFlow::CONSENT_RESPONSE_NONE:
+ content_setting = CONTENT_SETTING_DEFAULT;
+ persist = false;
+ break;
+ case PlatformVerificationFlow::CONSENT_RESPONSE_ALLOW:
+ content_setting = CONTENT_SETTING_ALLOW;
+ persist = true;
+ break;
+ case PlatformVerificationFlow::CONSENT_RESPONSE_DENY:
+ content_setting = CONTENT_SETTING_BLOCK;
+ persist = true;
+ break;
}
NotifyPermissionSet(
id, requesting_origin, embedding_origin, callback,
- true, // Save to content settings.
- response == PlatformVerificationFlow::CONSENT_RESPONSE_ALLOW);
+ persist, content_setting);
}
#endif

Powered by Google App Engine
This is Rietveld 408576698