| Code-Review | +1 |
if (content_settings::CanBeAutoRevoked(content_settings_type(), value,Should we change the CanBeAutoRevoked method that takes a ContentSetting to take a PermissionSetting instead?
The base::Value method seems to be for chooser permissions
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
blink::mojom::PermissionStatus basic_permission_status,we could move this method to the permissions code base. You can't include permissions code in content_settings
return IsChooserPermissionEligibleForAutoRevocation(type) && !value.is_none();This method now only works for chooser permissions. Could we CHECK that something is a chooser permission?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
blink::mojom::PermissionStatus basic_permission_status,we could move this method to the permissions code base. You can't include permissions code in content_settings
As mentioned, moving the method to permissions code is quite challenging as it requires moving quite a bit of safety hub related stuff there as we still can't depend on permissions code from content_settings. I figured out how to resolve the dependency issue in the current state in content settings, however I also figured out why the tests failed: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/safety_hub/revoked_permissions_service.cc;l=860;drc=17b4c42cfb3512836655464b0d41d319e819c0b6 --> the method using base::Value is not used for chooser based settings only. So the best solution is to add this to the delegate. I've special cased ContentSettings and added TODOs where the full content setting migration to PermissionSetting will lead to simplifications.
return IsChooserPermissionEligibleForAutoRevocation(type) && !value.is_none();This method now only works for chooser permissions. Could we CHECK that something is a chooser permission?
No longer fully relevant, but we don't have a utility method for this. However, I think it will be sufficient to check it's not a permission setting (once content settings have been migrated to it), since IsChooserPermissionEligibleForAutoRevocation should return false in that case anyway.
if (content_settings::CanBeAutoRevoked(content_settings_type(), value,Should we change the CanBeAutoRevoked method that takes a ContentSetting to take a PermissionSetting instead?
The base::Value method seems to be for chooser permissions
No longer relevant.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (auto* info =Could you add a TODO to remove the if/else when contentsettings are also registered as permission settings?
return IsChooserPermissionEligibleForAutoRevocation(type) && !value.is_none();Florian JackyThis method now only works for chooser permissions. Could we CHECK that something is a chooser permission?
No longer fully relevant, but we don't have a utility method for this. However, I think it will be sufficient to check it's not a permission setting (once content settings have been migrated to it), since IsChooserPermissionEligibleForAutoRevocation should return false in that case anyway.
Ideally we have a method that handles all possible contentsettings. But we can follow up on this
// Return whether the setting is valid.I removed these comments since this is the implementation of the delegate and the original definition has comments
auto* geolocation_setting = std::get_if<GeolocationSetting>(&setting);I'd use std::get here. If this is called for the wrong type, then it is ok to crash
void CheckPermissionTypeRegistration(ContentSettingsType content_type) {It looks like this was duplicated?
// Returns whether the permission setting can be auto-revoked.maybe add "by safety hub"?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (auto* info =Could you add a TODO to remove the if/else when contentsettings are also registered as permission settings?
Done, they are currently handled in the other block. Updated the comment and added an update todo.
I removed these comments since this is the implementation of the delegate and the original definition has comments
Done
auto* geolocation_setting = std::get_if<GeolocationSetting>(&setting);I'd use std::get here. If this is called for the wrong type, then it is ok to crash
Done
void CheckPermissionTypeRegistration(ContentSettingsType content_type) {It looks like this was duplicated?
Ah yes, that was a rebase error, fixed.
// Returns whether the permission setting can be auto-revoked.maybe add "by safety hub"?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// Returns whether ContentSettingPermissionContextBase-based or
// ObjectPermissionContextBase-based permission's ContentSettingsType is an
// eligible permission for auto-revocation. Directly use theActually, why don't we just move the code from revoked_permissions_service.cc here already? Then the method handles all types of settings and callers don't need to worry about the type of setting they are dealing with
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// Returns whether ContentSettingPermissionContextBase-based or
// ObjectPermissionContextBase-based permission's ContentSettingsType is an
// eligible permission for auto-revocation. Directly use theActually, why don't we just move the code from revoked_permissions_service.cc here already? Then the method handles all types of settings and callers don't need to worry about the type of setting they are dealing with
The service isn't always triggered from the PermissionContext. I think it makes sense to have its own service instead of a global method. This particular method is used to set a constraint in the context that will later be processed.
However, I agree that callers shouldn't need to worry abotu this. I've packed the logic for which type should be used (and calling the delegate for settings) into this method.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
lgtm
if (auto* info =
content_settings::PermissionSettingsRegistry::GetInstance()->Get(
entry.type)) {
can_be_autorevoked = info->delegate().CanBeAutoRevoked(
/*setting=*/info->delegate()
.FromValue(entry.source.setting_value)
.value_or(info->GetInitialDefaultSetting()),
/*is_one_time=*/false);
} else {this code can be removed now
// Returns whether ContentSettingPermissionContextBase-based or
// ObjectPermissionContextBase-based permission's ContentSettingsType is an
// eligible permission for auto-revocation. Directly use theFlorian JackyActually, why don't we just move the code from revoked_permissions_service.cc here already? Then the method handles all types of settings and callers don't need to worry about the type of setting they are dealing with
The service isn't always triggered from the PermissionContext. I think it makes sense to have its own service instead of a global method. This particular method is used to set a constraint in the context that will later be processed.
However, I agree that callers shouldn't need to worry abotu this. I've packed the logic for which type should be used (and calling the delegate for settings) into this method.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
@dtap...@chromium.org could you PTAL at the minor change in content/public/browser/ permission_result.h ?
@sidey...@chromium.org could you PTAL at the minor change in chrome/browser/ui/safety_hub/revoked_permissions_service.cc ?
if (auto* info =
content_settings::PermissionSettingsRegistry::GetInstance()->Get(
entry.type)) {
can_be_autorevoked = info->delegate().CanBeAutoRevoked(
/*setting=*/info->delegate()
.FromValue(entry.source.setting_value)
.value_or(info->GetInitialDefaultSetting()),
/*is_one_time=*/false);
} else {this code can be removed now
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Removed Auto-Submit+1 by Florian Jacky <fja...@chromium.org>
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
#include "base/values.h"can we remove this include?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// TODO(crbug.com/425642101): Update comment When ContentSettings have
// been migrated to PermissionSettings, they can also use
// PermissionSettingsInfo::Delegate.I think this TODO can be removed now?
// TODO(crbug.com/425642101): Update comment When ContentSettings have
// been migrated to PermissionSettings, they can also use
// PermissionSettingsInfo::Delegate.I think this TODO can be removed now?
Done
#include "base/values.h"can we remove this include?
I don't think so, it would require declaring the variant again which requires a forward declaration of ContentSetting.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
#include "base/values.h"Florian Jackycan we remove this include?
I don't think so, it would require declaring the variant again which requires a forward declaration of ContentSetting.
| Code-Review | +1 |
#include "base/values.h"Florian Jackycan we remove this include?
Christian DullweberI don't think so, it would require declaring the variant again which requires a forward declaration of ContentSetting.
I mean base/values.h
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[PermissionOptions] Move to using PermissionSetting in permission infra
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |