Implement beforeunload event.
Unlike normal browser which would show a dialog to choose whether to continue, you can just return a empty string in the handler to prevent unloading.
This commit is contained in:
parent
bcf6cd9f1b
commit
a674572dd4
5 changed files with 73 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
|||
#include "browser/api/atom_browser_bindings.h"
|
||||
#include "browser/atom_browser_context.h"
|
||||
#include "browser/atom_browser_main_parts.h"
|
||||
#include "browser/atom_javascript_dialog_manager.h"
|
||||
#include "content/public/browser/navigation_entry.h"
|
||||
#include "content/public/browser/notification_details.h"
|
||||
#include "content/public/browser/notification_source.h"
|
||||
|
@ -153,6 +154,13 @@ void NativeWindow::WebContentsCreated(
|
|||
window->InitFromOptions(options.get());
|
||||
}
|
||||
|
||||
content::JavaScriptDialogManager* NativeWindow::GetJavaScriptDialogManager() {
|
||||
if (!dialog_manager_)
|
||||
dialog_manager_.reset(new AtomJavaScriptDialogManager);
|
||||
|
||||
return dialog_manager_.get();
|
||||
}
|
||||
|
||||
bool NativeWindow::OnMessageReceived(const IPC::Message& message) {
|
||||
bool handled = true;
|
||||
IPC_BEGIN_MESSAGE_MAP(NativeWindow, message)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue