Add NativeWindowObserver::OnCloseButtonClicked
This commit is contained in:
parent
a25b49a127
commit
66fab65a1a
7 changed files with 35 additions and 13 deletions
|
@ -427,14 +427,6 @@ void NativeWindow::CloseFilePreview() {
|
|||
}
|
||||
|
||||
void NativeWindow::RequestToClosePage() {
|
||||
bool prevent_default = false;
|
||||
for (NativeWindowObserver& observer : observers_)
|
||||
observer.WillCloseWindow(&prevent_default);
|
||||
if (prevent_default) {
|
||||
WindowList::WindowCloseCancelled(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Assume the window is not responding if it doesn't cancel the close and is
|
||||
// not closed in 5s, in this way we can quickly show the unresponsive
|
||||
// dialog when the window is busy executing some script withouth waiting for
|
||||
|
@ -480,6 +472,25 @@ void NativeWindow::RendererResponsive(content::WebContents* source) {
|
|||
observer.OnWindowResponsive();
|
||||
}
|
||||
|
||||
void NativeWindow::NotifyWindowCloseButtonClicked() {
|
||||
// First ask the observers whether we want to close.
|
||||
bool prevent_default = false;
|
||||
for (NativeWindowObserver& observer : observers_)
|
||||
observer.WillCloseWindow(&prevent_default);
|
||||
if (prevent_default) {
|
||||
WindowList::WindowCloseCancelled(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Then ask the observers how should we close the window.
|
||||
for (NativeWindowObserver& observer : observers_)
|
||||
observer.OnCloseButtonClicked(&prevent_default);
|
||||
if (prevent_default)
|
||||
return;
|
||||
|
||||
CloseImmediately();
|
||||
}
|
||||
|
||||
void NativeWindow::NotifyWindowClosed() {
|
||||
if (is_closed_)
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue