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.
|
|
|
|
|
2013-02-23 01:43:28 +01:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_MANAGER_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_MANAGER_H_
|
2012-04-16 23:15:27 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#include "base/memory/scoped_ptr.h"
|
2013-02-23 01:43:28 +01:00
|
|
|
#include "content/public/browser/javascript_dialog_manager.h"
|
2012-04-16 23:15:27 +02:00
|
|
|
|
|
|
|
class CefBrowserHostImpl;
|
|
|
|
class CefJavaScriptDialog;
|
|
|
|
|
2013-02-23 01:43:28 +01:00
|
|
|
class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
2012-04-16 23:15:27 +02:00
|
|
|
public:
|
2013-02-23 01:43:28 +01:00
|
|
|
explicit CefJavaScriptDialogManager(CefBrowserHostImpl* browser);
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefJavaScriptDialogManager() override;
|
2012-04-16 23:15:27 +02:00
|
|
|
|
2013-02-23 01:43:28 +01:00
|
|
|
// JavaScriptDialogManager methods.
|
2014-11-12 20:25:15 +01:00
|
|
|
void RunJavaScriptDialog(
|
2012-04-16 23:15:27 +02:00
|
|
|
content::WebContents* web_contents,
|
|
|
|
const GURL& origin_url,
|
|
|
|
const std::string& accept_lang,
|
2012-05-31 17:19:33 +02:00
|
|
|
content::JavaScriptMessageType message_type,
|
2013-12-17 23:04:35 +01:00
|
|
|
const base::string16& message_text,
|
|
|
|
const base::string16& default_prompt_text,
|
2012-04-16 23:15:27 +02:00
|
|
|
const DialogClosedCallback& callback,
|
2014-11-12 20:25:15 +01:00
|
|
|
bool* did_suppress_message) override;
|
2012-04-16 23:15:27 +02:00
|
|
|
|
2014-11-12 20:25:15 +01:00
|
|
|
void RunBeforeUnloadDialog(
|
2012-04-16 23:15:27 +02:00
|
|
|
content::WebContents* web_contents,
|
2013-12-17 23:04:35 +01:00
|
|
|
const base::string16& message_text,
|
2012-04-16 23:15:27 +02:00
|
|
|
bool is_reload,
|
2014-11-12 20:25:15 +01:00
|
|
|
const DialogClosedCallback& callback) override;
|
2012-04-16 23:15:27 +02:00
|
|
|
|
2014-11-12 20:25:15 +01:00
|
|
|
void CancelActiveAndPendingDialogs(
|
|
|
|
content::WebContents* web_contents) override;
|
2013-08-15 21:38:55 +02:00
|
|
|
|
2014-11-12 20:25:15 +01:00
|
|
|
void WebContentsDestroyed(
|
|
|
|
content::WebContents* web_contents) override;
|
2012-04-16 23:15:27 +02:00
|
|
|
|
|
|
|
// Called by the CefJavaScriptDialog when it closes.
|
|
|
|
void DialogClosed(CefJavaScriptDialog* dialog);
|
|
|
|
|
|
|
|
CefBrowserHostImpl* browser() const { return browser_; }
|
|
|
|
|
|
|
|
private:
|
2013-02-23 01:43:28 +01:00
|
|
|
// This pointer is guaranteed to outlive the CefJavaScriptDialogManager.
|
2012-04-16 23:15:27 +02:00
|
|
|
CefBrowserHostImpl* browser_;
|
|
|
|
|
2012-08-04 02:59:58 +02:00
|
|
|
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK)
|
2012-04-16 23:15:27 +02:00
|
|
|
// The dialog being shown. No queueing.
|
|
|
|
scoped_ptr<CefJavaScriptDialog> dialog_;
|
|
|
|
#endif
|
|
|
|
|
2013-02-23 01:43:28 +01:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefJavaScriptDialogManager);
|
2012-04-16 23:15:27 +02:00
|
|
|
};
|
|
|
|
|
2013-02-23 01:43:28 +01:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_MANAGER_H_
|