#ifndef CEF_LIBCEF_BROWSER_VIEWS_OVERLAY_VIEW_HOST_H_
#define CEF_LIBCEF_BROWSER_VIEWS_OVERLAY_VIEW_HOST_H_
#pragma once
#include <memory>
#include "include/views/cef_overlay_controller.h"
#include "include/views/cef_view.h"
#include "base/compiler_specific.h"
#include "ui/views/view_observer.h"
#include "ui/views/widget/widget_delegate.h"
class CefWindowView;
class CefOverlayViewHost : public views::WidgetDelegate,
public views::ViewObserver {
public:
CefOverlayViewHost(CefWindowView* window_view,
cef_docking_mode_t docking_mode);
CefOverlayViewHost(const CefOverlayViewHost&) = delete;
CefOverlayViewHost& operator=(const CefOverlayViewHost&) = delete;
void Init(views::View* host_view, CefRefPtr<CefView> view);
void Destroy();
void MoveIfNecessary();
void SetOverlayBounds(const gfx::Rect& bounds);
void SetOverlayInsets(const CefInsets& insets);
void OnViewBoundsChanged(views::View* observed_view) override;
cef_docking_mode_t docking_mode() const { return docking_mode_; }
CefRefPtr<CefOverlayController> controller() const { return cef_controller_; }
CefWindowView* window_view() const { return window_view_; }
views::Widget* widget() const { return widget_.get(); }
views::View* view() const { return view_; }
gfx::Rect bounds() const { return bounds_; }
CefInsets insets() const { return insets_; }
private:
gfx::Rect ComputeBounds() const;
CefWindowView* const window_view_;
const cef_docking_mode_t docking_mode_;
views::View* view_ = nullptr;
std::unique_ptr<views::Widget> widget_;
CefRefPtr<CefOverlayController> cef_controller_;
gfx::Rect bounds_;
bool bounds_changing_ = false;
CefInsets insets_;
};
#endif