ChromiumBrowser:

1. fix to compile on branch 2272 and 2357,
2. maximize workaround for linux backend
3. on screen keyboard is closed before browser exits.

git-svn-id: svn://ultimatepp.org/upp/trunk@8459 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
zbych 2015-05-17 19:43:29 +00:00
parent 8edeaac6b4
commit 943239d2d4
4 changed files with 36 additions and 5 deletions

View file

@ -23,7 +23,7 @@ bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser, const CefStr
return true;
}
#if CHROME_VERSION_BUILD > 2357
bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
@ -35,6 +35,17 @@ bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
bool* no_javascript_access)
#else
bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
const CefString& target_frame_name,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
bool* no_javascript_access)
#endif
{
RLOG(Upp::Format("Popup canceled, frame name: '%s', url '%s'", target_frame_name.ToString().c_str(), target_url.ToString().c_str()));
// Cancel popups

View file

@ -10,7 +10,11 @@
#undef ITEM
#include "include/cef_client.h"
#include "include/cef_version.h"
#ifndef CHROME_VERSION_BUILD
#error "Unknown CEF version"
#endif
class ClientHandler : public CefClient, public CefLifeSpanHandler, public CefDisplayHandler,
public CefLoadHandler, public CefFocusHandler, public CefContextMenuHandler,
@ -41,7 +45,7 @@ public:
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() OVERRIDE { return this; }
virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() OVERRIDE { return this; }
#if (CHROME_VERSION_BUILD >= 2357)
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
@ -53,6 +57,17 @@ public:
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
bool* no_javascript_access) OVERRIDE;
#else
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
const CefString& target_frame_name,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
bool* no_javascript_access) OVERRIDE;
#endif
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,

View file

@ -3,6 +3,7 @@
#include <CtrlLib/CtrlLib.h>
#include <ChromiumBrowser/ChromiumBrowser.h>
#include "Utils.h"
namespace Upp{
@ -12,7 +13,8 @@ namespace Upp{
class ChromiumBrowserExample : public WithChromiumBrowserExampleLayout<TopWindow> {
private:
void Close() { Upp::ShowKeyboard(false); TopWindow::Close(); }
void OnUrlChange(String url) { Url.SetData(url); Url.CancelSelection(); }
void OnTakeFocus() { Url.SetFocus(); }
void OnConsoleMessage(String url, int line, String msg) { RLOG(Format("Console message: url=%s, line=%d, msg=%s", url, line, msg)); }

View file

@ -1,5 +1,4 @@
#include "ChromiumBrowserExample.h"
#include "Utils.h"
using namespace Upp;
@ -32,7 +31,12 @@ ChromiumBrowserExample::ChromiumBrowserExample()
Go.WhenAction = THISBACK(OnBrowse);
Stop.WhenAction = callback(&Browser, &ChromiumBrowser::Stop);
#ifdef PLATFORM_WIN32
Maximize();
#elif defined(PLATFORM_LINUX)
//Delayed maximization - workaround for linux backend
SetTimeCallback(100, THISBACK1(Maximize, false));
#endif
}
@ -45,7 +49,6 @@ GUI_APP_MAIN
ChromiumBrowser::ChildProcess();
}else{
ChromiumBrowserExample().Run();
::ShowKeyboard(false);
}
}