2019-07-17 20:47:27 +02:00
|
|
|
// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_ALLOY_DIALOGS_ALLOY_WEB_CONTENTS_DIALOG_HELPER_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_ALLOY_DIALOGS_ALLOY_WEB_CONTENTS_DIALOG_HELPER_H_
|
2019-07-17 20:47:27 +02:00
|
|
|
#pragma once
|
|
|
|
|
2023-01-30 18:43:54 +01:00
|
|
|
#include "base/functional/callback_forward.h"
|
2024-05-11 17:48:38 +02:00
|
|
|
#include "base/memory/raw_ptr.h"
|
2019-07-17 20:47:27 +02:00
|
|
|
#include "base/memory/weak_ptr.h"
|
|
|
|
#include "base/observer_list.h"
|
|
|
|
#include "components/web_modal/modal_dialog_host.h"
|
|
|
|
#include "components/web_modal/web_contents_modal_dialog_host.h"
|
|
|
|
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
|
|
|
|
|
|
|
|
class CefBrowserPlatformDelegate;
|
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
class AlloyWebContentsDialogHelper
|
2019-07-17 20:47:27 +02:00
|
|
|
: public web_modal::WebContentsModalDialogManagerDelegate,
|
|
|
|
public web_modal::WebContentsModalDialogHost {
|
|
|
|
public:
|
2022-06-02 11:49:50 +02:00
|
|
|
AlloyWebContentsDialogHelper(content::WebContents* web_contents,
|
|
|
|
CefBrowserPlatformDelegate* browser_delegate);
|
2019-07-17 20:47:27 +02:00
|
|
|
|
|
|
|
base::RepeatingClosure GetBoundsChangedCallback();
|
|
|
|
|
|
|
|
// web_modal::WebContentsModalDialogManagerDelegate methods:
|
|
|
|
bool IsWebContentsVisible(content::WebContents* web_contents) override;
|
|
|
|
web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
|
|
|
|
override;
|
|
|
|
|
|
|
|
// web_modal::WebContentsModalDialogHost methods:
|
|
|
|
gfx::NativeView GetHostView() const override;
|
2023-09-15 21:51:43 +02:00
|
|
|
gfx::AcceleratedWidget GetAcceleratedWidget() const override;
|
2019-07-17 20:47:27 +02:00
|
|
|
gfx::Point GetDialogPosition(const gfx::Size& size) override;
|
|
|
|
gfx::Size GetMaximumDialogSize() override;
|
|
|
|
void AddObserver(web_modal::ModalDialogHostObserver* observer) override;
|
|
|
|
void RemoveObserver(web_modal::ModalDialogHostObserver* observer) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void OnBoundsChanged();
|
|
|
|
|
2024-05-11 17:48:38 +02:00
|
|
|
const raw_ptr<CefBrowserPlatformDelegate> browser_delegate_;
|
2019-07-17 20:47:27 +02:00
|
|
|
|
|
|
|
// Used to notify WebContentsModalDialog.
|
|
|
|
base::ObserverList<web_modal::ModalDialogHostObserver>::Unchecked
|
|
|
|
observer_list_;
|
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
base::WeakPtrFactory<AlloyWebContentsDialogHelper> weak_factory_;
|
2019-07-17 20:47:27 +02:00
|
|
|
};
|
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_ALLOY_DIALOGS_ALLOY_WEB_CONTENTS_DIALOG_HELPER_H_
|