views: Add support for absolute positioned overlay views.

To test:
Run `cefclient.exe --use-views --hide-frame --hide-controls`
Add `--enable-chrome-runtime` for the same behavior using the Chrome location
bar instead of a text field.
This commit is contained in:
Marshall Greenblatt
2021-08-27 21:55:15 -04:00
parent 6f6072b857
commit 4a44e16a09
96 changed files with 3875 additions and 230 deletions

View File

@ -18,12 +18,14 @@
#include "include/views/cef_label_button.h"
#include "include/views/cef_menu_button.h"
#include "include/views/cef_menu_button_delegate.h"
#include "include/views/cef_overlay_controller.h"
#include "include/views/cef_textfield.h"
#include "include/views/cef_textfield_delegate.h"
#include "include/views/cef_window.h"
#include "include/views/cef_window_delegate.h"
#include "tests/cefclient/browser/image_cache.h"
#include "tests/cefclient/browser/views_menu_bar.h"
#include "tests/cefclient/browser/views_overlay_controls.h"
namespace client {
@ -167,6 +169,8 @@ class ViewsWindow : public CefBrowserViewDelegate,
void OnFocus(CefRefPtr<CefView> view) override;
void OnBlur(CefRefPtr<CefView> view) override;
void OnWindowChanged(CefRefPtr<CefView> view, bool added) override;
void OnLayoutChanged(CefRefPtr<CefView> view,
const CefRect& new_bounds) override;
// ViewsMenuBar::Delegate methods:
void MenuBarExecuteCommand(CefRefPtr<CefMenuModel> menu_model,
@ -185,8 +189,13 @@ class ViewsWindow : public CefBrowserViewDelegate,
void CreateMenuModel();
CefRefPtr<CefLabelButton> CreateBrowseButton(const std::string& label,
int id);
CefRefPtr<CefMenuButton> CreateMenuButton();
CefRefPtr<CefView> CreateLocationBar();
// Add controls to the Window.
// Add the BrowserView to the Window.
void AddBrowserView();
// Add other controls to the Window.
void AddControls();
// Add keyboard accelerators to the Window.
@ -214,18 +223,22 @@ class ViewsWindow : public CefBrowserViewDelegate,
CefRefPtr<CefBrowserView> browser_view_;
bool frameless_;
bool with_controls_;
bool with_overlay_controls_;
ChromeToolbarType chrome_toolbar_type_;
CefRefPtr<CefWindow> window_;
CefRefPtr<CefMenuModel> button_menu_model_;
CefRefPtr<ViewsMenuBar> top_menu_bar_;
CefRefPtr<CefView> top_toolbar_;
CefRefPtr<CefView> location_;
CefRefPtr<CefMenuButton> menu_button_;
CefRefPtr<CefView> location_bar_;
bool menu_has_focus_;
int last_focused_view_;
CefSize minimum_window_size_;
CefRefPtr<ViewsOverlayControls> overlay_controls_;
// Structure representing an extension.
struct ExtensionInfo {
ExtensionInfo(CefRefPtr<CefExtension> extension, CefRefPtr<CefImage> image)