Skip to content

Commit 1782771

Browse files
NifuryPF4Public
authored andcommitted
Update
1 parent 8ebf064 commit 1782771

File tree

1 file changed

+17
-26
lines changed

1 file changed

+17
-26
lines changed

patches/extra/ungoogled-chromium/add-flag-for-close-confirmation.patch

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,24 @@
1717
override_bounds_(params.initial_bounds),
1818
initial_show_state_(params.initial_show_state),
1919
initial_workspace_(params.initial_workspace),
20-
@@ -852,12 +855,14 @@ bool Browser::TryToCloseWindow(
21-
bool skip_beforeunload,
22-
const base::RepeatingCallback<void(bool)>& on_close_confirmed) {
23-
cancel_download_confirmation_state_ = RESPONSE_RECEIVED;
24-
+ close_multitab_confirmation_state_ = RESPONSE_RECEIVED;
25-
return unload_controller_.TryToCloseWindow(skip_beforeunload,
26-
on_close_confirmed);
27-
}
20+
@@ -828,7 +831,7 @@ Browser::WarnBeforeClosingResult Browser
21+
// If the browser can close right away (there are no pending downloads we need
22+
// to prompt about) then there's no need to warn. In the future, we might need
23+
// to check other conditions as well.
24+
- if (CanCloseWithInProgressDownloads())
25+
+ if (CanCloseWithInProgressDownloads() && CanCloseWithMultipleTabs())
26+
return WarnBeforeClosingResult::kOkToClose;
27+
28+
DCHECK(!warn_before_closing_callback_)
29+
@@ -858,6 +861,7 @@ bool Browser::TryToCloseWindow(
2830

2931
void Browser::ResetTryToCloseWindow() {
3032
cancel_download_confirmation_state_ = NOT_PROMPTED;
3133
+ close_multitab_confirmation_state_ = NOT_PROMPTED;
3234
unload_controller_.ResetTryToCloseWindow();
3335
}
3436

35-
@@ -1741,6 +1746,13 @@ void Browser::BeforeUnloadFired(WebConte
36-
if (is_type_devtools() && DevToolsWindow::HandleBeforeUnload(
37-
web_contents, proceed, proceed_to_fire_unload))
38-
return;
39-
+ if (proceed &&
40-
+ (IsAttemptingToCloseBrowser() || this->tab_strip_model()->count() <= 1) &&
41-
+ !CanCloseWithMultipleTabs()) {
42-
+ proceed = false;
43-
+ warn_before_closing_callback_ = base::BindOnce(
44-
+ &Browser::FinishWarnBeforeClosing, weak_factory_.GetWeakPtr());
45-
+ }
46-
47-
*proceed_to_fire_unload =
48-
unload_controller_.BeforeUnloadFired(web_contents, proceed);
49-
@@ -2696,6 +2708,59 @@ bool Browser::CanCloseWithInProgressDown
37+
@@ -2696,6 +2700,62 @@ bool Browser::CanCloseWithInProgressDown
5038
return false;
5139
}
5240

@@ -81,8 +69,11 @@
8169
+ if (show_confirmation_last_window) {
8270
+ if (total_window_count >= 1 || this->tab_strip_model()->count() <= 1)
8371
+ return true;
84-
+ } else if (total_window_count == 0) {
85-
+ return true;
72+
+ } else {
73+
+ if (total_window_count == 0 && this->tab_strip_model()->count() <= 1)
74+
+ return true;
75+
+ if (this->tab_strip_model()->count() == 0)
76+
+ tab_strip_model_delegate_->AddTabAt(GURL(), -1, true);
8677
+ }
8778
+
8879
+ close_multitab_confirmation_state_ = WAITING_FOR_RESPONSE;
@@ -106,7 +97,7 @@
10697
void Browser::InProgressDownloadResponse(bool cancel_downloads) {
10798
if (cancel_downloads) {
10899
cancel_download_confirmation_state_ = RESPONSE_RECEIVED;
109-
@@ -2714,6 +2779,22 @@ void Browser::InProgressDownloadResponse
100+
@@ -2714,6 +2774,22 @@ void Browser::InProgressDownloadResponse
110101

111102
std::move(warn_before_closing_callback_)
112103
.Run(WarnBeforeClosingResult::kDoNotClose);

0 commit comments

Comments
 (0)