Commit 63638198 authored by callum_linden's avatar callum_linden

Automated merge with Vendor branch drop of Dullahan that builds against CEF...

Automated merge with Vendor branch drop of Dullahan that builds against CEF 75.0.1+gb5e74dd+chromium-75.0.3770.80 and implement new versioning system as of Dullahan 1.2.x
parents daf8b91d 885bb284
......@@ -96,8 +96,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
......
......@@ -168,7 +168,7 @@ class CefMinimal : public CefApp
browser_client_ = new BrowserClient(render_handler_);
CefString url = "https://news.google.com";
browser_ = CefBrowserHost::CreateBrowserSync(window_info, browser_client_.get(), url, browser_settings, nullptr);
browser_ = CefBrowserHost::CreateBrowserSync(window_info, browser_client_.get(), url, browser_settings, nullptr, nullptr);
if (browser_.get() && browser_->GetHost())
{
......
......@@ -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;
......
......@@ -125,7 +125,6 @@ void app::init_dullahan()
settings.background_color = 0xff666666;
settings.cache_enabled = true;
settings.cache_path = ".\\webcube_cache";
settings.cookie_store_path = ".\\webcube_cookies";
settings.cookies_enabled = true;
settings.disable_gpu = false;
settings.disable_web_security = false;
......
......@@ -162,12 +162,9 @@ 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 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";
......
......@@ -55,11 +55,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();
......@@ -319,18 +324,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,
......
......@@ -57,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;
......@@ -114,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
......
/*
@brief Dullahan - a headless browser rendering engine
based around the Chromium Embedded Framework
@author Callum Prentice 2017
Copyright (c) 2017, Linden Research, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "dullahan_context_handler.h"
#include "dullahan_debug.h"
dullahan_context_handler::dullahan_context_handler(const std::string cookieStorageDirectory)
{
bool persist_session_cookies = false;
CefRefPtr<CefCompletionCallback> callback = nullptr;
mCookieManager = CefCookieManager::CreateManager(CefString(cookieStorageDirectory), persist_session_cookies, callback);
};
dullahan_context_handler::~dullahan_context_handler()
{
mCookieManager = nullptr;
};
CefRefPtr<CefCookieManager> dullahan_context_handler::GetCookieManager()
{
return mCookieManager;
}
bool dullahan_context_handler::OnBeforePluginLoad(const CefString& mime_type,
const CefString& plugin_url,
bool is_main_frame,
const CefString& top_origin_url,
CefRefPtr<CefWebPluginInfo> plugin_info,
PluginPolicy* plugin_policy)
{
if (*plugin_policy != PLUGIN_POLICY_ALLOW &&
mime_type == "application/pdf")
{
*plugin_policy = PLUGIN_POLICY_ALLOW;
return true;
}
return false;
}
/*
@brief Dullahan - a headless browser rendering engine
based around the Chromium Embedded Framework
@author Callum Prentice 2017
Copyright (c) 2017, Linden Research, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef _DULLAHAN_CONTEXT_HANDLER
#define _DULLAHAN_CONTEXT_HANDLER
#include "cef_app.h"
class dullahan_context_handler :
public CefRequestContextHandler
{
public:
dullahan_context_handler(const std::string cookieStorageDirectory);
~dullahan_context_handler();
CefRefPtr<CefCookieManager> GetCookieManager() override;
bool OnBeforePluginLoad(const CefString& mime_type,
const CefString& plugin_url,
bool is_main_frame,
const CefString& top_origin_url,
CefRefPtr<CefWebPluginInfo> plugin_info,
PluginPolicy* plugin_policy) override;
private:
CefRefPtr<CefCookieManager> mCookieManager;
IMPLEMENT_REFCOUNTING(dullahan_context_handler);
};
#endif // _DULLAHAN_CONTEXT_HANDLER
......@@ -32,7 +32,6 @@
#include "dullahan_render_handler.h"
#include "dullahan_browser_client.h"
#include "dullahan_callback_manager.h"
#include "dullahan_context_handler.h"
#include "include/cef_waitable_event.h"
......@@ -153,6 +152,9 @@ bool dullahan_impl::init(dullahan::dullahan_settings& user_settings)
// use a single thread for the message loop
settings.multi_threaded_message_loop = false;
// act like a browser and do not persist session cookies ever
settings.persist_session_cookies = false;
// turn on only for Windows 7+
CefEnableHighDPISupport();
......@@ -256,22 +258,13 @@ bool dullahan_impl::init(dullahan::dullahan_settings& user_settings)
CefRefPtr<CefCookieManager> manager = CefCookieManager::GetGlobalManager(nullptr);
if (manager)
{
// act like a browser and do not persist session cookies ever
bool persist_session_coookies = false;
if (user_settings.cookies_enabled == true)
{
std::string cookie_path = ".\\cookies";
if (user_settings.cookie_store_path.length())
{
cookie_path = std::string(user_settings.cookie_store_path);
}
manager->SetStoragePath(cookie_path, persist_session_coookies, nullptr);
}
else
if (user_settings.cookies_enabled == false)
{
// setting empty storage path causes cookies to only be stored in memory and not persisted to disk
manager->SetStoragePath("", persist_session_coookies, nullptr);
// this appears to be the way to disable cookies - empty list of schemes to accept and no defaults
const std::vector<CefString> empty_list;
const bool include_defaults = false;
CefRefPtr<CefCompletionCallback> callback = nullptr;
manager->SetSupportedSchemes(empty_list, include_defaults, callback);
}
}
......@@ -280,7 +273,8 @@ bool dullahan_impl::init(dullahan::dullahan_settings& user_settings)
CefString url = std::string();
CefRefPtr<CefRequestContext> request_context = nullptr;
mBrowser = CefBrowserHost::CreateBrowserSync(window_info, mBrowserClient.get(), url, browser_settings, request_context);
CefRefPtr<CefDictionaryValue> extra_info = nullptr;
mBrowser = CefBrowserHost::CreateBrowserSync(window_info, mBrowserClient.get(), url, browser_settings, extra_info, request_context);
// important: set the size *after* we create a browser
setSize(user_settings.initial_width, user_settings.initial_height);
......@@ -297,7 +291,6 @@ void dullahan_impl::shutdown()
mBrowser = nullptr;
mRenderHandler = nullptr;
mBrowserClient = nullptr;
mContextHandler = nullptr;
CefShutdown();
}
......
......@@ -137,7 +137,6 @@ class dullahan_impl :
CefRefPtr<dullahan_browser_client> mBrowserClient;
CefRefPtr<dullahan_render_handler> mRenderHandler;
CefRefPtr<CefBrowser> mBrowser;
CefRefPtr<dullahan_context_handler> mContextHandler;
dullahan_callback_manager* mCallbackManager;
bool mInitialized;
......
......@@ -36,10 +36,13 @@
#define _DULLAHAN_VERSION
// version of this package
// TODO: find a way to set build number directly from hg
#define DULLAHAN_VERSION_MAJOR 1
#define DULLAHAN_VERSION_MINOR 1
#define DULLAHAN_VERSION_BUILD 2222
#define DULLAHAN_VERSION_MINOR 2
// The build version number as of v1.2 is the number of "10 minutes since 2000-01-01"
// Still not sure if this is a good idea but it was better than a value selected
// randomly when the version needed to be bumped. To be continued...
#define DULLAHAN_VERSION_BUILD 1022544
// version numbers pulled from CEF build via Cmake
@CEF_VERSION_STR@
......
......@@ -15,3 +15,10 @@ A simple macOS shell script that uses a CEF build from the [Spotify](http://open
`astyle.bat`
I find it useful to use [Artistic Style](http://astyle.sourceforge.net/) to reformat the code occasionally and maintain control of tabs/space and line endings. This batch file assumes astyle is installed on your system and runs it with selected command line options.
`generate_build_version_number.bat`
I wanted a way to version small changes over time and everything else I looked at didn't do the trick.
I am going to try using the "integer number of 10 minutes's since 2000-01-01" and see how that goes.
Each time I want to increase the build version number, I run this script and paste the output into
the DULLAHAN_VERSION_BUILD value in src/dullahan_version.h.in. We will see if this is a good idea...
......@@ -13,8 +13,8 @@
@rem Edit these variables to match the version of CEF & Chromium you want to use after
@rem deciding on the version you want to use from the Spotify open source build page
@rem here http://opensource.spotify.com/cefbuilds/index.html
@set CEF_VERSION=74.1.19+gb62bacf
@set CHROMIUM_VERSION=74.0.3729.157
@set CEF_VERSION=75.0.1+gb5e74dd
@set CHROMIUM_VERSION=75.0.3770.80
@rem Edit this variable to point to the directory where you stored the download and
@rem where you would like to store the resulting Dullahan compatible CEF build
......
python -c "import datetime; print int((datetime.date.today() - datetime.date(2000, 1, 1)).total_seconds() / 3660.0)"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment