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"
|
2014-01-28 00:31:03 +01:00
|
|
|
#include "include/wrapper/cef_message_router.h"
|
2015-05-23 03:57:31 +02:00
|
|
|
#include "include/wrapper/cef_resource_manager.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.
|
2012-04-03 03:34:16 +02:00
|
|
|
class ClientHandler : public CefClient,
|
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 CefLifeSpanHandler,
|
|
|
|
public CefLoadHandler,
|
2019-04-24 04:50:25 +02:00
|
|
|
public CefRequestHandler,
|
|
|
|
public CefResourceRequestHandler {
|
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:
|
|
|
|
virtual ~Delegate() {}
|
|
|
|
};
|
|
|
|
|
2014-01-28 00:31:03 +01:00
|
|
|
typedef std::set<CefMessageRouterBrowserSide::Handler*> MessageHandlerSet;
|
|
|
|
|
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,
|
|
|
|
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
|
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<CefLifeSpanHandler> GetLifeSpanHandler() override { return this; }
|
|
|
|
CefRefPtr<CefLoadHandler> GetLoadHandler() override { return this; }
|
|
|
|
CefRefPtr<CefRequestHandler> GetRequestHandler() 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 {
|
2015-01-26 20:34:26 +01:00
|
|
|
return dialog_handler_;
|
|
|
|
}
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() override {
|
2015-01-26 20:34:26 +01:00
|
|
|
return dialog_handler_;
|
|
|
|
}
|
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
|
|
|
|
|
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
|
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;
|
|
|
|
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
|
|
|
|
|
|
|
// CefRequestHandler methods
|
2015-01-23 00:34:29 +01:00
|
|
|
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request,
|
2018-04-27 17:11:53 +02:00
|
|
|
bool user_gesture,
|
2021-06-17 21:43:06 +02:00
|
|
|
bool is_redirect) override;
|
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;
|
2015-01-23 00:34:29 +01:00
|
|
|
bool OnQuotaRequest(CefRefPtr<CefBrowser> browser,
|
|
|
|
const CefString& origin_url,
|
|
|
|
int64 new_size,
|
2021-09-27 11:09:45 +02:00
|
|
|
CefRefPtr<CefCallback> 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,
|
2021-06-17 21:43:06 +02:00
|
|
|
TerminationStatus status) override;
|
|
|
|
void OnDocumentAvailableInMainFrame(CefRefPtr<CefBrowser> browser) override;
|
2012-04-19 22:31:46 +02:00
|
|
|
|
2019-04-24 04:50:25 +02:00
|
|
|
// CefResourceRequestHandler methods
|
|
|
|
cef_return_value_t OnBeforeResourceLoad(
|
|
|
|
CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request,
|
2021-09-27 11:09:45 +02:00
|
|
|
CefRefPtr<CefCallback> callback) override;
|
2019-04-24 04:50:25 +02:00
|
|
|
CefRefPtr<CefResourceHandler> GetResourceHandler(
|
|
|
|
CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefRequest> request) override;
|
2019-04-24 04:50:25 +02:00
|
|
|
CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
|
|
|
|
CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request,
|
2021-06-17 21:43:06 +02:00
|
|
|
CefRefPtr<CefResponse> response) override;
|
2019-04-24 04:50:25 +02:00
|
|
|
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
|
|
|
// Returns the number of browsers currently using this handler. Can only be
|
|
|
|
// called on the CEF UI thread.
|
|
|
|
int GetBrowserCount() const;
|
2013-03-19 23:59:33 +01: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);
|
|
|
|
|
2019-10-18 15:30:53 +02:00
|
|
|
// Set a string resource for loading via StringResourceProvider.
|
|
|
|
void SetStringResource(const std::string& page, const std::string& data);
|
|
|
|
|
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
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
// Returns true if this handler uses off-screen rendering.
|
|
|
|
bool is_osr() const { return is_osr_; }
|
2012-10-18 00:45:49 +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|
|
|
|
|
// will be true if the window will be used for DevTools. Return true to
|
|
|
|
// proceed with popup browser creation or false to cancel the popup browser.
|
|
|
|
// May be called on any thead.
|
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.
|
|
|
|
void BuildTestMenu(CefRefPtr<CefMenuModel> model);
|
|
|
|
bool ExecuteTestMenu(int command_id);
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
2020-06-13 02:54:08 +02:00
|
|
|
// True if the browser is currently offline.
|
|
|
|
bool offline_;
|
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
// True if Favicon images should be downloaded.
|
|
|
|
bool download_favicon_images_;
|
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
#if defined(OS_LINUX)
|
|
|
|
// Custom dialog handler for GTK.
|
|
|
|
CefRefPtr<ClientDialogHandlerGtk> 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-26 20:34:26 +01:00
|
|
|
// Handles the browser side of query routing. The renderer side is handled
|
|
|
|
// in client_renderer.cc.
|
|
|
|
CefRefPtr<CefMessageRouterBrowserSide> message_router_;
|
2015-04-24 15:48:32 +02:00
|
|
|
|
2015-05-23 03:57:31 +02:00
|
|
|
// Manages the registration and delivery of resources.
|
|
|
|
CefRefPtr<CefResourceManager> resource_manager_;
|
|
|
|
|
2019-10-18 15:30:53 +02:00
|
|
|
// Used to manage string resources in combination with StringResourceProvider.
|
|
|
|
// Only accessed on the IO thread.
|
|
|
|
test_runner::StringResourceMap string_resource_map_;
|
|
|
|
|
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.
|
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
// Track state information for the text context menu.
|
|
|
|
struct TestMenuState {
|
|
|
|
TestMenuState() : check_item(true), radio_item(0) {}
|
|
|
|
bool check_item;
|
|
|
|
int radio_item;
|
|
|
|
} test_menu_state_;
|
|
|
|
|
|
|
|
// The current number of browsers using this handler.
|
|
|
|
int browser_count_;
|
2014-07-15 00:18:51 +02:00
|
|
|
|
2015-01-26 20:34:26 +01:00
|
|
|
// Console logging state.
|
2015-01-22 22:39:36 +01:00
|
|
|
const std::string console_log_file_;
|
|
|
|
bool first_console_message_;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-06-11 17:52:49 +02:00
|
|
|
// True if an editable field currently has focus.
|
2014-07-11 22:28:37 +02:00
|
|
|
bool focus_on_editable_field_;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2019-02-07 22:36:31 +01:00
|
|
|
// True for the initial navigation after browser creation.
|
|
|
|
bool initial_navigation_;
|
|
|
|
|
2014-01-28 00:31:03 +01:00
|
|
|
// Set of Handlers registered with the message router.
|
|
|
|
MessageHandlerSet message_handler_set_;
|
|
|
|
|
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_
|