Commit 3906d631 authored by Rye Mutt's avatar Rye Mutt 🍞

Merge

parents 1dc7dd7d b41c3f12
......@@ -20,9 +20,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>9201b6d7d353b53e00bbe2890ab1bcaf</string>
<string>d020431ecf2dcefcb2e92c50de0dfc05</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/33596/278387/cef_bin-3.3626.1895.g7001d56.525100-darwin64-525100.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/39564/336519/cef_bin-75.0.11_gf50b3c2_chromium-75.0.3770.100.528486-darwin64-528486.tar.bz2</string>
</map>
<key>name</key>
<string>darwin64</string>
......@@ -32,9 +32,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>ac07c0db9b1dc9cba704f9d8115afff5</string>
<string>4adeeeecc86890785e514595a3f96915</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/33597/278395/cef_bin-3.3626.1895.g7001d56.525100-windows-525100.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/39566/336587/cef_bin-75.0.11_gf50b3c2_chromium-75.0.3770.100.528486-windows-528486.tar.bz2</string>
</map>
<key>name</key>
<string>windows</string>
......@@ -44,18 +44,16 @@
<key>archive</key>
<map>
<key>hash</key>
<string>fee7dfbc9721564f18ebc1499dbc627c</string>
<key>hash_algorithm</key>
<string>md5</string>
<string>fc3290285aecedbcdc4953a2b20fe521</string>
<key>url</key>
<string>http://depot.alchemyviewer.org/pub/packages/cef-builds/cef_bin-73.1.12-gee4b49f-chromium-73.0.3683.75.190871532-windows64-190871532.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/39565/336588/cef_bin-75.0.11_gf50b3c2_chromium-75.0.3770.100.528486-windows64-528486.tar.bz2</string>
</map>
<key>name</key>
<string>windows64</string>
</map>
</map>
<key>version</key>
<string>73.1.12+gee4b49f+chromium-73.0.3683.75.190871532</string>
<string>3.3626.1895.g7001d56.525100</string>
</map>
</map>
<key>package_description</key>
......
# OS files
.DS_Store
.DS_Store?
# Build/output folders
build/
build64/
glob:*.wwdb
# misc files
dullahan.sdf
dullahan.v12.suo
dullahan.opensdf
# dullahan header - autogenerated from dullahan.h.in
src/dullahan_version.h
# test apps crud
examples/console/cookies/Cookies-journal
examples/console/cookies/Cookies
examples/console/output.bmp
examples/webcube/cookies/Cookies-journal
examples/webcube/cookies/Cookies
examples/webcube/cache/*
examples/webcube/dullahan_test_urls.html
examples/webcube/*.pdf
examples/simplegl/cookies/Cookies-journal
examples/simplegl/cookies/Cookies
examples/simplegl/cache/*
examples/simplegl/dullahan_test_urls.html
# Astyle crud
glob:*.orig
# Windows RC crud
glob:*.aps
......@@ -99,8 +99,6 @@ add_library(
src/dullahan_browser_client.h
src/dullahan_callback_manager.cpp
src/dullahan_callback_manager.h
src/dullahan_context_handler.cpp
src/dullahan_context_handler.h
src/dullahan_debug.h
src/dullahan_impl.cpp
src/dullahan_impl.h
......@@ -126,16 +124,27 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
endif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
################################################################################
## parse CEF version header and process into dullahan header
FILE(STRINGS ${CEF_INCLUDE_DIR}/cef_version.h CEF_VERSION_STR REGEX "\#define CEF_VERSION ")
FILE(STRINGS ${CEF_INCLUDE_DIR}/cef_version.h CHROME_VERSION_MAJOR_STR REGEX "\#define CHROME_VERSION_MAJOR ")
FILE(STRINGS ${CEF_INCLUDE_DIR}/cef_version.h CHROME_VERSION_MINOR_STR REGEX "\#define CHROME_VERSION_MINOR ")
FILE(STRINGS ${CEF_INCLUDE_DIR}/cef_version.h CHROME_VERSION_BUILD_STR REGEX "\#define CHROME_VERSION_BUILD ")
FILE(STRINGS ${CEF_INCLUDE_DIR}/cef_version.h CHROME_VERSION_PATCH_STR REGEX "\#define CHROME_VERSION_PATCH ")
CONFIGURE_FILE (
"${PROJECT_SOURCE_DIR}/src/dullahan_version.h.in"
"${PROJECT_SOURCE_DIR}/src/dullahan_version.h"
)
## Parse CEF version header and process into dullahan header.
## Only do this if it's a clean build (try to keep version/build number
## the same for the same set of source files)
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/src/dullahan_version.h")
# Extract CEF/Chrome version info from CEF header
FILE(STRINGS ${CEF_INCLUDE_DIR}/cef_version.h CEF_VERSION_STR REGEX "\#define CEF_VERSION ")
FILE(STRINGS ${CEF_INCLUDE_DIR}/cef_version.h CHROME_VERSION_MAJOR_STR REGEX "\#define CHROME_VERSION_MAJOR ")
FILE(STRINGS ${CEF_INCLUDE_DIR}/cef_version.h CHROME_VERSION_MINOR_STR REGEX "\#define CHROME_VERSION_MINOR ")
FILE(STRINGS ${CEF_INCLUDE_DIR}/cef_version.h CHROME_VERSION_BUILD_STR REGEX "\#define CHROME_VERSION_BUILD ")
FILE(STRINGS ${CEF_INCLUDE_DIR}/cef_version.h CHROME_VERSION_PATCH_STR REGEX "\#define CHROME_VERSION_PATCH ")
# Create a build number based on the actual build date/time
string(TIMESTAMP BUILDNUMBER "#define DULLAHAN_VERSION_BUILD %Y%m%d%H%M")
# Parse the version input file into the Dullahan version header
CONFIGURE_FILE (
"${PROJECT_SOURCE_DIR}/src/dullahan_version.h.in"
"${PROJECT_SOURCE_DIR}/src/dullahan_version.h"
)
endif ()
################################################################################
## dullahan host executable
......@@ -194,6 +203,12 @@ endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(dullahan_host PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
set_target_properties(dullahan_host PROPERTIES LINK_FLAGS "/ignore:4099")
add_custom_command(
TARGET dullahan_host POST_BUILD
COMMAND "mt.exe" -manifest \"$(ProjectDir)..\\src\\win\\compatibility.manifest\" -outputresource:"$(TargetDir)$(TargetFileName)"\;\#1
COMMENT "Adding custom manifest...")
endif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Windows commands to copy CEF 'bin', 'resources' folders to executable dir (needed at runtime)
......@@ -265,6 +280,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
endif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
endif()
add_custom_command(
TARGET webcube POST_BUILD
COMMAND "mt.exe" -manifest \"$(ProjectDir)..\\src\\win\\compatibility.manifest\" -outputresource:"$(TargetDir)$(TargetFileName)"\;\#1
COMMENT "Adding custom manifest...")
################################################################################
## simplegl example application using FreeGLUT
......@@ -313,6 +333,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(simplegl PROPERTIES LINK_FLAGS "/ignore:4099")
endif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_custom_command(
TARGET simplegl POST_BUILD
COMMAND "mt.exe" -manifest \"$(ProjectDir)..\\src\\win\\compatibility.manifest\" -outputresource:"$(TargetDir)$(TargetFileName)"\;\#1
COMMENT "Adding custom manifest...")
################################################################################
## console example application
......@@ -342,6 +367,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(console PROPERTIES LINK_FLAGS "/ignore:4099")
endif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_custom_command(
TARGET console POST_BUILD
COMMAND "mt.exe" -manifest \"$(ProjectDir)..\\src\\win\\compatibility.manifest\" -outputresource:"$(TargetDir)$(TargetFileName)"\;\#1
COMMENT "Adding custom manifest...")
################################################################################
## minimal CEF console example (doesn't use Dullahan)
......@@ -374,6 +404,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(cef_minimal PROPERTIES LINK_FLAGS "/ignore:4099")
endif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_custom_command(
TARGET cef_minimal POST_BUILD
COMMAND "mt.exe" -manifest \"$(ProjectDir)..\\src\\win\\compatibility.manifest\" -outputresource:"$(TargetDir)$(TargetFileName)"\;\#1
COMMENT "Adding custom manifest...")
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
################################################################################
......@@ -421,7 +456,6 @@ endif()
################################################################################
# generic commands that have to go after everything else
###### set only a Release configuration
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES "Release")
endif()
......@@ -222,7 +222,6 @@ int main(int argc, char* argv[])
settings.background_color = 0x80ffffff;
settings.cache_enabled = true;
settings.cache_path = ".\\cache";
settings.cookie_store_path = ".\\cookies";
settings.cookies_enabled = true;
settings.disable_gpu = false;
settings.disable_web_security = false;
......
......@@ -69,6 +69,7 @@ app::app()
mTextureWidth = 1024;
mTextureHeight = 1024;
mAllFinished = false;
// empty string means go load the page of test URLs
// may be overridden by command line arg --homepage="URL"
......@@ -113,6 +114,8 @@ void app::init_dullahan()
mDullahan->setOnRequestExitCallback(std::bind(&app::onRequestExitCallback, this));
mDullahan->setOnStatusMessageCallback(std::bind(&app::onStatusMessage, this, std::placeholders::_1));
mDullahan->setOnTitleChangeCallback(std::bind(&app::onTitleChange, this, std::placeholders::_1));
mDullahan->setOnJSDialogCallback(std::bind(&app::onJSDialogCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
mDullahan->setOnTooltipCallback(std::bind(&app::onTooltip, this, std::placeholders::_1));
std::vector<std::string> custom_schemes(1, "secondlife");
mDullahan->setCustomSchemes(custom_schemes);
......@@ -123,7 +126,6 @@ void app::init_dullahan()
settings.cache_enabled = true;
settings.user_data_path = ".\\webcube_user_data";
settings.cache_path = ".\\webcube_cache";
settings.cookie_store_path = ".\\webcube_cookies";
settings.cookies_enabled = true;
settings.disable_gpu = false;
settings.disable_web_security = false;
......@@ -788,6 +790,19 @@ void app::onPageChangedCallback(const unsigned char* pixels, int x, int y,
}
}
/////////////////////////////////////////////////////////////////////////////////
//
bool app::onJSDialogCallback(const std::string origin_url, const std::string message_text, const std::string default_prompt_text)
{
std::cout << "JavaScript dialog triggered:" << std::endl;
std::cout << " URL: " << origin_url << std::endl;
std::cout << " message: " << message_text << std::endl;
std::cout << " prompt: " << default_prompt_text << std::endl;
// cancel the dialog automatically
return true;
}
/////////////////////////////////////////////////////////////////////////////////
//
void app::onPdfPrintFinished(const std::string path, bool ok)
......@@ -807,6 +822,11 @@ void app::onPdfPrintFinished(const std::string path, bool ok)
//
void app::onRequestExitCallback()
{
mAllFinished = true;
// posted a quit message no longer works as of CEF 74. Not sure why - I
// think it swallows the message before the app (like this one) gets to
// see it. Now we need to use an explicit flag
PostQuitMessage(0);
}
......@@ -824,6 +844,13 @@ void app::onTitleChange(const std::string title)
std::cout << "onTitleChange: " << title << std::endl;
}
/////////////////////////////////////////////////////////////////////////////////
//
void app::onTooltip(const std::string tooltip)
{
std::cout << "onTooltip: " << tooltip << std::endl;
}
/////////////////////////////////////////////////////////////////////////////////
//
void app::on_left_mouse_down(int x, int y, int face)
......@@ -848,9 +875,9 @@ void app::on_mouse_move(int x, int y, int face, bool left_button_down)
/////////////////////////////////////////////////////////////////////////////////
//
void app::on_mouse_wheel(int delta_x, int delta_y)
void app::on_mouse_wheel(int x, int y, int delta_x, int delta_y)
{
mDullahan->mouseWheel(delta_x, delta_y);
mDullahan->mouseWheel(x, y, delta_x, delta_y);
}
/////////////////////////////////////////////////////////////////////////////////
......@@ -1096,9 +1123,18 @@ LRESULT CALLBACK window_proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
else
{
// location of mouse cursor when wheel was moved
int mouse_x = LOWORD(lParam);
int mouse_y = HIWORD(lParam);
// use the mouse position to get the position on a face in texture
int texture_x, texture_y, texture_face;
gApp->windowPosToTexturePos(mouse_x, mouse_y, texture_x, texture_y, texture_face);
// synthesize a virtual mouse wheel event (clamp X delta for now)
int delta_x = 0;
int delta_y = GET_WHEEL_DELTA_WPARAM(wParam);
gApp->on_mouse_wheel(delta_x, delta_y);
gApp->on_mouse_wheel(texture_x, texture_y, delta_x, delta_y);
}
return 0;
};
......@@ -1156,6 +1192,13 @@ void app::closeConsole()
FreeConsole();
}
/////////////////////////////////////////////////////////////////////////////////
//
bool app::isAllFinished()
{
return mAllFinished;
}
/////////////////////////////////////////////////////////////////////////////////
//
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
......@@ -1258,7 +1301,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
SwapBuffers(hDC);
}
}
while (msg.message != WM_QUIT);
while (gApp->isAllFinished() == false);
wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(hRC);
......
......@@ -91,7 +91,7 @@ class app
void on_left_mouse_down(int x, int y, int face);
void on_left_mouse_up(int x, int y, int face);
void on_mouse_move(int x, int y, int face, bool left_button_down);
void on_mouse_wheel(int delta_x, int delta_y);
void on_mouse_wheel(int x, int y, int delta_x, int delta_y);
void native_keyboard_event(uint32_t msg, uint64_t wparam, uint64_t lparam);
public:
......@@ -119,6 +119,7 @@ class app
const std::string get_title();
void set_homepage_url(std::string url);
bool isAllFinished();
private:
FILE* mConsole;
......@@ -135,6 +136,7 @@ class app
std::string mHomePageURL;
dullahan* mDullahan;
const std::string getHomePageURL();
bool mAllFinished;
void init_dullahan();
......@@ -145,6 +147,7 @@ class app
const std::vector<std::string> onFileDialog(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, const std::string dialog_accept_filter, bool& use_default);
void onFileDownloadProgress(int percent, bool complete);
bool onHTTPAuth(const std::string host, const std::string realm, bool isproxy, std::string& username, std::string& password);
bool onJSDialogCallback(const std::string origin_url, const std::string message_text, const std::string default_prompt_text);
void onLoadEnd(int status, const std::string url);
void onLoadError(int status, const std::string error_text);
void onLoadStart();
......@@ -154,6 +157,7 @@ class app
void onRequestExitCallback();
void onStatusMessage(const std::string message);
void onTitleChange(const std::string title);
void onTooltip(const std::string title);
};
#endif // _WEBCUBE_EXAMPLE
......@@ -152,9 +152,9 @@ void dullahan::mouseButton(EMouseButton mouse_button,
mImpl->mouseButton(mouse_button, mouse_event, x, y);
}
void dullahan::mouseWheel(int delta_x, int delta_y)
void dullahan::mouseWheel(int x, int y, int delta_x, int delta_y)
{
mImpl->mouseWheel(delta_x, delta_y);
mImpl->mouseWheel(x, y, delta_x, delta_y);
}
void dullahan::nativeKeyboardEventWin(uint32_t msg,
......@@ -404,6 +404,11 @@ void dullahan::setOnTitleChangeCallback(std::function<void(const std::string tit
mImpl->getCallbackManager()->setOnTitleChangeCallback(callback);
}
void dullahan::setOnTooltipCallback(std::function<void(const std::string text)> callback)
{
mImpl->getCallbackManager()->setOnTooltipCallback(callback);
}
void dullahan::setOnPdfPrintFinishedCallback(std::function<void(const std::string path, bool ok)> callback)
{
mImpl->getCallbackManager()->setOnPdfPrintFinishedCallback(callback);
......@@ -418,3 +423,9 @@ void dullahan::setOnFileDialogCallback(std::function<const std::vector<std::stri
{
mImpl->getCallbackManager()->setOnFileDialogCallback(callback);
}
void dullahan::setOnJSDialogCallback(std::function<bool(const std::string origin_url, const std::string message_text, const std::string default_prompt_text)> callback)
{
mImpl->getCallbackManager()->setOnJSDialogCallback(callback);
}
......@@ -169,15 +169,12 @@ class dullahan
bool plugins_enabled = true; // all plugins
bool webgl_enabled = true; // webgl
// path to browser cache
// path to browser cache - cookies (if enabled) are also stored here as of Chrome 75
std::string user_data_path = "";
// path to browser cache
std::string cache_path = "";
// path to cookie store
std::string cookie_store_path = "";
// list of language locale codes used to configure the Accept-Language HTTP header value
// and change the default language of the browser
std::string accept_language_list = "en-US";
......@@ -263,7 +260,7 @@ class dullahan
EMouseEvent mouse_event,
int x, int y);
void mouseMove(int x, int y);
void mouseWheel(int delta_x, int delta_y);
void mouseWheel(int x, int y, int delta_x, int delta_y);
// keyboard input
void nativeKeyboardEventWin(uint32_t msg, uint32_t wparam, uint64_t lparam);
......@@ -375,6 +372,8 @@ class dullahan
// page title changes
void setOnTitleChangeCallback(std::function<void(const std::string title)> callback);
void setOnTooltipCallback(std::function<void(const std::string text)> callback);
// a call to printToPDF completed
void setOnPdfPrintFinishedCallback(std::function<void(const std::string path, bool ok)> callback);
......@@ -384,6 +383,11 @@ class dullahan
// file picker shown
void setOnFileDialogCallback(std::function<const std::vector<std::string>(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, const std::string dialog_accept_filter, bool& use_default)> callback);
// JS dialog shown (alert)
void setOnJSDialogCallback(std::function<bool(const std::string origin_url,
const std::string message_text,
const std::string default_prompt_text)> callback);
private:
std::unique_ptr <dullahan_impl> mImpl;
};
......
......@@ -58,11 +58,16 @@ CefRefPtr<CefRenderHandler> dullahan_browser_client::GetRenderHandler()
// CefLifeSpanHandler override
bool dullahan_browser_client::OnBeforePopup(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url, const CefString& target_frame_name,
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, bool* no_javascript_access)
bool user_gesture,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
CefRefPtr<CefDictionaryValue>& extra_info,
bool* no_javascript_access)
{
CEF_REQUIRE_UI_THREAD();
......@@ -176,6 +181,16 @@ void dullahan_browser_client::OnTitleChange(CefRefPtr<CefBrowser> browser,
mParent->getCallbackManager()->onTitleChange(std::string(title));
}
// CefDisplayhandler overrides
bool dullahan_browser_client::OnTooltip(CefRefPtr<CefBrowser> browser,
CefString& text)
{
CEF_REQUIRE_UI_THREAD();
mParent->getCallbackManager()->OnTooltip(std::string(text));
return false;
}
// CefLoadHandler override
void dullahan_browser_client::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
bool isLoading, bool canGoBack, bool canGoForward)
......@@ -308,18 +323,6 @@ bool dullahan_browser_client::OnQuotaRequest(CefRefPtr<CefBrowser> browser,
return true;
}
// CefRequestHandler override
CefRequestHandler::ReturnValue dullahan_browser_client::OnBeforeResourceLoad(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefRequestCallback> callback)
{
CEF_REQUIRE_IO_THREAD();
return RV_CONTINUE;
}
// CefDownloadHandler overrides
void dullahan_browser_client::OnBeforeDownload(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
......@@ -414,3 +417,19 @@ bool dullahan_browser_client::OnFileDialog(CefRefPtr<CefBrowser> browser,
return true;
}
// CefJSDialogHandler overrides
bool dullahan_browser_client::OnJSDialog(CefRefPtr<CefBrowser> browser,
const CefString& origin_url,
JSDialogType dialog_type,
const CefString& message_text,
const CefString& default_prompt_text,
CefRefPtr<CefJSDialogCallback> callback,
bool& suppress_message)
{
suppress_message = mParent->getCallbackManager()->onJSDialogCallback(std::string(origin_url),
std::string(message_text),
std::string(default_prompt_text));
return false;
}
......@@ -41,7 +41,8 @@ class dullahan_browser_client :
public CefLoadHandler,
public CefRequestHandler,
public CefDownloadHandler,
public CefDialogHandler
public CefDialogHandler,
public CefJSDialogHandler
{
public:
dullahan_browser_client(dullahan_impl* parent,
......@@ -56,12 +57,18 @@ class dullahan_browser_client :
{
return this;
}
bool OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
const CefString& target_url, const CefString& target_frame_name,
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, bool* no_javascript_access) override;
bool user_gesture,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
CefRefPtr<CefDictionaryValue>& extra_info,
bool* no_javascript_access) override;
void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
bool DoClose(CefRefPtr<CefBrowser> browser) override;
......@@ -79,6 +86,8 @@ class dullahan_browser_client :
const CefString& value) override;
void OnTitleChange(CefRefPtr<CefBrowser> browser,
const CefString& title) override;
bool OnTooltip(CefRefPtr<CefBrowser> browser,
CefString& text) override;
// CefLoadHandler overrides
CefRefPtr<CefLoadHandler> GetLoadHandler() override
......@@ -111,10 +120,6 @@ class dullahan_browser_client :
const CefString& origin_url,
int64 new_size,
CefRefPtr<CefRequestCallback> callback) override;
CefRequestHandler::ReturnValue OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefRequestCallback> callback) override;
// CefDownloadHandler overrides
CefRefPtr<CefDownloadHandler> GetDownloadHandler() override
......@@ -138,6 +143,19 @@ class dullahan_browser_client :
const CefString& default_file_path, const std::vector<CefString>& accept_filters, int selected_accept_filter,
CefRefPtr<CefFileDialogCallback> callback) override;
// CefJSDialogHandler overrides
CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() override
{
return this;
}
bool OnJSDialog(CefRefPtr<CefBrowser> browser,
const CefString& origin_url,
JSDialogType dialog_type,
const CefString& message_text,
const CefString& default_prompt_text,
CefRefPtr<CefJSDialogCallback> callback,
bool& suppress_message) override;
private:
dullahan_impl* mParent;
CefRefPtr<CefRenderHandler> mRenderHandler;
......
......@@ -204,6 +204,19 @@ void dullahan_callback_manager::onTitleChange(const std::string title)
}
}
void dullahan_callback_manager::setOnTooltipCallback(std::function<void(const std::string text)> callback)
{
mOnTooltipCallbackFunc = callback;
}
void dullahan_callback_manager::OnTooltip(const std::string text)
{
if (mOnTooltipCallbackFunc)
{
mOnTooltipCallbackFunc(text);
}
}
void dullahan_callback_manager::setOnPdfPrintFinishedCallback(std::function<void(const std::string path, bool ok)> callback)
{
mOnPdfPrintFinishedCallbackFunc = callback;
......@@ -244,3 +257,21 @@ const std::vector<std::string> dullahan_callback_manager::onFileDialog(dullahan:
return std::vector<std::string>();
}
void dullahan_callback_manager::setOnJSDialogCallback(
std::function<bool(const std::string origin_url, const std::string message_text, const std::string default_prompt_text)> callback)
{
mOnJSDialogCallbackFunc = callback;
}
bool dullahan_callback_manager::onJSDialogCallback(const std::string origin_url, const std::string message_text, const std::string default_prompt_text)
{
if (mOnJSDialogCallbackFunc)
{
return mOnJSDialogCallbackFunc(origin_url, message_text, default_prompt_text);
}
// default to cancel request if no callback set up