| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
LGTM w/ AI comments that look valid to me.
if (reconnect_params_.has_value()) {Since `reconnect_params_` is now a member variable, you can eliminate the local `std::optional<ReconnectParams> reconnect_params;` entirely and avoid an unnecessary copy.
Also, doing the `CHECK` here means the host will crash if `reconnect_params_` is set but `enterprise_params_` is not. In the previous logic, reconnect parameters were gracefully ignored if it wasn't an enterprise session.
Consider removing the local `std::optional<ReconnectParams>` and simplifying this section to just:
```cpp
#if BUILDFLAG(IS_CHROMEOS) || !defined(NDEBUG)
bool is_enterprise_admin_user = enterprise_params_.has_value();
#endif
```
if (reconnect_params.has_value()) {If you remove the local `reconnect_params` above, you can update this block to use the member variable directly and safely perform the `CHECK` here since we are inside the `is_enterprise_admin_user` block:
```cpp
if (reconnect_params_.has_value()) {
CHECK(enterprise_params_->allow_reconnections);
it2me_host_->set_reconnect_params(*reconnect_params_);
}
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
Since `reconnect_params_` is now a member variable, you can eliminate the local `std::optional<ReconnectParams> reconnect_params;` entirely and avoid an unnecessary copy.
Also, doing the `CHECK` here means the host will crash if `reconnect_params_` is set but `enterprise_params_` is not. In the previous logic, reconnect parameters were gracefully ignored if it wasn't an enterprise session.
Consider removing the local `std::optional<ReconnectParams>` and simplifying this section to just:
```cpp
#if BUILDFLAG(IS_CHROMEOS) || !defined(NDEBUG)
bool is_enterprise_admin_user = enterprise_params_.has_value();
#endif
```
I was on the fence about the AI suggestion about the CHECK condition but I think the local var cleanup is a good improvement so I'll apply both.
If you remove the local `reconnect_params` above, you can update this block to use the member variable directly and safely perform the `CHECK` here since we are inside the `is_enterprise_admin_user` block:
```cpp
if (reconnect_params_.has_value()) {
CHECK(enterprise_params_->allow_reconnections);
it2me_host_->set_reconnect_params(*reconnect_params_);
}
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
7 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: remoting/host/it2me/it2me_native_messaging_host.cc
Insertions: 5, Deletions: 9.
@@ -299,13 +299,8 @@
}
}
- std::optional<ReconnectParams> reconnect_params;
#if BUILDFLAG(IS_CHROMEOS) || !defined(NDEBUG)
bool is_enterprise_admin_user = enterprise_params_.has_value();
- if (reconnect_params_.has_value()) {
- CHECK(enterprise_params_ && enterprise_params_->allow_reconnections);
- reconnect_params.emplace(*reconnect_params_);
- }
#endif
It2MeHost::CreateDeferredConnectContext create_connection_context;
@@ -332,8 +327,8 @@
api_token_getter_.set_access_token(access_token);
}
std::string ftl_device_id;
- if (reconnect_params.has_value()) {
- ftl_device_id = reconnect_params->ftl_device_id;
+ if (reconnect_params_.has_value()) {
+ ftl_device_id = reconnect_params_->ftl_device_id;
}
bool is_corp_user = message.FindBool(kIsCorpUser).value_or(false);
create_connection_context = base::BindOnce(
@@ -378,8 +373,9 @@
dialog_style = It2MeConfirmationDialog::DialogStyle::kEnterprise;
- if (reconnect_params.has_value()) {
- it2me_host_->set_reconnect_params(std::move(*reconnect_params));
+ if (reconnect_params_.has_value()) {
+ CHECK(enterprise_params_->allow_reconnections);
+ it2me_host_->set_reconnect_params(*reconnect_params_);
}
}
#endif
```
[remoting]: Remove enterprise params from JSON message interface.
This change refactors some code to prevent enterprise options from
being injected via the NMH JSON interface since enterprise sessions
have been using the Mojo interface for several years and no longer
rely on that codepath.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |