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"
|
|
|
|
#include "base/strings/string16.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
|
|
|
|
|
|
|
class CefBrowserHostImpl;
|
|
|
|
|
|
|
|
class CefJavaScriptDialogRunner {
|
|
|
|
public:
|
|
|
|
typedef base::Callback<void(bool /* success */,
|
|
|
|
const base::string16& /* 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.
|
2017-05-17 11:29:28 +02:00
|
|
|
virtual 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) = 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_
|