2012-04-03 03:34:16 +02:00
|
|
|
// Copyright (c) 2011 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.
|
|
|
|
|
2015-01-31 01:55:56 +01:00
|
|
|
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_H_
|
|
|
|
#define CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_H_
|
2012-04-03 03:34:16 +02:00
|
|
|
#pragma once
|
|
|
|
|
2012-04-12 22:21:50 +02:00
|
|
|
#include <set>
|
2012-04-03 03:34:16 +02:00
|
|
|
#include <string>
|
2014-07-15 00:18:51 +02:00
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "include/cef_client.h"
|
2014-07-11 22:10:05 +02:00
|
|
|
#include "include/wrapper/cef_helpers.h"
|
2024-03-12 20:47:10 +01:00
|
|
|
#include "tests/cefclient/browser/base_client_handler.h"
|
2016-11-18 00:52:42 +01:00
|
|
|
#include "tests/cefclient/browser/client_types.h"
|
2019-10-18 15:30:53 +02:00
|
|
|
#include "tests/cefclient/browser/test_runner.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2014-05-22 23:01:22 +02:00
|
|
|
#if defined(OS_LINUX)
|
2016-11-18 00:52:42 +01:00
|
|
|
#include "tests/cefclient/browser/dialog_handler_gtk.h"
|
2021-03-30 18:16:51 +02:00
|
|
|
#include "tests/cefclient/browser/print_handler_gtk.h"
|
2014-05-22 23:01:22 +02:00
|
|
|
#endif
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2015-01-23 20:09:34 +01:00
|
|
|
namespace client {
|
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
class ClientDownloadImageCallback;
|
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
// Client handler abstract base class. Provides common functionality shared by
|
|
|
|
// all concrete client handler implementations.
|
2024-03-12 20:47:10 +01:00
|
|
|
class ClientHandler : public BaseClientHandler,
|
2022-03-22 19:31:30 +01:00
|
|
|
public CefCommandHandler,
|
2012-06-11 17:52:49 +02:00
|
|
|
public CefContextMenuHandler,
|
2012-04-03 03:34:16 +02:00
|
|
|
public CefDisplayHandler,
|
2012-06-28 19:21:18 +02:00
|
|
|
public CefDownloadHandler,
|
2013-06-24 17:45:58 +02:00
|
|
|
public CefDragHandler,
|
2017-02-17 00:19:43 +01:00
|
|
|
public CefFocusHandler,
|
2012-06-11 17:52:49 +02:00
|
|
|
public CefKeyboardHandler,
|
|
|
|
public CefLoadHandler,
|
2024-03-12 20:47:10 +01:00
|
|
|
public CefPermissionHandler {
|
2012-04-03 03:34:16 +02:00
|
|
|
public:
|
2015-01-30 19:55:55 +01:00
|
|
|
// Implement this interface to receive notification of ClientHandler
|
2017-02-25 06:03:31 +01:00
|
|
|
// events. The methods of this class will be called on the main thread unless
|
|
|
|
// otherwise indicated.
|
2015-01-30 19:55:55 +01:00
|
|
|
class Delegate {
|
|
|
|
public:
|
|
|
|
// Called when the browser is created.
|
|
|
|
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser) = 0;
|
|
|
|
|
|
|
|
// Called when the browser is closing.
|
|
|
|
virtual void OnBrowserClosing(CefRefPtr<CefBrowser> browser) = 0;
|
|
|
|
|
|
|
|
// Called when the browser has been closed.
|
|
|
|
virtual void OnBrowserClosed(CefRefPtr<CefBrowser> browser) = 0;
|
|
|
|
|
|
|
|
// Set the window URL address.
|
|
|
|
virtual void OnSetAddress(const std::string& url) = 0;
|
|
|
|
|
|
|
|
// Set the window title.
|
|
|
|
virtual void OnSetTitle(const std::string& title) = 0;
|
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
// Set the Favicon image.
|
2017-08-04 00:55:19 +02:00
|
|
|
virtual void OnSetFavicon(CefRefPtr<CefImage> image) {}
|
2016-01-19 21:09:01 +01:00
|
|
|
|
2015-06-05 00:33:24 +02:00
|
|
|
// Set fullscreen mode.
|
|
|
|
virtual void OnSetFullscreen(bool fullscreen) = 0;
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
// Auto-resize contents.
|
|
|
|
virtual void OnAutoResize(const CefSize& new_size) = 0;
|
|
|
|
|
2015-01-30 19:55:55 +01:00
|
|
|
// Set the loading state.
|
|
|
|
virtual void OnSetLoadingState(bool isLoading,
|
|
|
|
bool canGoBack,
|
|
|
|
bool canGoForward) = 0;
|
|
|
|
|
2015-04-24 15:48:32 +02:00
|
|
|
// Set the draggable regions.
|
|
|
|
virtual void OnSetDraggableRegions(
|
|
|
|
const std::vector<CefDraggableRegion>& regions) = 0;
|
|
|
|
|
2017-02-17 00:19:43 +01:00
|
|
|
// Set focus to the next/previous control.
|
|
|
|
virtual void OnTakeFocus(bool next) {}
|
|
|
|
|
2017-02-25 06:03:31 +01:00
|
|
|
// Called on the UI thread before a context menu is displayed.
|
|
|
|
virtual void OnBeforeContextMenu(CefRefPtr<CefMenuModel> model) {}
|
|
|
|
|
2015-01-30 19:55:55 +01:00
|
|
|
protected:
|
2024-01-20 03:22:56 +01:00
|
|
|
virtual ~Delegate() = default;
|
2015-01-30 19:55:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// Constructor may be called on any thread.
|
|
|
|
// |delegate| must outlive this object or DetachDelegate() must be called.
|
|
|
|
ClientHandler(Delegate* delegate,
|
|
|
|
bool is_osr,
|
2022-03-22 19:31:30 +01:00
|
|
|
bool with_controls,
|
2015-01-30 19:55:55 +01:00
|
|
|
const std::string& startup_url);
|
|
|
|
|
|
|
|
// This object may outlive the Delegate object so it's necessary for the
|
|
|
|
// Delegate to detach itself before destruction.
|
|
|
|
void DetachDelegate();
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// CefClient methods
|
2022-03-22 19:31:30 +01:00
|
|
|
CefRefPtr<CefCommandHandler> GetCommandHandler() override { return this; }
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() override {
|
2012-04-03 03:34:16 +02:00
|
|
|
return this;
|
|
|
|
}
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefDisplayHandler> GetDisplayHandler() override { return this; }
|
|
|
|
CefRefPtr<CefDownloadHandler> GetDownloadHandler() override { return this; }
|
|
|
|
CefRefPtr<CefDragHandler> GetDragHandler() override { return this; }
|
|
|
|
CefRefPtr<CefFocusHandler> GetFocusHandler() override { return this; }
|
|
|
|
CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() override { return this; }
|
|
|
|
CefRefPtr<CefLoadHandler> GetLoadHandler() override { return this; }
|
2022-06-30 09:31:18 +02:00
|
|
|
CefRefPtr<CefPermissionHandler> GetPermissionHandler() override {
|
|
|
|
return this;
|
|
|
|
}
|
2015-01-23 00:34:29 +01:00
|
|
|
bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
2019-05-24 22:23:43 +02:00
|
|
|
CefRefPtr<CefFrame> frame,
|
2015-01-23 00:34:29 +01:00
|
|
|
CefProcessId source_process,
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefProcessMessage> message) override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
#if defined(OS_LINUX)
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefDialogHandler> GetDialogHandler() override {
|
2022-06-02 11:49:50 +02:00
|
|
|
return file_dialog_handler_;
|
2015-01-26 20:34:26 +01:00
|
|
|
}
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() override {
|
2022-06-02 11:49:50 +02:00
|
|
|
return js_dialog_handler_;
|
2015-01-26 20:34:26 +01:00
|
|
|
}
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefPrintHandler> GetPrintHandler() override {
|
2021-03-30 18:16:51 +02:00
|
|
|
return print_handler_;
|
|
|
|
}
|
2015-01-26 20:34:26 +01:00
|
|
|
#endif
|
|
|
|
|
2022-03-22 19:31:30 +01:00
|
|
|
// CefCommandHandler methods
|
|
|
|
bool OnChromeCommand(CefRefPtr<CefBrowser> browser,
|
|
|
|
int command_id,
|
|
|
|
cef_window_open_disposition_t disposition) override;
|
2023-03-07 00:21:57 +01:00
|
|
|
bool IsChromeAppMenuItemVisible(CefRefPtr<CefBrowser> browser,
|
|
|
|
int command_id) override;
|
|
|
|
bool IsChromePageActionIconVisible(
|
|
|
|
cef_chrome_page_action_icon_type_t icon_type) override;
|
|
|
|
bool IsChromeToolbarButtonVisible(
|
|
|
|
cef_chrome_toolbar_button_type_t button_type) override;
|
2022-03-22 19:31:30 +01:00
|
|
|
|
2012-06-11 17:52:49 +02:00
|
|
|
// CefContextMenuHandler methods
|
2015-01-23 00:34:29 +01:00
|
|
|
void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefContextMenuParams> params,
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefMenuModel> model) override;
|
2015-01-23 00:34:29 +01:00
|
|
|
bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefContextMenuParams> params,
|
|
|
|
int command_id,
|
2021-06-17 21:43:06 +02:00
|
|
|
EventFlags event_flags) override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// CefDisplayHandler methods
|
2015-01-23 00:34:29 +01:00
|
|
|
void OnAddressChange(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
2021-06-17 21:43:06 +02:00
|
|
|
const CefString& url) override;
|
2015-01-23 00:34:29 +01:00
|
|
|
void OnTitleChange(CefRefPtr<CefBrowser> browser,
|
2021-06-17 21:43:06 +02:00
|
|
|
const CefString& title) override;
|
2016-01-19 21:09:01 +01:00
|
|
|
void OnFaviconURLChange(CefRefPtr<CefBrowser> browser,
|
2021-06-17 21:43:06 +02:00
|
|
|
const std::vector<CefString>& icon_urls) override;
|
2015-06-05 00:33:24 +02:00
|
|
|
void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,
|
2021-06-17 21:43:06 +02:00
|
|
|
bool fullscreen) override;
|
2015-01-23 00:34:29 +01:00
|
|
|
bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
2017-12-18 21:05:38 +01:00
|
|
|
cef_log_severity_t level,
|
2015-01-23 00:34:29 +01:00
|
|
|
const CefString& message,
|
|
|
|
const CefString& source,
|
2021-06-17 21:43:06 +02:00
|
|
|
int line) override;
|
2017-08-04 00:55:19 +02:00
|
|
|
bool OnAutoResize(CefRefPtr<CefBrowser> browser,
|
2021-06-17 21:43:06 +02:00
|
|
|
const CefSize& new_size) override;
|
2020-10-28 17:30:54 +01:00
|
|
|
bool OnCursorChange(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefCursorHandle cursor,
|
|
|
|
cef_cursor_type_t type,
|
2021-06-17 21:43:06 +02:00
|
|
|
const CefCursorInfo& custom_cursor_info) override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-06-28 19:21:18 +02:00
|
|
|
// CefDownloadHandler methods
|
2022-03-22 22:40:28 +01:00
|
|
|
bool CanDownload(CefRefPtr<CefBrowser> browser,
|
|
|
|
const CefString& url,
|
|
|
|
const CefString& request_method) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void OnBeforeDownload(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefDownloadItem> download_item,
|
|
|
|
const CefString& suggested_name,
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefBeforeDownloadCallback> callback) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void OnDownloadUpdated(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefDownloadItem> download_item,
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefDownloadItemCallback> callback) override;
|
2012-06-28 19:21:18 +02:00
|
|
|
|
2013-06-24 17:45:58 +02:00
|
|
|
// CefDragHandler methods
|
2015-01-23 00:34:29 +01:00
|
|
|
bool OnDragEnter(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefDragData> dragData,
|
2021-06-17 21:43:06 +02:00
|
|
|
CefDragHandler::DragOperationsMask mask) override;
|
2015-04-24 15:48:32 +02:00
|
|
|
void OnDraggableRegionsChanged(
|
|
|
|
CefRefPtr<CefBrowser> browser,
|
2019-05-24 22:23:43 +02:00
|
|
|
CefRefPtr<CefFrame> frame,
|
2021-06-17 21:43:06 +02:00
|
|
|
const std::vector<CefDraggableRegion>& regions) override;
|
2015-04-24 15:48:32 +02:00
|
|
|
|
2017-02-17 00:19:43 +01:00
|
|
|
// CefFocusHandler methods
|
2021-06-17 21:43:06 +02:00
|
|
|
void OnTakeFocus(CefRefPtr<CefBrowser> browser, bool next) override;
|
|
|
|
bool OnSetFocus(CefRefPtr<CefBrowser> browser, FocusSource source) override;
|
2017-02-17 00:19:43 +01:00
|
|
|
|
2012-06-11 17:52:49 +02:00
|
|
|
// CefKeyboardHandler methods
|
2015-01-23 00:34:29 +01:00
|
|
|
bool OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
|
|
|
|
const CefKeyEvent& event,
|
|
|
|
CefEventHandle os_event,
|
2021-06-17 21:43:06 +02:00
|
|
|
bool* is_keyboard_shortcut) override;
|
2012-06-11 17:52:49 +02:00
|
|
|
|
|
|
|
// CefLifeSpanHandler methods
|
2015-03-09 21:22:31 +01:00
|
|
|
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,
|
2019-03-19 10:42:54 +01:00
|
|
|
CefRefPtr<CefDictionaryValue>& extra_info,
|
2021-06-17 21:43:06 +02:00
|
|
|
bool* no_javascript_access) override;
|
2023-11-14 18:16:43 +01:00
|
|
|
void OnBeforeDevToolsPopup(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefWindowInfo& windowInfo,
|
|
|
|
CefRefPtr<CefClient>& client,
|
|
|
|
CefBrowserSettings& settings,
|
|
|
|
CefRefPtr<CefDictionaryValue>& extra_info,
|
|
|
|
bool* use_default_window) override;
|
2021-06-17 21:43:06 +02:00
|
|
|
void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
|
|
|
|
bool DoClose(CefRefPtr<CefBrowser> browser) override;
|
|
|
|
void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
|
2012-06-11 17:52:49 +02:00
|
|
|
|
|
|
|
// CefLoadHandler methods
|
2015-01-23 00:34:29 +01:00
|
|
|
void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
|
|
|
bool isLoading,
|
|
|
|
bool canGoBack,
|
2021-06-17 21:43:06 +02:00
|
|
|
bool canGoForward) override;
|
2015-01-23 00:34:29 +01:00
|
|
|
void OnLoadError(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
ErrorCode errorCode,
|
|
|
|
const CefString& errorText,
|
2021-06-17 21:43:06 +02:00
|
|
|
const CefString& failedUrl) override;
|
2012-06-11 17:52:49 +02:00
|
|
|
|
2022-06-30 09:31:18 +02:00
|
|
|
// CefPermissionHandler methods
|
|
|
|
bool OnRequestMediaAccessPermission(
|
|
|
|
CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
2022-07-07 12:01:24 +02:00
|
|
|
const CefString& requesting_origin,
|
2023-06-01 16:06:15 +02:00
|
|
|
uint32_t requested_permissions,
|
2022-06-30 09:31:18 +02:00
|
|
|
CefRefPtr<CefMediaAccessCallback> callback) override;
|
|
|
|
|
2012-06-11 17:52:49 +02:00
|
|
|
// CefRequestHandler methods
|
2015-03-09 21:22:31 +01:00
|
|
|
bool OnOpenURLFromTab(
|
|
|
|
CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
const CefString& target_url,
|
|
|
|
CefRequestHandler::WindowOpenDisposition target_disposition,
|
2021-06-17 21:43:06 +02:00
|
|
|
bool user_gesture) override;
|
2019-04-24 04:50:25 +02:00
|
|
|
CefRefPtr<CefResourceRequestHandler> GetResourceRequestHandler(
|
2015-12-05 03:58:56 +01:00
|
|
|
CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request,
|
2019-04-24 04:50:25 +02:00
|
|
|
bool is_navigation,
|
|
|
|
bool is_download,
|
|
|
|
const CefString& request_initiator,
|
2021-06-17 21:43:06 +02:00
|
|
|
bool& disable_default_handling) override;
|
2019-07-12 22:44:43 +02:00
|
|
|
bool GetAuthCredentials(CefRefPtr<CefBrowser> browser,
|
|
|
|
const CefString& origin_url,
|
|
|
|
bool isProxy,
|
|
|
|
const CefString& host,
|
|
|
|
int port,
|
|
|
|
const CefString& realm,
|
|
|
|
const CefString& scheme,
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefAuthCallback> callback) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
bool OnCertificateError(CefRefPtr<CefBrowser> browser,
|
|
|
|
ErrorCode cert_error,
|
|
|
|
const CefString& request_url,
|
|
|
|
CefRefPtr<CefSSLInfo> ssl_info,
|
2021-09-27 11:09:45 +02:00
|
|
|
CefRefPtr<CefCallback> callback) override;
|
2016-10-27 19:57:12 +02:00
|
|
|
bool OnSelectClientCertificate(
|
|
|
|
CefRefPtr<CefBrowser> browser,
|
|
|
|
bool isProxy,
|
|
|
|
const CefString& host,
|
|
|
|
int port,
|
2016-10-27 21:44:31 +02:00
|
|
|
const X509CertificateList& certificates,
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefSelectClientCertificateCallback> callback) override;
|
2015-01-23 00:34:29 +01:00
|
|
|
void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
2024-03-12 20:47:10 +01:00
|
|
|
TerminationStatus status,
|
|
|
|
int error_code,
|
|
|
|
const CefString& error_string) override;
|
2021-06-17 21:43:06 +02:00
|
|
|
void OnDocumentAvailableInMainFrame(CefRefPtr<CefBrowser> browser) override;
|
2012-04-19 22:31:46 +02:00
|
|
|
|
2019-04-24 04:50:25 +02:00
|
|
|
// CefResourceRequestHandler methods
|
|
|
|
void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request,
|
2021-06-17 21:43:06 +02:00
|
|
|
bool& allow_os_execution) override;
|
2019-04-24 04:50:25 +02:00
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
// Show a new DevTools popup window.
|
2014-10-11 02:12:01 +02:00
|
|
|
void ShowDevTools(CefRefPtr<CefBrowser> browser,
|
|
|
|
const CefPoint& inspect_element_at);
|
2015-01-26 20:34:26 +01:00
|
|
|
|
|
|
|
// Close the existing DevTools popup window, if any.
|
2013-11-08 17:06:06 +01:00
|
|
|
void CloseDevTools(CefRefPtr<CefBrowser> browser);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2016-09-02 12:01:33 +02:00
|
|
|
// Test if the current site has SSL information available.
|
|
|
|
bool HasSSLInformation(CefRefPtr<CefBrowser> browser);
|
|
|
|
|
|
|
|
// Show SSL information for the current site.
|
|
|
|
void ShowSSLInformation(CefRefPtr<CefBrowser> browser);
|
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
// Returns the Delegate.
|
|
|
|
Delegate* delegate() const { return delegate_; }
|
|
|
|
|
2012-06-26 18:47:05 +02:00
|
|
|
// Returns the startup URL.
|
2015-01-26 20:34:26 +01:00
|
|
|
std::string startup_url() const { return startup_url_; }
|
2012-06-26 18:47:05 +02:00
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
// Set/get whether the client should download favicon images. Only safe to
|
|
|
|
// call immediately after client creation or on the browser process UI thread.
|
|
|
|
bool download_favicon_images() const { return download_favicon_images_; }
|
|
|
|
void set_download_favicon_images(bool allow) {
|
|
|
|
download_favicon_images_ = allow;
|
|
|
|
}
|
|
|
|
|
2015-01-30 19:55:55 +01:00
|
|
|
private:
|
2016-01-19 21:09:01 +01:00
|
|
|
friend class ClientDownloadImageCallback;
|
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
// Create a new popup window using the specified information. |is_devtools|
|
2023-11-14 18:16:43 +01:00
|
|
|
// will be true if the window will be used for DevTools. Returns true if a
|
|
|
|
// RootWindow was created for the popup.
|
2017-05-17 11:29:28 +02:00
|
|
|
bool CreatePopupWindow(CefRefPtr<CefBrowser> browser,
|
|
|
|
bool is_devtools,
|
|
|
|
const CefPopupFeatures& popupFeatures,
|
|
|
|
CefWindowInfo& windowInfo,
|
|
|
|
CefRefPtr<CefClient>& client,
|
|
|
|
CefBrowserSettings& settings);
|
2015-01-30 19:55:55 +01:00
|
|
|
|
|
|
|
// Execute Delegate notifications on the main thread.
|
|
|
|
void NotifyBrowserCreated(CefRefPtr<CefBrowser> browser);
|
|
|
|
void NotifyBrowserClosing(CefRefPtr<CefBrowser> browser);
|
|
|
|
void NotifyBrowserClosed(CefRefPtr<CefBrowser> browser);
|
|
|
|
void NotifyAddress(const CefString& url);
|
|
|
|
void NotifyTitle(const CefString& title);
|
2016-01-19 21:09:01 +01:00
|
|
|
void NotifyFavicon(CefRefPtr<CefImage> image);
|
2015-06-05 00:33:24 +02:00
|
|
|
void NotifyFullscreen(bool fullscreen);
|
2017-08-04 00:55:19 +02:00
|
|
|
void NotifyAutoResize(const CefSize& new_size);
|
2017-05-17 11:29:28 +02:00
|
|
|
void NotifyLoadingState(bool isLoading, bool canGoBack, bool canGoForward);
|
|
|
|
void NotifyDraggableRegions(const std::vector<CefDraggableRegion>& regions);
|
2017-02-17 00:19:43 +01:00
|
|
|
void NotifyTakeFocus(bool next);
|
2015-01-26 20:34:26 +01:00
|
|
|
|
2012-04-19 22:31:46 +02:00
|
|
|
// Test context menu creation.
|
2024-03-29 17:48:33 +01:00
|
|
|
void BuildTestMenu(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefMenuModel> model);
|
|
|
|
bool ExecuteTestMenu(CefRefPtr<CefBrowser> browser, int command_id);
|
2012-04-19 22:31:46 +02:00
|
|
|
|
2020-06-13 02:54:08 +02:00
|
|
|
void SetOfflineState(CefRefPtr<CefBrowser> browser, bool offline);
|
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
// THREAD SAFE MEMBERS
|
|
|
|
// The following members may be accessed from any thread.
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
// True if this handler uses off-screen rendering.
|
|
|
|
const bool is_osr_;
|
2013-04-03 21:29:47 +02:00
|
|
|
|
2022-03-22 19:31:30 +01:00
|
|
|
// True if this handler shows controls.
|
|
|
|
const bool with_controls_;
|
|
|
|
|
2015-01-30 19:55:55 +01:00
|
|
|
// The startup URL.
|
|
|
|
const std::string startup_url_;
|
|
|
|
|
2014-07-15 00:18:51 +02:00
|
|
|
// True if mouse cursor change is disabled.
|
|
|
|
bool mouse_cursor_change_disabled_;
|
2015-01-23 21:03:47 +01:00
|
|
|
|
2022-06-30 09:31:18 +02:00
|
|
|
// True if media handling is disabled.
|
|
|
|
bool media_handling_disabled_ = true;
|
|
|
|
|
2020-06-13 02:54:08 +02:00
|
|
|
// True if the browser is currently offline.
|
|
|
|
bool offline_;
|
|
|
|
|
2023-03-07 00:21:57 +01:00
|
|
|
// True if the Chrome toolbar and menu contents/commands should be filtered.
|
|
|
|
bool filter_chrome_commands_;
|
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
// True if Favicon images should be downloaded.
|
2023-01-03 19:53:40 +01:00
|
|
|
bool download_favicon_images_ = false;
|
2016-01-19 21:09:01 +01:00
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
#if defined(OS_LINUX)
|
2022-06-02 11:49:50 +02:00
|
|
|
// Custom dialog handlers for GTK.
|
|
|
|
CefRefPtr<ClientDialogHandlerGtk> file_dialog_handler_;
|
|
|
|
CefRefPtr<ClientDialogHandlerGtk> js_dialog_handler_;
|
2021-03-30 18:16:51 +02:00
|
|
|
CefRefPtr<ClientPrintHandlerGtk> print_handler_;
|
2015-01-26 20:34:26 +01:00
|
|
|
#endif
|
2014-07-15 00:18:51 +02:00
|
|
|
|
2015-01-30 19:55:55 +01:00
|
|
|
// MAIN THREAD MEMBERS
|
|
|
|
// The following members will only be accessed on the main thread. This will
|
|
|
|
// be the same as the CEF UI thread except when using multi-threaded message
|
|
|
|
// loop mode on Windows.
|
|
|
|
|
|
|
|
Delegate* delegate_;
|
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
// UI THREAD MEMBERS
|
2014-07-15 00:18:51 +02:00
|
|
|
// The following members will only be accessed on the CEF UI thread.
|
|
|
|
|
2024-03-29 17:48:33 +01:00
|
|
|
// Track state information for the test context menu.
|
2015-01-26 20:34:26 +01:00
|
|
|
struct TestMenuState {
|
2024-01-20 03:22:56 +01:00
|
|
|
TestMenuState() = default;
|
|
|
|
bool check_item = true;
|
|
|
|
int radio_item = 0;
|
2024-03-29 17:48:33 +01:00
|
|
|
int chrome_theme_mode_item = -1;
|
|
|
|
int chrome_theme_color_item = -1;
|
2015-01-26 20:34:26 +01:00
|
|
|
} test_menu_state_;
|
|
|
|
|
|
|
|
// Console logging state.
|
2015-01-22 22:39:36 +01:00
|
|
|
const std::string console_log_file_;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-06-11 17:52:49 +02:00
|
|
|
// True if an editable field currently has focus.
|
2023-01-03 19:53:40 +01:00
|
|
|
bool focus_on_editable_field_ = false;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2019-02-07 22:36:31 +01:00
|
|
|
// True for the initial navigation after browser creation.
|
2023-01-03 19:53:40 +01:00
|
|
|
bool initial_navigation_ = true;
|
2019-02-07 22:36:31 +01:00
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(ClientHandler);
|
2012-04-03 03:34:16 +02:00
|
|
|
};
|
|
|
|
|
2015-01-23 20:09:34 +01:00
|
|
|
} // namespace client
|
|
|
|
|
2015-01-31 01:55:56 +01:00
|
|
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_H_
|