mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
alloy: Use Chrome JS dialogs on Windows/Linux (fixes issue #3316)
This commit is contained in:
@ -7,20 +7,21 @@
|
||||
#define CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_MANAGER_H_
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "include/cef_jsdialog_handler.h"
|
||||
#include "libcef/browser/javascript_dialog_runner.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "content/public/browser/javascript_dialog_manager.h"
|
||||
|
||||
class AlloyBrowserHostImpl;
|
||||
class CefBrowserHostBase;
|
||||
|
||||
class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
||||
public:
|
||||
// |runner| may be NULL if the platform doesn't implement dialogs.
|
||||
CefJavaScriptDialogManager(AlloyBrowserHostImpl* browser,
|
||||
std::unique_ptr<CefJavaScriptDialogRunner> runner);
|
||||
explicit CefJavaScriptDialogManager(CefBrowserHostBase* browser);
|
||||
|
||||
CefJavaScriptDialogManager(const CefJavaScriptDialogManager&) = delete;
|
||||
CefJavaScriptDialogManager& operator=(const CefJavaScriptDialogManager&) =
|
||||
@ -43,6 +44,9 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
bool is_reload,
|
||||
DialogClosedCallback callback) override;
|
||||
bool HandleJavaScriptDialog(content::WebContents* web_contents,
|
||||
bool accept,
|
||||
const std::u16string* prompt_override) override;
|
||||
void CancelDialogs(content::WebContents* web_contents,
|
||||
bool reset_state) override;
|
||||
|
||||
@ -52,13 +56,17 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
||||
bool success,
|
||||
const std::u16string& user_input);
|
||||
|
||||
// AlloyBrowserHostImpl pointer is guaranteed to outlive this object.
|
||||
AlloyBrowserHostImpl* browser_;
|
||||
bool InitializeRunner();
|
||||
|
||||
bool CanUseChromeDialogs() const;
|
||||
|
||||
// CefBrowserHostBase pointer is guaranteed to outlive this object.
|
||||
CefBrowserHostBase* const browser_;
|
||||
|
||||
CefRefPtr<CefJSDialogHandler> handler_;
|
||||
|
||||
std::unique_ptr<CefJavaScriptDialogRunner> runner_;
|
||||
|
||||
// True if a dialog is currently running.
|
||||
bool dialog_running_;
|
||||
bool runner_initialized_ = false;
|
||||
|
||||
// Must be the last member.
|
||||
base::WeakPtrFactory<CefJavaScriptDialogManager> weak_ptr_factory_;
|
||||
|
Reference in New Issue
Block a user