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"
|
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
|
2015-01-23 00:34:29 +01:00
|
|
|
CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() OVERRIDE {
|
2012-04-03 03:34:16 +02:00
|
|
|
return this;
|
|
|
|
}
|
2017-05-17 11:29:28 +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,
|
2015-01-23 17:20:52 +01: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)
|
|
|
|
CefRefPtr<CefDialogHandler> GetDialogHandler() OVERRIDE {
|
|
|
|
return dialog_handler_;
|
|
|
|
}
|
|
|
|
CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() OVERRIDE {
|
|
|
|
return dialog_handler_;
|
|
|
|
}
|
|
|
|
#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,
|
|
|
|
CefRefPtr<CefMenuModel> model) OVERRIDE;
|
|
|
|
bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefContextMenuParams> params,
|
|
|
|
int command_id,
|
|
|
|
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,
|
|
|
|
const CefString& url) OVERRIDE;
|
|
|
|
void OnTitleChange(CefRefPtr<CefBrowser> browser,
|
|
|
|
const CefString& title) OVERRIDE;
|
2016-01-19 21:09:01 +01:00
|
|
|
void OnFaviconURLChange(CefRefPtr<CefBrowser> browser,
|
|
|
|
const std::vector<CefString>& icon_urls) OVERRIDE;
|
2015-06-05 00:33:24 +02:00
|
|
|
void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,
|
|
|
|
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,
|
|
|
|
int line) OVERRIDE;
|
2017-08-04 00:55:19 +02:00
|
|
|
bool OnAutoResize(CefRefPtr<CefBrowser> browser,
|
|
|
|
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,
|
|
|
|
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,
|
|
|
|
CefRefPtr<CefBeforeDownloadCallback> callback) OVERRIDE;
|
|
|
|
void OnDownloadUpdated(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefDownloadItem> download_item,
|
|
|
|
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,
|
|
|
|
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,
|
2015-04-24 15:48:32 +02:00
|
|
|
const std::vector<CefDraggableRegion>& regions) OVERRIDE;
|
|
|
|
|
2017-02-17 00:19:43 +01:00
|
|
|
// CefFocusHandler methods
|
|
|
|
void OnTakeFocus(CefRefPtr<CefBrowser> browser, bool next) OVERRIDE;
|
2019-02-07 22:36:31 +01:00
|
|
|
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,
|
|
|
|
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,
|
2015-03-09 21:22:31 +01:00
|
|
|
bool* no_javascript_access) OVERRIDE;
|
2015-01-23 00:34:29 +01: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,
|
|
|
|
bool canGoForward) OVERRIDE;
|
|
|
|
void OnLoadError(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
ErrorCode errorCode,
|
|
|
|
const CefString& errorText,
|
|
|
|
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,
|
2015-01-23 00:34:29 +01: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,
|
|
|
|
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,
|
|
|
|
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,
|
|
|
|
CefRefPtr<CefAuthCallback> callback) OVERRIDE;
|
2015-01-23 00:34:29 +01:00
|
|
|
bool OnQuotaRequest(CefRefPtr<CefBrowser> browser,
|
|
|
|
const CefString& origin_url,
|
|
|
|
int64 new_size,
|
2015-04-02 17:21:46 +02:00
|
|
|
CefRefPtr<CefRequestCallback> 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,
|
|
|
|
CefRefPtr<CefRequestCallback> 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,
|
2016-10-27 19:57:12 +02:00
|
|
|
CefRefPtr<CefSelectClientCertificateCallback> callback) OVERRIDE;
|
2015-01-23 00:34:29 +01:00
|
|
|
void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
|
|
|
TerminationStatus status) OVERRIDE;
|
2020-06-13 02:54:08 +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
|
|
|
|
cef_return_value_t OnBeforeResourceLoad(
|
|
|
|
CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request,
|
|
|
|
CefRefPtr<CefRequestCallback> callback) OVERRIDE;
|
|
|
|
CefRefPtr<CefResourceHandler> GetResourceHandler(
|
|
|
|
CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request) OVERRIDE;
|
|
|
|
CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
|
|
|
|
CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request,
|
|
|
|
CefRefPtr<CefResponse> response) OVERRIDE;
|
|
|
|
void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request,
|
|
|
|
bool& allow_os_execution) OVERRIDE;
|
|
|
|
|
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_;
|
|
|
|
#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_
|