mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
cefclient: views: Add overlay BrowserView demo (see #3790)
Adds new `--show-overlay-browser` command-line flag that creates an overlay containing an Alloy-style BrowserView. The main BrowserView may be Chrome- (default) or Alloy-style (add `--use-alloy-style`). This overlay will only be added to standalone (non-popup) windows. Popups triggered via the overlay will receive standard Alloy-style handling in cefclient (e.g. Views-hosted window). Add `--use-default-popup` for default popup handling.
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#define CEF_TESTS_CEFCLIENT_BROWSER_DEFAULT_CLIENT_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "tests/cefclient/browser/base_client_handler.h"
|
||||
|
||||
namespace client {
|
||||
@@ -14,18 +16,37 @@ namespace client {
|
||||
// style only.
|
||||
class DefaultClientHandler : public BaseClientHandler {
|
||||
public:
|
||||
DefaultClientHandler() = default;
|
||||
// If |use_alloy_style| is nullopt the global default will be used.
|
||||
explicit DefaultClientHandler(
|
||||
std::optional<bool> use_alloy_style = std::nullopt);
|
||||
|
||||
// Returns the DefaultClientHandler for |client|, or nullptr if |client| is
|
||||
// not a DefaultClientHandler.
|
||||
static CefRefPtr<DefaultClientHandler> GetForClient(
|
||||
CefRefPtr<CefClient> client);
|
||||
|
||||
protected:
|
||||
bool OnBeforePopup(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& target_url,
|
||||
const CefString& target_frame_name,
|
||||
CefLifeSpanHandler::WindowOpenDisposition target_disposition,
|
||||
bool user_gesture,
|
||||
const CefPopupFeatures& popupFeatures,
|
||||
CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient>& client,
|
||||
CefBrowserSettings& settings,
|
||||
CefRefPtr<CefDictionaryValue>& extra_info,
|
||||
bool* no_javascript_access) override;
|
||||
|
||||
private:
|
||||
// Used to determine the object type.
|
||||
virtual const void* GetTypeKey() const override { return &kTypeKey; }
|
||||
static constexpr int kTypeKey = 0;
|
||||
|
||||
const bool use_alloy_style_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(DefaultClientHandler);
|
||||
DISALLOW_COPY_AND_ASSIGN(DefaultClientHandler);
|
||||
};
|
||||
|
Reference in New Issue
Block a user