2015-11-17 19:20:13 +01: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.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_RUNNER_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_RUNNER_H_
|
|
|
|
#pragma once
|
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
#include "content/public/browser/javascript_dialog_manager.h"
|
2017-03-03 23:37:23 +01:00
|
|
|
#include "content/public/common/javascript_dialog_type.h"
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
class CefBrowserHostBase;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
class CefJavaScriptDialogRunner {
|
|
|
|
public:
|
2021-12-06 21:40:25 +01:00
|
|
|
CefJavaScriptDialogRunner(const CefJavaScriptDialogRunner&) = delete;
|
|
|
|
CefJavaScriptDialogRunner& operator=(const CefJavaScriptDialogRunner&) =
|
|
|
|
delete;
|
|
|
|
|
|
|
|
using DialogClosedCallback =
|
2022-06-02 11:49:50 +02:00
|
|
|
content::JavaScriptDialogManager::DialogClosedCallback;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Run the dialog. Execute |callback| on completion.
|
2022-06-02 11:49:50 +02:00
|
|
|
virtual void Run(CefBrowserHostBase* browser,
|
2017-05-17 11:29:28 +02:00
|
|
|
content::JavaScriptDialogType message_type,
|
2022-06-02 11:49:50 +02:00
|
|
|
const GURL& origin_url,
|
2021-04-21 00:52:34 +02:00
|
|
|
const std::u16string& message_text,
|
|
|
|
const std::u16string& default_prompt_text,
|
2020-03-04 01:29:39 +01:00
|
|
|
DialogClosedCallback callback) = 0;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
// Dismiss the dialog with the specified results.
|
|
|
|
virtual void Handle(bool accept, const std::u16string* prompt_override) = 0;
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
// Cancel a dialog mid-flight.
|
|
|
|
virtual void Cancel() = 0;
|
|
|
|
|
|
|
|
protected:
|
2021-06-17 22:08:01 +02:00
|
|
|
// Allow deletion via std::unique_ptr only.
|
2015-12-09 17:10:16 +01:00
|
|
|
friend std::default_delete<CefJavaScriptDialogRunner>;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2021-12-06 21:40:25 +01:00
|
|
|
CefJavaScriptDialogRunner() = default;
|
|
|
|
virtual ~CefJavaScriptDialogRunner() = default;
|
2015-11-17 19:20:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_RUNNER_H_
|