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
|
|
|
|
|
|
|
|
#include "base/callback.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
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
class AlloyBrowserHostImpl;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
class CefJavaScriptDialogRunner {
|
|
|
|
public:
|
2020-03-04 01:29:39 +01:00
|
|
|
typedef base::OnceCallback<void(bool /* success */,
|
2021-04-21 00:52:34 +02:00
|
|
|
const std::u16string& /* user_input */)>
|
2017-05-17 11:29:28 +02:00
|
|
|
DialogClosedCallback;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Run the dialog. Execute |callback| on completion.
|
2020-09-22 21:54:02 +02:00
|
|
|
virtual 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) = 0;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Cancel a dialog mid-flight.
|
|
|
|
virtual void Cancel() = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Allow deletion via scoped_ptr only.
|
2015-12-09 17:10:16 +01:00
|
|
|
friend std::default_delete<CefJavaScriptDialogRunner>;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
CefJavaScriptDialogRunner() {}
|
|
|
|
virtual ~CefJavaScriptDialogRunner() {}
|
|
|
|
|
|
|
|
private:
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefJavaScriptDialogRunner);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_RUNNER_H_
|