NSString* FormatTime(const base::Time& time) {Tian Ye`base::Time` is a wrapper around an integral value. It is better to pass it by value than by reference. So
```
NSString* FormatTime(base::Time time) {
...
```
Done
- (PageInfoSiteCertificateDetailInfo*)certificateDetailInfoFromX509Model:Tian YeI looks like this method and all the helper methods don't use `self`. I think it would be better to change them to free functions.
Additionally, since they are complex, I would move them to a new file, make them public and test test individually.
So `page_info_site_certificate_chain_utils.h` file that contains functions like this:
```
// Creates a PageInfoSiteCertificateDetailInfo from an X509CertificateModel.
PageInfoSiteCertificateDetailInfo*
CertificateDetailInfoFromX509Model(const X509CertificateModel& model);// Creates a PageInfoCertificateSignatureInfo from an X509CertificateModel.
PageInfoCertificateSignatureInfo*
CertificateSignatureInfoFromX509Model(const X509CertificateModel& model);...
```
Done
// Signature info.Tian YeI don't think those comments bring any added value. This is self-explanatory code as the variable and methods names are explicitly. Please remove them.
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
if (!_webState) {optional nit: you can probably combine the two ifs.
PageInfoCertificateSignatureInfo* SignatureInfoFromModel(nit: it's a bit unfortunate that all the functions bellow are on the header file just for testing purposes. would it be possible to still test this functionality, without putting them there? could you instead use CertificateDetailInfoFromX509Model and check for a specific field?
// then intermediates). If this method is not called, the certificate row shouldnit: or the array is empty?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
optional nit: you can probably combine the two ifs.
Done
PageInfoCertificateSignatureInfo* SignatureInfoFromModel(nit: it's a bit unfortunate that all the functions bellow are on the header file just for testing purposes. would it be possible to still test this functionality, without putting them there? could you instead use CertificateDetailInfoFromX509Model and check for a specific field?
Done
// then intermediates). If this method is not called, the certificate row shouldnit: or the array is empty?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
lgtm once the comment has been adressed
if (!self.consumer || !_webState) {I think you should also test whether `WebState` is realized or not. The reason is that unrealized `WebState` does not have a `NavigationManager`, but calling `GetNavigationManager()` on it will cause the object to be created, and we want to avoid forcing realization of `WebState`s.
So
```
if (!self.consumer || !_webState || !_webState->IsRealized()) {
return;
}
```
| 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. |
I think you should also test whether `WebState` is realized or not. The reason is that unrealized `WebState` does not have a `NavigationManager`, but calling `GetNavigationManager()` on it will cause the object to be created, and we want to avoid forcing realization of `WebState`s.
So
```
if (!self.consumer || !_webState || !_webState->IsRealized()) {
return;
}
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | -1 |
please address my comment on earlier CL before landing
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Tian Ye abandoned this change.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |