[AWC] window.maximize, minimize and restore promises implemented [chromium/src : main]

0 views
Skip to first unread message

Andrew Rayskiy (Gerrit)

unread,
Oct 30, 2025, 12:22:09 PM (7 days ago) Oct 30
to Patryk Chodur, Code Review Nudger, Olga Korokhina, Daniel Cheng, AyeAye, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, blink-revi...@chromium.org, alexmo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Olga Korokhina and Patryk Chodur

Andrew Rayskiy added 3 comments

File third_party/blink/renderer/core/exported/web_view_impl.cc
Line 3174, Patchset 7 (Latest): Vector<MinimizeCallback> callbacks(std::move(minimize_callbacks_));
Andrew Rayskiy . unresolved

std::exchange?

File third_party/blink/renderer/core/frame/web_frame_widget_impl.cc
Line 1875, Patchset 7 (Latest): if (window_show_state_ == ui::mojom::blink::WindowShowState::kMaximized) {
Andrew Rayskiy . unresolved

switch (...)

File third_party/blink/renderer/modules/awc/additional_windowing_controls.cc
Line 110, Patchset 7 (Latest): if (window->GetFrame()->GetWidgetForLocalRoot()->WindowShowState() ==
Andrew Rayskiy . unresolved

(here and elsewhere) this condition is hard to read. How about an anon func?
```
bool IsMaximized(LocalDOMWindow* window) { return ... }
```

and then...
```
if (IsMaximized(window)) {
resolver->Resolve();
return;
}

// inline the callback here...

window->GetFrame()->GetChromeClient().Maximize(*window->GetFrame(),
std::move(callback));
```

Is there any sense in allowing parallel requests btw? i.e. calling minimize() while a maximize() call is in progress?

Open in Gerrit

Related details

Attention is currently required from:
  • Olga Korokhina
  • Patryk Chodur
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I212501e1b8f0750becdd0c9aa3a474d4bb687f5e
Gerrit-Change-Number: 7041143
Gerrit-PatchSet: 7
Gerrit-Owner: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
Gerrit-Reviewer: Olga Korokhina <koro...@google.com>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: Daniel Cheng <dch...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Patryk Chodur <pch...@google.com>
Gerrit-Attention: Olga Korokhina <koro...@google.com>
Gerrit-Comment-Date: Thu, 30 Oct 2025 16:21:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Olga Korokhina (Gerrit)

unread,
Oct 30, 2025, 3:20:08 PM (7 days ago) Oct 30
to Patryk Chodur, Code Review Nudger, Andrew Rayskiy, Daniel Cheng, AyeAye, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, blink-revi...@chromium.org, alexmo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Patryk Chodur

Olga Korokhina added 3 comments

File third_party/blink/renderer/core/frame/web_frame_widget_impl.cc
Line 1875, Patchset 7 (Latest): if (window_show_state_ == ui::mojom::blink::WindowShowState::kMaximized) {
Andrew Rayskiy . unresolved

switch (...)

Olga Korokhina

+1

File third_party/blink/renderer/modules/awc/additional_windowing_controls.cc
Line 110, Patchset 7 (Latest): if (window->GetFrame()->GetWidgetForLocalRoot()->WindowShowState() ==
Andrew Rayskiy . unresolved

(here and elsewhere) this condition is hard to read. How about an anon func?
```
bool IsMaximized(LocalDOMWindow* window) { return ... }
```

and then...
```
if (IsMaximized(window)) {
resolver->Resolve();
return;
}

// inline the callback here...

window->GetFrame()->GetChromeClient().Maximize(*window->GetFrame(),
std::move(callback));
```

Is there any sense in allowing parallel requests btw? i.e. calling minimize() while a maximize() call is in progress?

Olga Korokhina

+1, as long as there are more than 1 inclusions of this check this seems to be reasonable.

Line 165, Patchset 7 (Latest): "Could not restore the window."));
Olga Korokhina . unresolved

Can we have a bit more of a context/reason here, f.i. "Window could not be restored due to [reason]", or this is not needed @greengrape ?

Open in Gerrit

Related details

Attention is currently required from:
  • Patryk Chodur
Gerrit-Comment-Date: Thu, 30 Oct 2025 19:19:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrew Rayskiy <green...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Patryk Chodur (Gerrit)

unread,
Oct 31, 2025, 4:52:25 AM (6 days ago) Oct 31
to Code Review Nudger, Olga Korokhina, Andrew Rayskiy, Daniel Cheng, AyeAye, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, blink-revi...@chromium.org, alexmo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Andrew Rayskiy and Olga Korokhina

Patryk Chodur added 4 comments

File third_party/blink/renderer/core/exported/web_view_impl.cc
Line 3174, Patchset 7: Vector<MinimizeCallback> callbacks(std::move(minimize_callbacks_));
Andrew Rayskiy . resolved

std::exchange?

Patryk Chodur

Done

File third_party/blink/renderer/core/frame/web_frame_widget_impl.cc
Line 1875, Patchset 7: if (window_show_state_ == ui::mojom::blink::WindowShowState::kMaximized) {
Andrew Rayskiy . resolved

switch (...)

Olga Korokhina

+1

Patryk Chodur

Done

File third_party/blink/renderer/modules/awc/additional_windowing_controls.cc
Line 110, Patchset 7: if (window->GetFrame()->GetWidgetForLocalRoot()->WindowShowState() ==
Andrew Rayskiy . unresolved

(here and elsewhere) this condition is hard to read. How about an anon func?
```
bool IsMaximized(LocalDOMWindow* window) { return ... }
```

and then...
```
if (IsMaximized(window)) {
resolver->Resolve();
return;
}

// inline the callback here...

window->GetFrame()->GetChromeClient().Maximize(*window->GetFrame(),
std::move(callback));
```

Is there any sense in allowing parallel requests btw? i.e. calling minimize() while a maximize() call is in progress?

Olga Korokhina

+1, as long as there are more than 1 inclusions of this check this seems to be reasonable.

Patryk Chodur

Added the anon function and inlined the callback.

As for whether it makes sense to issue parallel requests – in general it doesn't make much sense to do it, but it's likely going to happen because:

  • this is a UI thing and we're resolving the promises when the OS changes the window state. In case of any lag the user will likely try to hit various buttons and the app will issue appropriate requests
  • the OS can ignore the requests to change the window state. What will happen right now is we'll never resolve nor reject the promise. I plan to add some timeouts, but even then we can have 2 pending promises waiting to be resolved or rejected.
Line 165, Patchset 7: "Could not restore the window."));
Olga Korokhina . unresolved

Can we have a bit more of a context/reason here, f.i. "Window could not be restored due to [reason]", or this is not needed @greengrape ?

Patryk Chodur

As of now these callbacks can't really be rejected unless somebody breaks something in the code. The checks for whether the API is allowed and makes sense were earlier, for example in the `IsPermissionGranted` function.

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Rayskiy
  • Olga Korokhina
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I212501e1b8f0750becdd0c9aa3a474d4bb687f5e
Gerrit-Change-Number: 7041143
Gerrit-PatchSet: 8
Gerrit-Owner: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
Gerrit-Reviewer: Olga Korokhina <koro...@google.com>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: Daniel Cheng <dch...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Rayskiy <green...@google.com>
Gerrit-Attention: Olga Korokhina <koro...@google.com>
Gerrit-Comment-Date: Fri, 31 Oct 2025 08:52:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrew Rayskiy <green...@google.com>
Comment-In-Reply-To: Olga Korokhina <koro...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Rayskiy (Gerrit)

unread,
Nov 3, 2025, 5:31:57 AM (3 days ago) Nov 3
to Patryk Chodur, Code Review Nudger, Olga Korokhina, Daniel Cheng, AyeAye, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, blink-revi...@chromium.org, alexmo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Olga Korokhina and Patryk Chodur

Andrew Rayskiy added 3 comments

File third_party/blink/renderer/core/exported/web_view_impl.h
Line 1032, Patchset 8 (Latest): Vector<MinimizeCallback> minimize_callbacks_;
Andrew Rayskiy . unresolved

Maybe use `base/callback_list.h` here? I'm not sure what the guidance here is.

File third_party/blink/renderer/core/page/chrome_client_impl.cc
Line 256, Patchset 8 (Latest): std::move(callback).Run(/*minimized=*/false);
Andrew Rayskiy . unresolved

You're removing this branching in https://chromium-review.googlesource.com/c/chromium/src/+/7106319/1/third_party/blink/renderer/core/page/chrome_client_impl.h. Is it really necessary for the API to include true/false return values?

File third_party/blink/renderer/modules/awc/additional_windowing_controls.cc
Line 120, Patchset 8 (Latest): [](ScriptPromiseResolver<IDLUndefined>* resolver, bool maximized) {
Andrew Rayskiy . unresolved

this looks like something that could be shared between the three functions as the only thing that differs is the error param.

Open in Gerrit

Related details

Attention is currently required from:
  • Olga Korokhina
  • Patryk Chodur
Gerrit-Attention: Patryk Chodur <pch...@google.com>
Gerrit-Attention: Olga Korokhina <koro...@google.com>
Gerrit-Comment-Date: Mon, 03 Nov 2025 10:31:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Patryk Chodur (Gerrit)

unread,
Nov 3, 2025, 8:33:17 AM (3 days ago) Nov 3
to Code Review Nudger, Olga Korokhina, Andrew Rayskiy, Daniel Cheng, AyeAye, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, blink-revi...@chromium.org, alexmo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Andrew Rayskiy and Olga Korokhina

Patryk Chodur added 3 comments

File third_party/blink/renderer/core/exported/web_view_impl.h
Line 1032, Patchset 8: Vector<MinimizeCallback> minimize_callbacks_;
Andrew Rayskiy . unresolved

Maybe use `base/callback_list.h` here? I'm not sure what the guidance here is.

Patryk Chodur

I don't see it being used in the blink code ([here](https://source.chromium.org/search?q=CallbackList%20path:blink&sq=)) whereas a `Vector` with callbacks is used in many places ([here](https://source.chromium.org/search?q=case:yes%20pcre:yes%20Vector%3C%5B%5Cw%3C%3E%5Cs:%5D%2B%5BcC%5Dallback%5Cw%2B;%20path:blink)). Besides, `CallbackList` is mostly useful for fixing lifetime issues (with the `CallbackListSubscription`), but the promise resolved in these callbacks is garbage collected, so _as far as I understand_ there's no problem.

File third_party/blink/renderer/core/page/chrome_client_impl.cc
Line 256, Patchset 8: std::move(callback).Run(/*minimized=*/false);
Andrew Rayskiy . unresolved

You're removing this branching in https://chromium-review.googlesource.com/c/chromium/src/+/7106319/1/third_party/blink/renderer/core/page/chrome_client_impl.h. Is it really necessary for the API to include true/false return values?

Patryk Chodur

After I remove the `#ifdefs` I think no. I plan to add timeouts to the callbacks which will require that, but given that it will be done in a different CL I can remove them when rebasing.

File third_party/blink/renderer/modules/awc/additional_windowing_controls.cc
Line 120, Patchset 8: [](ScriptPromiseResolver<IDLUndefined>* resolver, bool maximized) {
Andrew Rayskiy . resolved

this looks like something that could be shared between the three functions as the only thing that differs is the error param.

Patryk Chodur

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Rayskiy
  • Olga Korokhina
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I212501e1b8f0750becdd0c9aa3a474d4bb687f5e
Gerrit-Change-Number: 7041143
Gerrit-PatchSet: 9
Gerrit-Owner: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
Gerrit-Reviewer: Olga Korokhina <koro...@google.com>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: Daniel Cheng <dch...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Rayskiy <green...@google.com>
Gerrit-Attention: Olga Korokhina <koro...@google.com>
Gerrit-Comment-Date: Mon, 03 Nov 2025 13:33:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrew Rayskiy <green...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages