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:
|
2017-05-17 11:29:28 +02:00
|
|
|
void Run(CefBrowserHostImpl* browser,
|
|
|
|
content::JavaScriptDialogType message_type,
|
|
|
|
const base::string16& display_url,
|
|
|
|
const base::string16& message_text,
|
|
|
|
const base::string16& default_prompt_text,
|
|
|
|
const DialogClosedCallback& callback) override;
|
2015-11-17 19:20:13 +01:00
|
|
|
void Cancel() override;
|
2012-04-16 23:15:27 +02:00
|
|
|
|
|
|
|
private:
|
2019-02-11 23:22:42 +01:00
|
|
|
void CloseDialog(bool success, const base::string16& user_input);
|
|
|
|
|
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_;
|
2013-12-17 23:04:35 +01:00
|
|
|
base::string16 message_text_;
|
|
|
|
base::string16 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_
|