2012-04-16 23:15:27 +02:00
|
|
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_NATIVE_JAVASCRIPT_DIALOG_RUNNER_WIN_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_NATIVE_JAVASCRIPT_DIALOG_RUNNER_WIN_H_
|
2012-04-16 23:15:27 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-02-15 01:12:09 +01:00
|
|
|
#include <windows.h>
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
#include "libcef/browser/javascript_dialog_runner.h"
|
2012-04-16 23:15:27 +02:00
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner {
|
2012-04-16 23:15:27 +02:00
|
|
|
public:
|
2015-11-17 19:20:13 +01:00
|
|
|
CefJavaScriptDialogRunnerWin();
|
|
|
|
~CefJavaScriptDialogRunnerWin() override;
|
|
|
|
|
|
|
|
// CefJavaScriptDialogRunner methods:
|
2020-09-22 21:54:02 +02:00
|
|
|
void Run(AlloyBrowserHostImpl* browser,
|
2017-05-17 11:29:28 +02:00
|
|
|
content::JavaScriptDialogType message_type,
|
2021-04-21 00:52:34 +02:00
|
|
|
const std::u16string& display_url,
|
|
|
|
const std::u16string& message_text,
|
|
|
|
const std::u16string& default_prompt_text,
|
2020-03-04 01:29:39 +01:00
|
|
|
DialogClosedCallback callback) override;
|
2015-11-17 19:20:13 +01:00
|
|
|
void Cancel() override;
|
2012-04-16 23:15:27 +02:00
|
|
|
|
|
|
|
private:
|
2021-04-21 00:52:34 +02:00
|
|
|
void CloseDialog(bool success, const std::wstring& user_input);
|
2019-02-11 23:22:42 +01:00
|
|
|
|
2012-04-16 23:15:27 +02:00
|
|
|
HWND dialog_win_;
|
|
|
|
HWND parent_win_;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2017-03-03 23:37:23 +01:00
|
|
|
content::JavaScriptDialogType message_type_;
|
2021-04-21 00:52:34 +02:00
|
|
|
std::wstring message_text_;
|
|
|
|
std::wstring default_prompt_text_;
|
2015-11-17 19:20:13 +01:00
|
|
|
DialogClosedCallback callback_;
|
|
|
|
|
|
|
|
bool hook_installed_;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
static INT_PTR CALLBACK DialogProc(HWND dialog,
|
|
|
|
UINT message,
|
|
|
|
WPARAM wparam,
|
2012-04-16 23:15:27 +02:00
|
|
|
LPARAM lparam);
|
|
|
|
|
|
|
|
// Since the message loop we expect to run in isn't going to be nicely
|
|
|
|
// calling IsDialogMessage(), we need to hook the wnd proc and call it
|
|
|
|
// ourselves. See http://support.microsoft.com/kb/q187988/
|
|
|
|
static bool InstallMessageHook();
|
|
|
|
static bool UninstallMessageHook();
|
|
|
|
static LRESULT CALLBACK GetMsgProc(int code, WPARAM wparam, LPARAM lparam);
|
|
|
|
static HHOOK msg_hook_;
|
2012-05-29 20:06:22 +02:00
|
|
|
static int msg_hook_user_count_;
|
2012-04-16 23:15:27 +02:00
|
|
|
};
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_NATIVE_JAVASCRIPT_DIALOG_RUNNER_WIN_H_
|