| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
This is a very nice change, thank you for doing this refactoring!
ContentSettingsType type = permissions::RequestTypeToContentSettingsType(
request_data.request_type.value())
.value();
CHECK(type == ContentSettingsType::GEOLOCATION ||
type == ContentSettingsType::GEOLOCATION_WITH_OPTIONS);You completely removed that retrieving and checking step of the type from the request_data and directly used the geolocationcontentsettingstype. Is it safe to assume here? It probably is since its a geolocation delegate - just checking.
blink::mojom::PermissionName::IDLE_DETECTION, nullptr),[optional] nit: /*extension=*/ nullptr . same below
nullptr, id, /*user_gesture=*/true, url),OK, this one was confusing, I was thinking how can a nullptr bind to a reference, but it seems like there is an implicit constructor for nullptr inside this weird mojom structptr thing. And then it relies upon PaymentHandlerPermissionContext being a single purpose class, knowing how to deduce its own permission type. Whatever, works - I find it not easy to understand why, however.
nit: Use /*permission_descriptor=*/ here .
#include "components/permissions/request_type.h"is this addition needed?
CreatePermissionResolver(nullptr);nit /*permission_descriptor=*/nullptr
just to be sure, that this will create and empty descriptor struct (because of it being a nullptr) is not an issue here?
nullptr, id, /*user_gesture=*/true, url, url),[optional] nit: /*permission_descriptor=*/ here and below
blink::mojom::PermissionName::BACKGROUND_SYNC, nullptr),[optional] nit /*extension=*/
blink::mojom::PermissionDescriptor::New(permission_name, nullptr);[optional] nit: /*extension=*/, here and below
url, blink::mojom::PermissionName::GEOLOCATION, 3);[optional] nit: /*iterations=*/ (was there before but since you are on it)
*request_data, std::move(callback),
/*persist=*/result_decision == PermissionDecision::kAllow,You change persist behavior here. It was always false, and now it depends on the `result_decision`. Is this intended?
CHECK(requested_geolocation_accuracy.has_value());This was a if before - I am sure you have your reasons why this will be set here always, just want to confirm it.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks for the thorough review!
ContentSettingsType type = permissions::RequestTypeToContentSettingsType(
request_data.request_type.value())
.value();
CHECK(type == ContentSettingsType::GEOLOCATION ||
type == ContentSettingsType::GEOLOCATION_WITH_OPTIONS);You completely removed that retrieving and checking step of the type from the request_data and directly used the geolocationcontentsettingstype. Is it safe to assume here? It probably is since its a geolocation delegate - just checking.
Yes. I also added a check to make sure of this.
blink::mojom::PermissionName::IDLE_DETECTION, nullptr),[optional] nit: /*extension=*/ nullptr . same below
Done
nullptr, id, /*user_gesture=*/true, url),OK, this one was confusing, I was thinking how can a nullptr bind to a reference, but it seems like there is an implicit constructor for nullptr inside this weird mojom structptr thing. And then it relies upon PaymentHandlerPermissionContext being a single purpose class, knowing how to deduce its own permission type. Whatever, works - I find it not easy to understand why, however.
nit: Use /*permission_descriptor=*/ here .
A mojo::StructPtr is basically a unique_ptr, so it should be relatively clear that we can pass a nullptr in, no?
For the rest, this thing is weird since it seems to reuse some of the permission logic even if it is not a permission (and there is no permission for payments, so..)
Anyway, added the comment :)
#include "components/permissions/request_type.h"Antonio Sartoriis this addition needed?
Done
CreatePermissionResolver(nullptr);nit /*permission_descriptor=*/nullptr
just to be sure, that this will create and empty descriptor struct (because of it being a nullptr) is not an issue here?
Added the comment.
Yes, I also don't particularly like it, but on the other hand it's used only in a dcheck, so...
nullptr, id, /*user_gesture=*/true, url, url),[optional] nit: /*permission_descriptor=*/ here and below
Done
nullptr),Antonio Sartori[optional] nit: /*extension=*/
Done
blink::mojom::PermissionName::BACKGROUND_SYNC, nullptr),Antonio Sartori[optional] nit /*extension=*/
Done
blink::mojom::PermissionDescriptor::New(permission_name, nullptr);[optional] nit: /*extension=*/, here and below
Done
url, blink::mojom::PermissionName::GEOLOCATION, 3);[optional] nit: /*iterations=*/ (was there before but since you are on it)
I would leave as is. I'm not sure it's helpful to add parameter names everywhere tbh.
*request_data, std::move(callback),
/*persist=*/result_decision == PermissionDecision::kAllow,You change persist behavior here. It was always false, and now it depends on the `result_decision`. Is this intended?
Thanks for noticing this! Fixed.
CHECK(requested_geolocation_accuracy.has_value());This was a if before - I am sure you have your reasons why this will be set here always, just want to confirm it.
Yes. With the new logic, GetRequestedGeolocationAccuracy always returns a valid value for a GEOLOCATION_WITH_OPTIONS request.
| 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. |
+jfernandez for register_protocol_handler_permission_request.cc
Marc could you stamp the remaining //chrome files?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
+jfernandez for register_protocol_handler_permission_request.cc
Marc could you stamp the remaining //chrome files?
Marc could you stamp the remaining //chrome files?
rslgtm % one question
ContentSettingsType::PAYMENT_HANDLER),Was this part not important/relevant?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
Thanks!
ContentSettingsType::PAYMENT_HANDLER),Was this part not important/relevant?
There is no RequestType for PAYMENT_HANDLER (https://source.chromium.org/chromium/chromium/src/+/main:components/permissions/request_type.cc;l=212;drc=84fb307ed868ca8903dba11a75a1f0afc34bffb3). The correct PermissionResolver is anyway instantiated using the content_settings_type of the PermissionContext when needed (https://source.chromium.org/chromium/chromium/src/+/main:components/permissions/permission_context_base.cc;l=733;drc=01f3fea318f80b5541e1d5eb8dfeb174820926be)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[permissions] Refactor PermissionRequestData
This CL refactors PermissionRequestData so that it becomes again a
data-only struct (which can be e.g. cloned) by removing the
PermissionResolver member. This allows simplifying
GeolocationPermissionContextAndroid, where we don't need to recreate
fake PermissionRequestData for the callbacks anymore.
The refactoring unfortunately implies adapting all callsites, which
however become more natural as they don't need to instantiate a
PermissionResolver anymore.
R=hempj...@google.com
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |