Integrate wxWebChromium to wxwidgets
Also add webview_chromium usage samples.
This commit is contained in:
parent
f3f1819daf
commit
02b72bee46
10 changed files with 2750 additions and 0 deletions
|
|
@ -3098,6 +3098,10 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||
<!-- wxWEBVIEW -->
|
||||
<!-- ====================================================================== -->
|
||||
|
||||
<!--Add CEF directory here-->
|
||||
<set var="CEF_INCLUDE_DIR">
|
||||
</set>
|
||||
|
||||
<set var="WEBVIEW_SRC_PLATFORM">
|
||||
<if cond="TOOLKIT=='MSW'">src/msw/webview_ie.cpp</if>
|
||||
<if cond="TOOLKIT=='GTK'">
|
||||
|
|
@ -3110,6 +3114,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||
src/common/webview.cpp
|
||||
src/common/webviewarchivehandler.cpp
|
||||
src/common/webviewfshandler.cpp
|
||||
src/common/webview_chromium3.cpp
|
||||
</set>
|
||||
<set var="WEBVIEW_SRC" hints="files">
|
||||
$(WEBVIEW_SRC_PLATFORM)
|
||||
|
|
@ -3135,6 +3140,8 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||
wx/webview.h
|
||||
wx/webviewarchivehandler.h
|
||||
wx/webviewfshandler.h
|
||||
wx/webview_chromium.h
|
||||
wx/webview_chromium3.h
|
||||
</set>
|
||||
<set var="WEBVIEW_HDR" hints="files">
|
||||
$(WEBVIEW_HDR_PLATFORM)
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@
|
|||
cond="SHARED=='0' and USE_GUI=='1' and USE_WEBVIEW=='1' and MONOLITHIC=='0'">
|
||||
<sources>$(WEBVIEW_SRC)</sources>
|
||||
<msvc-headers>$(WEBVIEW_HDR)</msvc-headers>
|
||||
<include>$(CEF_INCLUDE_DIR)</include>
|
||||
</lib>
|
||||
|
||||
<wxshortcut id="wxwebview" cond="MONOLITHIC=='0' and USE_WEBVIEW=='1'"/>
|
||||
|
|
|
|||
28
include/wx/webview_chromium.h
Normal file
28
include/wx/webview_chromium.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Author: Steven Lamerton
|
||||
// Copyright: (c) 2013 Steven Lamerton
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_WEBVIEWCHROMIUM_H_
|
||||
#define _WX_WEBVIEWCHROMIUM_H_
|
||||
|
||||
#include <wx/wxprec.h>
|
||||
#include <include/cef_version.h>
|
||||
|
||||
#if !defined(CEF_VERSION_MAJOR) || \
|
||||
(defined(CEF_VERSION_MAJOR) && CEF_VERSION_MAJOR == 1)
|
||||
#define CEF_API 1
|
||||
#elif defined(CEF_VERSION_MAJOR) && CEF_VERSION_MAJOR == 3
|
||||
#define CEF_API 3
|
||||
#else
|
||||
#error "Could not find CEF"
|
||||
#endif
|
||||
|
||||
#if CEF_API == 1
|
||||
#include "webview_chromium1.h"
|
||||
#elif CEF_API == 3
|
||||
#include "webview_chromium3.h"
|
||||
#endif
|
||||
|
||||
#endif // _WX_WEBVIEWCHROMIUM_H_
|
||||
266
include/wx/webview_chromium3.h
Normal file
266
include/wx/webview_chromium3.h
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Author: Steven Lamerton
|
||||
// Copyright: (c) 2013 Steven Lamerton
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_WEBVIEWCHROMIUM3_H_
|
||||
#define _WX_WEBVIEWCHROMIUM3_H_
|
||||
|
||||
//#if CEF_API == 3
|
||||
|
||||
#include <wx/control.h>
|
||||
#include <wx/webview.h>
|
||||
#include <wx/sharedptr.h>
|
||||
#include <wx/vector.h>
|
||||
#include <wx/webview.h>
|
||||
#include <wx/timer.h>
|
||||
|
||||
#ifdef __VISUALC__
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100)
|
||||
#endif
|
||||
|
||||
#include <include/cef_browser.h>
|
||||
#include <include/cef_client.h>
|
||||
|
||||
#ifdef __VISUALC__
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
extern const char wxWebViewBackendChromium[];
|
||||
|
||||
class wxWebViewChromium;
|
||||
|
||||
// ClientHandler implementation.
|
||||
class ClientHandler : public CefClient,
|
||||
public CefContextMenuHandler,
|
||||
public CefDisplayHandler,
|
||||
public CefLifeSpanHandler,
|
||||
public CefLoadHandler
|
||||
{
|
||||
public:
|
||||
ClientHandler() {};
|
||||
virtual ~ClientHandler() {};
|
||||
|
||||
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() { return this; }
|
||||
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() { return this; }
|
||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() { return this; }
|
||||
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() { return this; }
|
||||
|
||||
// CefDisplayHandler methods
|
||||
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading, bool canGoBack,
|
||||
bool canGoForward);
|
||||
virtual void OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& url);
|
||||
virtual void OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title);
|
||||
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line);
|
||||
|
||||
// CefContextMenuHandler methods
|
||||
virtual void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
CefRefPtr<CefMenuModel> model);
|
||||
virtual bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
int command_id,
|
||||
CefContextMenuHandler::EventFlags event_flags);
|
||||
virtual void OnContextMenuDismissed(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame);
|
||||
|
||||
// CefLifeSpanHandler methods
|
||||
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);
|
||||
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser);
|
||||
virtual bool DoClose(CefRefPtr<CefBrowser> browser);
|
||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
// CefLoadHandler methods
|
||||
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame);
|
||||
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode);
|
||||
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl);
|
||||
|
||||
CefRefPtr<CefBrowser> GetBrowser() { return m_browser; }
|
||||
|
||||
void SetWebView(wxWebViewChromium *webview) { m_webview = webview; }
|
||||
|
||||
private:
|
||||
CefRefPtr<CefBrowser> m_browser;
|
||||
wxWebViewChromium *m_webview;
|
||||
int m_browserId;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientHandler);
|
||||
};
|
||||
|
||||
|
||||
class WXDLLIMPEXP_WEBVIEW wxWebViewChromium : public wxWebView
|
||||
{
|
||||
public:
|
||||
|
||||
wxWebViewChromium() {}
|
||||
|
||||
wxWebViewChromium(wxWindow* parent,
|
||||
wxWindowID id,
|
||||
const wxString& url = wxWebViewDefaultURLStr,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxWebViewNameStr)
|
||||
{
|
||||
Create(parent, id, url, pos, size, style, name);
|
||||
}
|
||||
|
||||
~wxWebViewChromium();
|
||||
|
||||
void OnSize(wxSizeEvent &event);
|
||||
|
||||
void SetPageSource(const wxString& pageSource);
|
||||
|
||||
void SetPageText(const wxString& pageText);
|
||||
|
||||
bool Create(wxWindow* parent,
|
||||
wxWindowID id,
|
||||
const wxString& url = wxWebViewDefaultURLStr,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxWebViewNameStr);
|
||||
|
||||
virtual void LoadURL(const wxString& url);
|
||||
virtual void LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item);
|
||||
virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetBackwardHistory();
|
||||
virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetForwardHistory();
|
||||
|
||||
virtual bool CanGoForward() const;
|
||||
virtual bool CanGoBack() const;
|
||||
virtual void GoBack();
|
||||
virtual void GoForward();
|
||||
virtual void ClearHistory();
|
||||
virtual void EnableHistory(bool enable = true);
|
||||
virtual void Stop();
|
||||
virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT);
|
||||
|
||||
virtual wxString GetPageSource() const;
|
||||
virtual wxString GetPageText() const;
|
||||
|
||||
virtual bool IsBusy() const;
|
||||
virtual wxString GetCurrentURL() const;
|
||||
virtual wxString GetCurrentTitle() const;
|
||||
|
||||
virtual void SetZoomType(wxWebViewZoomType type);
|
||||
virtual wxWebViewZoomType GetZoomType() const;
|
||||
virtual bool CanSetZoomType(wxWebViewZoomType type) const;
|
||||
|
||||
virtual void Print();
|
||||
|
||||
virtual wxWebViewZoom GetZoom() const;
|
||||
virtual void SetZoom(wxWebViewZoom zoom);
|
||||
|
||||
virtual void* GetNativeBackend() const;
|
||||
|
||||
virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT) { return wxNOT_FOUND; }
|
||||
|
||||
//Clipboard functions
|
||||
virtual bool CanCut() const { return true; }
|
||||
virtual bool CanCopy() const { return true; }
|
||||
virtual bool CanPaste() const { return true; }
|
||||
virtual void Cut();
|
||||
virtual void Copy();
|
||||
virtual void Paste();
|
||||
|
||||
//Undo / redo functionality
|
||||
virtual bool CanUndo() const { return true; }
|
||||
virtual bool CanRedo() const { return true; }
|
||||
virtual void Undo();
|
||||
virtual void Redo();
|
||||
|
||||
//Editing functions
|
||||
virtual void SetEditable(bool enable = true);
|
||||
virtual bool IsEditable() const { return false; }
|
||||
|
||||
//Selection
|
||||
virtual void SelectAll();
|
||||
virtual bool HasSelection() const { return false; }
|
||||
virtual void DeleteSelection();
|
||||
virtual wxString GetSelectedText() const { return ""; }
|
||||
virtual wxString GetSelectedSource() const { return ""; }
|
||||
virtual void ClearSelection();
|
||||
|
||||
virtual void RunScript(const wxString& javascript);
|
||||
|
||||
//Virtual Filesystem Support
|
||||
virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler);
|
||||
|
||||
static bool StartUp(int &code, const wxString &path = "");
|
||||
// If using a separate subprocess then return the result of this function
|
||||
static int StartUpSubprocess();
|
||||
static void Shutdown();
|
||||
|
||||
protected:
|
||||
virtual void DoSetPage(const wxString& html, const wxString& baseUrl);
|
||||
|
||||
private:
|
||||
//History related variables, we currently use our own implementation
|
||||
wxVector<wxSharedPtr<wxWebViewHistoryItem> > m_historyList;
|
||||
int m_historyPosition;
|
||||
bool m_historyLoadingFromList;
|
||||
bool m_historyEnabled;
|
||||
|
||||
//We need to store the title and zoom ourselves
|
||||
wxString m_title;
|
||||
wxWebViewZoom m_zoomLevel;
|
||||
|
||||
//The timer calls the CEF event loop
|
||||
wxTimer *m_timer;
|
||||
|
||||
// Current main frame page source
|
||||
wxString m_pageSource;
|
||||
|
||||
// The text of the current page
|
||||
wxString m_pageText;
|
||||
|
||||
//We also friend ClientHandler so it can access the history
|
||||
friend class ClientHandler;
|
||||
CefRefPtr<ClientHandler> m_clientHandler;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxWebViewChromium);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryChromium : public wxWebViewFactory
|
||||
{
|
||||
public:
|
||||
virtual wxWebView* Create() { return new wxWebViewChromium; }
|
||||
virtual wxWebView* Create(wxWindow* parent,
|
||||
wxWindowID id,
|
||||
const wxString& url = wxWebViewDefaultURLStr,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxWebViewNameStr)
|
||||
{ return new wxWebViewChromium(parent, id, url, pos, size, style, name); }
|
||||
};
|
||||
|
||||
//#endif
|
||||
|
||||
#endif // _WX_WEBVIEWCHROMIUM3_H_
|
||||
234
samples/webview_chromium/refresh.xpm
Normal file
234
samples/webview_chromium/refresh.xpm
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
/* XPM */
|
||||
static const char * refresh_xpm[] = {
|
||||
"24 24 207 2",
|
||||
" c None",
|
||||
". c #3162A2",
|
||||
"+ c #507BB3",
|
||||
"@ c #6A90C0",
|
||||
"# c #7296C4",
|
||||
"$ c #7397C4",
|
||||
"% c #7094C2",
|
||||
"& c #648BBD",
|
||||
"* c #507CB3",
|
||||
"= c #3061A2",
|
||||
"- c #8EACD1",
|
||||
"; c #B3CBE4",
|
||||
"> c #B7CEE6",
|
||||
", c #B8CEE6",
|
||||
"' c #B5CDE5",
|
||||
") c #B4CBE5",
|
||||
"! c #B0C9E3",
|
||||
"~ c #AEC6E1",
|
||||
"{ c #9FBBDB",
|
||||
"] c #648DBE",
|
||||
"^ c #2F60A2",
|
||||
"/ c #3262A4",
|
||||
"( c #3364A3",
|
||||
"_ c #3C6BA8",
|
||||
": c #A7C0DD",
|
||||
"< c #C1D6EA",
|
||||
"[ c #BAD0E7",
|
||||
"} c #B6CDE5",
|
||||
"| c #B6CCE6",
|
||||
"1 c #B5CDE6",
|
||||
"2 c #B3CBE5",
|
||||
"3 c #AFC8E3",
|
||||
"4 c #AAC5E2",
|
||||
"5 c #ABC6E2",
|
||||
"6 c #A0BCDB",
|
||||
"7 c #4975AF",
|
||||
"8 c #3666A5",
|
||||
"9 c #89ACD3",
|
||||
"0 c #2C5EA0",
|
||||
"a c #82A3CB",
|
||||
"b c #B5CCE4",
|
||||
"c c #7095C3",
|
||||
"d c #658CBC",
|
||||
"e c #678EBE",
|
||||
"f c #7196C2",
|
||||
"g c #84A4CC",
|
||||
"h c #A9C3E0",
|
||||
"i c #B8CFE7",
|
||||
"j c #ACC6E3",
|
||||
"k c #A0BEDE",
|
||||
"l c #9CBCDD",
|
||||
"m c #9EBDDE",
|
||||
"n c #6C93C1",
|
||||
"o c #7B9FCA",
|
||||
"p c #ABC7E3",
|
||||
"q c #2B5DA0",
|
||||
"r c #4976AE",
|
||||
"s c #8EADD0",
|
||||
"t c #4975AE",
|
||||
"u c #3667A6",
|
||||
"v c #3666A6",
|
||||
"w c #4170AB",
|
||||
"x c #5B83B6",
|
||||
"y c #9BB9DA",
|
||||
"z c #97B9DC",
|
||||
"A c #7EA7D3",
|
||||
"B c #7CA5D2",
|
||||
"C c #88AED6",
|
||||
"D c #8AAFD6",
|
||||
"E c #A4C1E0",
|
||||
"F c #406DAB",
|
||||
"G c #4F7BB2",
|
||||
"H c #4A77B3",
|
||||
"I c #4C79B4",
|
||||
"J c #2E5EA2",
|
||||
"K c #6F95C3",
|
||||
"L c #95B6D9",
|
||||
"M c #7FA8D3",
|
||||
"N c #76A1D0",
|
||||
"O c #709DCE",
|
||||
"P c #2B5DA1",
|
||||
"Q c #3667A5",
|
||||
"R c #4D7AB4",
|
||||
"S c #648DC3",
|
||||
"T c #4A78B3",
|
||||
"U c #3262A2",
|
||||
"V c #2C5FA0",
|
||||
"W c #6B91C0",
|
||||
"X c #97B8DB",
|
||||
"Y c #74A0CF",
|
||||
"Z c #709ECE",
|
||||
"` c #ACC7E3",
|
||||
" . c #2D5EA0",
|
||||
".. c #3767A6",
|
||||
"+. c #5985BD",
|
||||
"@. c #78A3D0",
|
||||
"#. c #6C9BCC",
|
||||
"$. c #AEC9E5",
|
||||
"%. c #3263A3",
|
||||
"&. c #3768A7",
|
||||
"*. c #9BB8DA",
|
||||
"=. c #9CB9DA",
|
||||
"-. c #9CBADA",
|
||||
";. c #9FBBDC",
|
||||
">. c #A8C1DF",
|
||||
",. c #2D5FA0",
|
||||
"'. c #22569B",
|
||||
"). c #23579C",
|
||||
"!. c #21569A",
|
||||
"~. c #21559B",
|
||||
"{. c #275A9E",
|
||||
"]. c #3364A4",
|
||||
"^. c #24589C",
|
||||
"/. c #24579C",
|
||||
"(. c #416FAB",
|
||||
"_. c #C0D3E8",
|
||||
":. c #B8CCE4",
|
||||
"<. c #B5CBE3",
|
||||
"[. c #AFC7E1",
|
||||
"}. c #B0C8E2",
|
||||
"|. c #88A9CF",
|
||||
"1. c #4471AC",
|
||||
"2. c #B9D1E8",
|
||||
"3. c #94B6DA",
|
||||
"4. c #95B7DB",
|
||||
"5. c #A3C1DF",
|
||||
"6. c #A4BEDC",
|
||||
"7. c #2D60A0",
|
||||
"8. c #BBD1E9",
|
||||
"9. c #BCD1E8",
|
||||
"0. c #416EA9",
|
||||
"a. c #3868A7",
|
||||
"b. c #BAD1E9",
|
||||
"c. c #96B7DB",
|
||||
"d. c #98B9DC",
|
||||
"e. c #A2C0DF",
|
||||
"f. c #AAC4DF",
|
||||
"g. c #5F88BA",
|
||||
"h. c #80A8D7",
|
||||
"i. c #CDDCEC",
|
||||
"j. c #7A9FC8",
|
||||
"k. c #4273B1",
|
||||
"l. c #3465A4",
|
||||
"m. c #4371AC",
|
||||
"n. c #B9D1E9",
|
||||
"o. c #B4CCE5",
|
||||
"p. c #9DBCDD",
|
||||
"q. c #8EB2D8",
|
||||
"r. c #91B3D9",
|
||||
"s. c #719AC8",
|
||||
"t. c #4171AC",
|
||||
"u. c #3A6AA8",
|
||||
"v. c #3A75BD",
|
||||
"w. c #9CBBDB",
|
||||
"x. c #608BC1",
|
||||
"y. c #3A6EAD",
|
||||
"z. c #4C80BB",
|
||||
"A. c #3365A4",
|
||||
"B. c #C6DAED",
|
||||
"C. c #6F94C1",
|
||||
"D. c #8CABD1",
|
||||
"E. c #9BBBDD",
|
||||
"F. c #6C9ACD",
|
||||
"G. c #6596CA",
|
||||
"H. c #709DCF",
|
||||
"I. c #7AA4D2",
|
||||
"J. c #6A96C8",
|
||||
"K. c #5885BB",
|
||||
"L. c #4F7EB7",
|
||||
"M. c #497AB6",
|
||||
"N. c #487AB6",
|
||||
"O. c #4275B5",
|
||||
"P. c #4C7FBB",
|
||||
"Q. c #578BC6",
|
||||
"R. c #396CAA",
|
||||
"S. c #789CC6",
|
||||
"T. c #5681B6",
|
||||
"U. c #8AAFD7",
|
||||
"V. c #77A2D1",
|
||||
"W. c #6496CA",
|
||||
"X. c #6294C9",
|
||||
"Y. c #6395CA",
|
||||
"Z. c #5F92C9",
|
||||
"`. c #5C8FC7",
|
||||
" + c #598DC6",
|
||||
".+ c #588DC7",
|
||||
"++ c #4175B2",
|
||||
"@+ c #31619F",
|
||||
"#+ c #6089BB",
|
||||
"$+ c #77A0CE",
|
||||
"%+ c #6E9CCD",
|
||||
"&+ c #6696CA",
|
||||
"*+ c #6193C9",
|
||||
"=+ c #5F91C8",
|
||||
"-+ c #5C90C7",
|
||||
";+ c #5A8EC6",
|
||||
">+ c #558AC3",
|
||||
",+ c #4072AF",
|
||||
"'+ c #27528A",
|
||||
")+ c #2A5285",
|
||||
"!+ c #3C6599",
|
||||
"~+ c #4B77B0",
|
||||
"{+ c #4E7DB6",
|
||||
"]+ c #4C7CB7",
|
||||
"^+ c #4877B2",
|
||||
"/+ c #3B69A2",
|
||||
"(+ c #3361A0",
|
||||
" ",
|
||||
" . + @ # $ % & * ",
|
||||
" = - ; > , ' ) ! ~ { ] ^ / ( ",
|
||||
" _ : < [ } | 1 2 3 4 5 > 6 7 8 9 0 ",
|
||||
" a b a c d e f g h i j k l m n o p q ",
|
||||
" r s t u v w x y z A B C D E q ",
|
||||
" F G H I J K L M N O 4 P ",
|
||||
" Q R S T U V W X Y Z ` . ",
|
||||
" ..+. t L @.Z #.$.0 ",
|
||||
" %. &.{ *.=.-.;.>.,. ",
|
||||
" '.).!.~.~.{.]. %.^./.^./.).'. ",
|
||||
" (._.:.<.[.}.|.V ]. ",
|
||||
" 1.2.3.4.5.6.7. %. ",
|
||||
" 1.8.X l 9.0. a.( ",
|
||||
" 1.b.c.d.e.f.g. h.i.j.k.l. ",
|
||||
" m.n.o.p.3.q.r.s.t.u. v.w.x.y.z.A. ",
|
||||
" m.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R. ",
|
||||
" (.S. T.U.V.W.X.Y.Y.X.Z.`. +.+++ ",
|
||||
" ]. @+#+$+%+&+*+=+-+;+>+,+ ",
|
||||
" '+)+!+~+{+]+^+/+(+ ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
331
samples/webview_chromium/stop.xpm
Normal file
331
samples/webview_chromium/stop.xpm
Normal file
|
|
@ -0,0 +1,331 @@
|
|||
/* XPM */
|
||||
static const char * stop_xpm[] = {
|
||||
"24 24 304 2",
|
||||
" c None",
|
||||
". c #920F0F",
|
||||
"+ c #931212",
|
||||
"@ c #931111",
|
||||
"# c #8F0909",
|
||||
"$ c #981414",
|
||||
"% c #DC6666",
|
||||
"& c #F07575",
|
||||
"* c #EF7272",
|
||||
"= c #EE7171",
|
||||
"- c #EE6F6F",
|
||||
"; c #EE6D6D",
|
||||
"> c #EE6C6C",
|
||||
", c #E46969",
|
||||
"' c #980F0F",
|
||||
") c #8E0606",
|
||||
"! c #EA7B7B",
|
||||
"~ c #E25858",
|
||||
"{ c #D84040",
|
||||
"] c #D83F3F",
|
||||
"^ c #D83E3E",
|
||||
"/ c #D83D3D",
|
||||
"( c #D73C3C",
|
||||
"_ c #D73A3A",
|
||||
": c #DD4A4A",
|
||||
"< c #EC7272",
|
||||
"[ c #950909",
|
||||
"} c #9A1616",
|
||||
"| c #EB7C7C",
|
||||
"1 c #E15959",
|
||||
"2 c #D74040",
|
||||
"3 c #D94444",
|
||||
"4 c #D94343",
|
||||
"5 c #D94242",
|
||||
"6 c #D94141",
|
||||
"7 c #D93F3F",
|
||||
"8 c #D73D3D",
|
||||
"9 c #D73939",
|
||||
"0 c #DD4747",
|
||||
"a c #E96D6D",
|
||||
"b c #A21818",
|
||||
"c c #9D1717",
|
||||
"d c #DC6868",
|
||||
"e c #E25959",
|
||||
"f c #D94545",
|
||||
"g c #D84545",
|
||||
"h c #DA4545",
|
||||
"i c #D84242",
|
||||
"j c #D84141",
|
||||
"k c #D63D3D",
|
||||
"l c #D73B3B",
|
||||
"m c #D63838",
|
||||
"n c #DC4747",
|
||||
"o c #D95555",
|
||||
"p c #9D1414",
|
||||
"q c #940909",
|
||||
"r c #E15757",
|
||||
"s c #DC4848",
|
||||
"t c #F64949",
|
||||
"u c #D94747",
|
||||
"v c #D94646",
|
||||
"w c #D73F3F",
|
||||
"x c #EA4141",
|
||||
"y c #E53D3D",
|
||||
"z c #D53A3A",
|
||||
"A c #D43838",
|
||||
"B c #DB4747",
|
||||
"C c #E66161",
|
||||
"D c #920606",
|
||||
"E c #9D1818",
|
||||
"F c #EC7C7C",
|
||||
"G c #DF5353",
|
||||
"H c #DC4545",
|
||||
"I c #F15A5A",
|
||||
"J c #EEB2B2",
|
||||
"K c #F55757",
|
||||
"L c #DB4545",
|
||||
"M c #EA4545",
|
||||
"N c #F38383",
|
||||
"O c #F27979",
|
||||
"P c #DC3D3D",
|
||||
"Q c #D33838",
|
||||
"R c #D13535",
|
||||
"S c #D84343",
|
||||
"T c #E35C5C",
|
||||
"U c #980E0E",
|
||||
"V c #BD4949",
|
||||
"W c #E25656",
|
||||
"X c #D74343",
|
||||
"Y c #F44F4F",
|
||||
"Z c #EBBFBF",
|
||||
"` c #E4EBEB",
|
||||
" . c #EBC7C7",
|
||||
".. c #F15D5D",
|
||||
"+. c #DB4141",
|
||||
"@. c #EA4747",
|
||||
"#. c #F09C9C",
|
||||
"$. c #E4EFEF",
|
||||
"%. c #E5DDDD",
|
||||
"&. c #FC5858",
|
||||
"*. c #D53939",
|
||||
"=. c #D13737",
|
||||
"-. c #CE3333",
|
||||
";. c #B93434",
|
||||
">. c #DC4949",
|
||||
",. c #E34545",
|
||||
"'. c #F48F8F",
|
||||
"). c #E7E6E6",
|
||||
"!. c #E8E9E9",
|
||||
"~. c #EDCBCB",
|
||||
"{. c #F45A5A",
|
||||
"]. c #EA4C4C",
|
||||
"^. c #F2A3A3",
|
||||
"/. c #E9E9E9",
|
||||
"(. c #E7E9E9",
|
||||
"_. c #F0B0B0",
|
||||
":. c #E74848",
|
||||
"<. c #CF3636",
|
||||
"[. c #CE3535",
|
||||
"}. c #D23A3A",
|
||||
"|. c #BC4949",
|
||||
"1. c #DD4848",
|
||||
"2. c #E74444",
|
||||
"3. c #F29E9E",
|
||||
"4. c #EAE9E9",
|
||||
"5. c #EBF0F0",
|
||||
"6. c #F0CECE",
|
||||
"7. c #F79191",
|
||||
"8. c #EAF4F4",
|
||||
"9. c #EBECEC",
|
||||
"0. c #EFC4C4",
|
||||
"a. c #EA4B4B",
|
||||
"b. c #D13939",
|
||||
"c. c #CF3737",
|
||||
"d. c #CD3434",
|
||||
"e. c #D13A3A",
|
||||
"f. c #B83333",
|
||||
"g. c #D73E3E",
|
||||
"h. c #E74646",
|
||||
"i. c #F59E9E",
|
||||
"j. c #EFE8E8",
|
||||
"k. c #EEF1F1",
|
||||
"l. c #EEF5F5",
|
||||
"m. c #F3BABA",
|
||||
"n. c #EA5050",
|
||||
"o. c #D23B3B",
|
||||
"p. c #D03A3A",
|
||||
"q. c #CF3939",
|
||||
"r. c #CC3535",
|
||||
"s. c #CA3131",
|
||||
"t. c #B83232",
|
||||
"u. c #BD4848",
|
||||
"v. c #D83A3A",
|
||||
"w. c #F05D5D",
|
||||
"x. c #F5BEBE",
|
||||
"y. c #F1F2F2",
|
||||
"z. c #F2E6E6",
|
||||
"A. c #FE7A7A",
|
||||
"B. c #CF3434",
|
||||
"C. c #C92121",
|
||||
"D. c #C61212",
|
||||
"E. c #C10707",
|
||||
"F. c #C00505",
|
||||
"G. c #BE0404",
|
||||
"H. c #C30C0C",
|
||||
"I. c #B72222",
|
||||
"J. c #BC4848",
|
||||
"K. c #DC4343",
|
||||
"L. c #D73838",
|
||||
"M. c #E95A5A",
|
||||
"N. c #F8ADAD",
|
||||
"O. c #F2F9F9",
|
||||
"P. c #F3F3F3",
|
||||
"Q. c #F4F2F2",
|
||||
"R. c #F3F7F7",
|
||||
"S. c #F2D5D5",
|
||||
"T. c #F05050",
|
||||
"U. c #C30000",
|
||||
"V. c #BF0000",
|
||||
"W. c #BE0000",
|
||||
"X. c #BD0000",
|
||||
"Y. c #BB0000",
|
||||
"Z. c #C00707",
|
||||
"`. c #B71F1F",
|
||||
" + c #BC4646",
|
||||
".+ c #DC4141",
|
||||
"++ c #D63636",
|
||||
"@+ c #D63737",
|
||||
"#+ c #EA5C5C",
|
||||
"$+ c #F6B9B9",
|
||||
"%+ c #F4FAFA",
|
||||
"&+ c #F9C5C5",
|
||||
"*+ c #FCACAC",
|
||||
"=+ c #F4F0F0",
|
||||
"-+ c #F1F6F6",
|
||||
";+ c #EB5F5F",
|
||||
">+ c #C00101",
|
||||
",+ c #B90000",
|
||||
"'+ c #BF0707",
|
||||
")+ c #B61D1D",
|
||||
"!+ c #BC4545",
|
||||
"~+ c #DA3E3E",
|
||||
"{+ c #D73535",
|
||||
"]+ c #D63434",
|
||||
"^+ c #EA6363",
|
||||
"/+ c #F5BFBF",
|
||||
"(+ c #F1F1F1",
|
||||
"_+ c #F5F6F6",
|
||||
":+ c #FAC9C9",
|
||||
"<+ c #DF3C3C",
|
||||
"[+ c #D21B1B",
|
||||
"}+ c #FBADAD",
|
||||
"|+ c #F5F4F4",
|
||||
"1+ c #F2F2F2",
|
||||
"2+ c #F1D7D7",
|
||||
"3+ c #F07373",
|
||||
"4+ c #B80000",
|
||||
"5+ c #BD0707",
|
||||
"6+ c #B61C1C",
|
||||
"7+ c #B53B3B",
|
||||
"8+ c #E75D5D",
|
||||
"9+ c #D63333",
|
||||
"0+ c #D53333",
|
||||
"a+ c #D42F2F",
|
||||
"b+ c #F58686",
|
||||
"c+ c #F3D4D4",
|
||||
"d+ c #F2F3F3",
|
||||
"e+ c #F6D3D3",
|
||||
"f+ c #E44343",
|
||||
"g+ c #C40000",
|
||||
"h+ c #C20000",
|
||||
"i+ c #D82C2C",
|
||||
"j+ c #F7B7B7",
|
||||
"k+ c #F0E9E9",
|
||||
"l+ c #FA8F8F",
|
||||
"m+ c #BE0A0A",
|
||||
"n+ c #B70000",
|
||||
"o+ c #B60000",
|
||||
"p+ c #C20C0C",
|
||||
"q+ c #B41919",
|
||||
"r+ c #8B0101",
|
||||
"s+ c #C44848",
|
||||
"t+ c #EC5F5F",
|
||||
"u+ c #D52A2A",
|
||||
"v+ c #D22424",
|
||||
"w+ c #CE1C1C",
|
||||
"x+ c #E96969",
|
||||
"y+ c #FBC4C4",
|
||||
"z+ c #E44949",
|
||||
"A+ c #C40101",
|
||||
"B+ c #C10000",
|
||||
"C+ c #D53131",
|
||||
"D+ c #FBBEBE",
|
||||
"E+ c #F09292",
|
||||
"F+ c #C00E0E",
|
||||
"G+ c #B50000",
|
||||
"H+ c #C71212",
|
||||
"I+ c #980707",
|
||||
"J+ c #890101",
|
||||
"K+ c #B52828",
|
||||
"L+ c #E63D3D",
|
||||
"M+ c #C90202",
|
||||
"N+ c #C70000",
|
||||
"O+ c #C80505",
|
||||
"P+ c #D32424",
|
||||
"Q+ c #C61B1B",
|
||||
"R+ c #C11111",
|
||||
"S+ c #C81313",
|
||||
"T+ c #8C0101",
|
||||
"U+ c #880000",
|
||||
"V+ c #BE2E2E",
|
||||
"W+ c #DC2D2D",
|
||||
"X+ c #C50000",
|
||||
"Y+ c #BC0000",
|
||||
"Z+ c #C30D0D",
|
||||
"`+ c #CE2424",
|
||||
" @ c #850000",
|
||||
".@ c #BE2B2B",
|
||||
"+@ c #E33434",
|
||||
"@@ c #C00000",
|
||||
"#@ c #CC1616",
|
||||
"$@ c #CB2222",
|
||||
"%@ c #910404",
|
||||
"&@ c #790000",
|
||||
"*@ c #B21D1D",
|
||||
"=@ c #E03131",
|
||||
"-@ c #B40000",
|
||||
";@ c #CD1818",
|
||||
">@ c #C61F1F",
|
||||
",@ c #830000",
|
||||
"'@ c #730000",
|
||||
")@ c #B92525",
|
||||
"!@ c #E14444",
|
||||
"~@ c #E04141",
|
||||
"{@ c #DF3F3F",
|
||||
"]@ c #DE3C3C",
|
||||
"^@ c #DE3A3A",
|
||||
"/@ c #DE3737",
|
||||
"(@ c #DD3535",
|
||||
"_@ c #DD3232",
|
||||
":@ c #C42121",
|
||||
"<@ c #7E0000",
|
||||
"[@ c #720000",
|
||||
"}@ c #770000",
|
||||
" . + + + + + + @ @ # ",
|
||||
" $ % & * * * = - ; > , ' ",
|
||||
" ) ! ~ { { { ] ^ / ( _ : < [ ",
|
||||
" } | 1 2 3 3 4 5 6 7 ^ 8 9 0 a b ",
|
||||
" c d e 6 f g f h 4 i j 7 k l m n o p ",
|
||||
" q | r 4 f s t u v h i 6 w x y z A B C D ",
|
||||
" E F G w 4 H I J K L f i j M N O P Q R S T U ",
|
||||
" V W / 6 X Y Z ` ...+.j @.#.$.%.&.*.=.-.f ;. ",
|
||||
" V >.7 { i ,.'.).!.~.{.].^./.(._.:.=.<.[.}.;. ",
|
||||
" |.1.^ ] 7 { 2.3.4.5.6.7.8.9.0.a.b.c.[.d.e.f. ",
|
||||
" |.0 ( 8 ^ ] g.h.i.j.k.l.k.m.n.o.p.q.r.s.<.t. ",
|
||||
" u.H v.l ( / / *.w.x.y.y.z.A.B.C.D.E.F.G.H.I. ",
|
||||
" J.K.L.9 _ _ _ M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. ",
|
||||
" +.+++@+L.@+#+$+O.%+&+*+=+-+S.;+>+X.Y.,+'+)+ ",
|
||||
" !+~+{+{+]+^+/+(+_+:+<+[+}+|+1+2+3+Y.,+4+5+6+ ",
|
||||
" 7+8+9+0+a+b+c+d+e+f+g+h+i+j+P.k+l+m+n+o+p+q+ ",
|
||||
" r+s+t+u+v+w+x+y+z+A+h+B+X.C+D+E+F+n+G+H+v+I+ ",
|
||||
" J+K+L+M+N+O+P+A+h+B+V.X.Y.Q+R+4+o+S+v+T+ ",
|
||||
" U+V+W+N+X+U.h+B+V.X.Y+Y.,+4+o+Z+`+T+ ",
|
||||
" @.@+@A+h+@@W.X.Y+Y.,+4+G+#@$@%@ ",
|
||||
" &@*@=@V.Y+Y.,+4+o+G+-@;@>@,@ ",
|
||||
" '@)@!@~@{@]@^@/@(@_@:@<@ ",
|
||||
" [@&@&@&@&@&@&@&@&@}@ ",
|
||||
" "};
|
||||
1078
samples/webview_chromium/webview.cpp
Normal file
1078
samples/webview_chromium/webview.cpp
Normal file
File diff suppressed because it is too large
Load diff
44
samples/webview_chromium/webview_chromium.bkl
Normal file
44
samples/webview_chromium/webview_chromium.bkl
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" ?>
|
||||
<makefile>
|
||||
|
||||
<include file="../../build/bakefiles/common_samples.bkl"/>
|
||||
|
||||
<!--specify CEF head files include dir -->
|
||||
<set var="CEF_INCLUDE_DIR">
|
||||
</set>
|
||||
|
||||
<!--specify CEF lib dir-->
|
||||
<set var="CEF_LIB_DIR">
|
||||
<if cond="PLATFORM_WIN32=='1'">
|
||||
$(CEF_INCLUDE_DIR)/Debug/,$(CEF_INCLUDE_DIR)/out/Debug/lib/
|
||||
</if>
|
||||
<if cond="PLATFORM_MACOSX=='1'">
|
||||
<!--TODO -->
|
||||
</if>
|
||||
<if cond="PLATFORM_UNIX=='1'">
|
||||
<!--TODO -->
|
||||
</if>
|
||||
</set>
|
||||
|
||||
<exe id="webview_chromium" template="wx_sample" template_append="wx_append">
|
||||
<sources>
|
||||
webview.cpp
|
||||
</sources>
|
||||
<headers></headers>
|
||||
<wx-lib>webview</wx-lib>
|
||||
<wx-lib>stc</wx-lib>
|
||||
<wx-lib>adv</wx-lib>
|
||||
<wx-lib>core</wx-lib>
|
||||
<wx-lib>base</wx-lib>
|
||||
<lib-path>$(CEF_LIB_DIR)</lib-path>
|
||||
<include>$(CEF_INCLUDE_DIR)</include>
|
||||
<sys-lib>libcef</sys-lib>
|
||||
<sys-lib>libcef_dll_wrapper</sys-lib>
|
||||
<win32-res>../sample.rc</win32-res>
|
||||
|
||||
<if cond="OUT_OF_TREE_MAKEFILES=='0'">
|
||||
<sys-lib>$(LIB_SCINTILLA)</sys-lib>
|
||||
</if>
|
||||
</exe>
|
||||
|
||||
</makefile>
|
||||
84
samples/webview_chromium/wxlogo.xpm
Normal file
84
samples/webview_chromium/wxlogo.xpm
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/* XPM */
|
||||
static const char * wxlogo_xpm[] = {
|
||||
"24 24 57 1",
|
||||
" c None",
|
||||
". c #000006",
|
||||
"+ c #00003F",
|
||||
"@ c #00003C",
|
||||
"# c #000034",
|
||||
"$ c #000000",
|
||||
"% c #00000E",
|
||||
"& c #000085",
|
||||
"* c #000079",
|
||||
"= c #000081",
|
||||
"- c #000070",
|
||||
"; c #00000D",
|
||||
"> c #8686CB",
|
||||
", c #FFFFFF",
|
||||
"' c #000078",
|
||||
") c #000080",
|
||||
"! c #00006F",
|
||||
"~ c #7F7FC7",
|
||||
"{ c #00007F",
|
||||
"] c #000083",
|
||||
"^ c #000088",
|
||||
"/ c #000076",
|
||||
"( c #000047",
|
||||
"_ c #000040",
|
||||
": c #EDED00",
|
||||
"< c #FFFF00",
|
||||
"[ c #202000",
|
||||
"} c #0E0000",
|
||||
"| c #7F0000",
|
||||
"1 c #770000",
|
||||
"2 c #7E0000",
|
||||
"3 c #E0E000",
|
||||
"4 c #FFFF88",
|
||||
"5 c #FFFF3F",
|
||||
"6 c #1E1E00",
|
||||
"7 c #1F0000",
|
||||
"8 c #FF0000",
|
||||
"9 c #FFFF80",
|
||||
"0 c #1E0000",
|
||||
"a c #FF8686",
|
||||
"b c #00000F",
|
||||
"c c #000082",
|
||||
"d c #FFFF7F",
|
||||
"e c #FF7F7F",
|
||||
"f c #000007",
|
||||
"g c #000044",
|
||||
"h c #00003E",
|
||||
"i c #00001F",
|
||||
"j c #DE0000",
|
||||
"k c #E00000",
|
||||
"l c #C30000",
|
||||
"m c #DEDE00",
|
||||
"n c #DD0000",
|
||||
"o c #DDDD00",
|
||||
"p c #EAEA00",
|
||||
"q c #780000",
|
||||
"r c #680000",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .+@@@@@@@#$ ",
|
||||
" %&*======-$ ",
|
||||
" ;>,')))))!$ ",
|
||||
" ;~,')){]^/ ",
|
||||
" ;~,'))=(%;$$$$$$$$",
|
||||
" ;~,'))=_:<<<<<<<<[",
|
||||
"}|1112;~,'))=_345<<<<<<6",
|
||||
"788888;>,'))=_3,9<<<<<<6",
|
||||
"0a,888b&*===c_3,d<<<<<<6",
|
||||
"0e,888fg__h@@i3,d<<<<<<6",
|
||||
"0e,888jkkl$ $m,d<<<<<<6",
|
||||
"0e,888888n$ $o,9<<<<<<6",
|
||||
"0e,888888n$ $o45<<<<<<6",
|
||||
"0a,888888n$ $p<<<<<<<<[",
|
||||
"788888888k$ $$$$$$$$$$",
|
||||
"}|qqqqqqqr$ ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
677
src/common/webview_chromium3.cpp
Normal file
677
src/common/webview_chromium3.cpp
Normal file
|
|
@ -0,0 +1,677 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Author: Steven Lamerton
|
||||
// Copyright: (c) 2013 Steven Lamerton
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/webview_chromium.h"
|
||||
|
||||
#if CEF_API == 3
|
||||
|
||||
#include "wx/webview_chromium.h"
|
||||
|
||||
#include <wx/webview.h>
|
||||
#include <wx/filesys.h>
|
||||
#include <wx/msw/private.h>
|
||||
#include <wx/rtti.h>
|
||||
|
||||
|
||||
#ifdef __VISUALC__
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100)
|
||||
#endif
|
||||
|
||||
#include <include/cef_app.h>
|
||||
#include <include/cef_browser.h>
|
||||
#include <include/cef_string_visitor.h>
|
||||
|
||||
#ifdef __VISUALC__
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
extern const char wxWebViewBackendChromium[] = "wxWebViewChromium";
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewChromium, wxWebView);
|
||||
|
||||
class wxStringVisitor : public CefStringVisitor
|
||||
{
|
||||
public:
|
||||
enum StringType {
|
||||
PAGE_SOURCE,
|
||||
PAGE_TEXT,
|
||||
};
|
||||
wxStringVisitor(wxWebViewChromium* webview, StringType type) : m_webview(webview), m_type(type) {}
|
||||
void Visit(const CefString& string)
|
||||
{
|
||||
switch(m_type)
|
||||
{
|
||||
case PAGE_SOURCE:
|
||||
m_webview->SetPageSource(string.ToWString());
|
||||
break;
|
||||
case PAGE_TEXT:
|
||||
m_webview->SetPageText(string.ToWString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
private:
|
||||
StringType m_type;
|
||||
wxWebViewChromium *m_webview;
|
||||
IMPLEMENT_REFCOUNTING(wxStringVisitor);
|
||||
};
|
||||
|
||||
bool wxWebViewChromium::Create(wxWindow* parent,
|
||||
wxWindowID id,
|
||||
const wxString& url,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
if (!wxControl::Create(parent, id, pos, size, style,
|
||||
wxDefaultValidator, name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_historyLoadingFromList = false;
|
||||
m_historyEnabled = true;
|
||||
m_historyPosition = -1;
|
||||
m_zoomLevel = wxWEBVIEW_ZOOM_MEDIUM;
|
||||
|
||||
CefBrowserSettings browsersettings;
|
||||
CefWindowInfo info;
|
||||
|
||||
m_clientHandler = new ClientHandler();
|
||||
m_clientHandler->SetWebView(this);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Initialize window info to the defaults for a child window
|
||||
info.SetAsChild(GetHWND(), wxGetClientRect(this->GetHWND()));
|
||||
#endif
|
||||
// Creat the new child browser window, we do this async as we use a multi
|
||||
// threaded message loop
|
||||
|
||||
#if CHROME_VERSION_BUILD >= 1650
|
||||
CefBrowserHost::CreateBrowser(info, static_cast<CefRefPtr<CefClient>>(m_clientHandler),
|
||||
url.ToStdString(), browsersettings, NULL);
|
||||
#else
|
||||
CefBrowserHost::CreateBrowser(info, static_cast<CefRefPtr<CefClient>>(m_clientHandler),
|
||||
url.ToStdString(), browsersettings);
|
||||
#endif
|
||||
this->Bind(wxEVT_SIZE, &wxWebViewChromium::OnSize, this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxWebViewChromium::~wxWebViewChromium()
|
||||
{
|
||||
CefRefPtr<CefBrowser> browser = m_clientHandler->GetBrowser();
|
||||
if(browser.get()) {
|
||||
// Let the browser window know we are about to destroy it.
|
||||
browser->GetHost()->ParentWindowWillClose();
|
||||
}
|
||||
}
|
||||
|
||||
void wxWebViewChromium::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
wxSize size = GetClientSize();
|
||||
|
||||
#ifdef __WXMSW__
|
||||
if(m_clientHandler && m_clientHandler->GetBrowser() && m_clientHandler->GetBrowser()->GetHost())
|
||||
{
|
||||
HWND handle = m_clientHandler->GetBrowser()->GetHost()->GetWindowHandle();
|
||||
|
||||
if(handle)
|
||||
{
|
||||
HDWP hdwp = BeginDeferWindowPos(1);
|
||||
hdwp = DeferWindowPos(hdwp, handle, NULL, 0, 0,
|
||||
size.GetWidth(), size.GetHeight(), SWP_NOZORDER);
|
||||
EndDeferWindowPos(hdwp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxWebViewChromium::SetPageSource(const wxString& pageSource)
|
||||
{
|
||||
m_pageSource = pageSource;
|
||||
}
|
||||
|
||||
void wxWebViewChromium::SetPageText(const wxString& pageText)
|
||||
{
|
||||
m_pageText = pageText;
|
||||
}
|
||||
|
||||
void* wxWebViewChromium::GetNativeBackend() const
|
||||
{
|
||||
return m_clientHandler->GetBrowser();
|
||||
}
|
||||
|
||||
bool wxWebViewChromium::CanGoForward() const
|
||||
{
|
||||
if(m_historyEnabled)
|
||||
return m_historyPosition != static_cast<int>(m_historyList.size()) - 1;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxWebViewChromium::CanGoBack() const
|
||||
{
|
||||
if(m_historyEnabled)
|
||||
return m_historyPosition > 0;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void wxWebViewChromium::LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item)
|
||||
{
|
||||
int pos = -1;
|
||||
for(unsigned int i = 0; i < m_historyList.size(); i++)
|
||||
{
|
||||
//We compare the actual pointers to find the correct item
|
||||
if(m_historyList[i].get() == item.get())
|
||||
pos = i;
|
||||
}
|
||||
wxASSERT_MSG(pos != static_cast<int>(m_historyList.size()),
|
||||
"invalid history item");
|
||||
m_historyLoadingFromList = true;
|
||||
LoadURL(item->GetUrl());
|
||||
m_historyPosition = pos;
|
||||
}
|
||||
|
||||
wxVector<wxSharedPtr<wxWebViewHistoryItem> > wxWebViewChromium::GetBackwardHistory()
|
||||
{
|
||||
wxVector<wxSharedPtr<wxWebViewHistoryItem> > backhist;
|
||||
//As we don't have std::copy or an iterator constructor in the wxwidgets
|
||||
//native vector we construct it by hand
|
||||
for(int i = 0; i < m_historyPosition; i++)
|
||||
{
|
||||
backhist.push_back(m_historyList[i]);
|
||||
}
|
||||
return backhist;
|
||||
}
|
||||
|
||||
wxVector<wxSharedPtr<wxWebViewHistoryItem> > wxWebViewChromium::GetForwardHistory()
|
||||
{
|
||||
wxVector<wxSharedPtr<wxWebViewHistoryItem> > forwardhist;
|
||||
//As we don't have std::copy or an iterator constructor in the wxwidgets
|
||||
//native vector we construct it by hand
|
||||
for(int i = m_historyPosition + 1; i < static_cast<int>(m_historyList.size()); i++)
|
||||
{
|
||||
forwardhist.push_back(m_historyList[i]);
|
||||
}
|
||||
return forwardhist;
|
||||
}
|
||||
|
||||
void wxWebViewChromium::GoBack()
|
||||
{
|
||||
LoadHistoryItem(m_historyList[m_historyPosition - 1]);
|
||||
}
|
||||
|
||||
void wxWebViewChromium::GoForward()
|
||||
{
|
||||
LoadHistoryItem(m_historyList[m_historyPosition + 1]);
|
||||
}
|
||||
|
||||
void wxWebViewChromium::LoadURL(const wxString& url)
|
||||
{
|
||||
m_clientHandler->GetBrowser()->GetMainFrame()->LoadURL(url.ToStdString());
|
||||
}
|
||||
|
||||
void wxWebViewChromium::ClearHistory()
|
||||
{
|
||||
m_historyList.clear();
|
||||
m_historyPosition = -1;
|
||||
}
|
||||
|
||||
void wxWebViewChromium::EnableHistory(bool enable)
|
||||
{
|
||||
m_historyEnabled = enable;
|
||||
}
|
||||
|
||||
void wxWebViewChromium::Stop()
|
||||
{
|
||||
m_clientHandler->GetBrowser()->StopLoad();
|
||||
}
|
||||
|
||||
void wxWebViewChromium::Reload(wxWebViewReloadFlags flags)
|
||||
{
|
||||
if(flags == wxWEBVIEW_RELOAD_NO_CACHE)
|
||||
{
|
||||
m_clientHandler->GetBrowser()->ReloadIgnoreCache();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_clientHandler->GetBrowser()->Reload();
|
||||
}
|
||||
}
|
||||
|
||||
wxString wxWebViewChromium::GetPageSource() const
|
||||
{
|
||||
//m_clientHandler->GetBrowser()->GetHost()->Find
|
||||
return m_pageSource;
|
||||
}
|
||||
|
||||
wxString wxWebViewChromium::GetPageText() const
|
||||
{
|
||||
return m_pageText;
|
||||
}
|
||||
|
||||
wxString wxWebViewChromium::GetCurrentURL() const
|
||||
{
|
||||
return m_clientHandler->GetBrowser()->GetMainFrame()->GetURL().ToString();
|
||||
}
|
||||
|
||||
wxString wxWebViewChromium::GetCurrentTitle() const
|
||||
{
|
||||
return m_title;
|
||||
}
|
||||
|
||||
void wxWebViewChromium::Print()
|
||||
{
|
||||
#if CHROME_VERSION_BUILD >= 1650
|
||||
m_clientHandler->GetBrowser()->GetHost()->Print();
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxWebViewChromium::Cut()
|
||||
{
|
||||
m_clientHandler->GetBrowser()->GetMainFrame()->Cut();
|
||||
}
|
||||
|
||||
void wxWebViewChromium::Copy()
|
||||
{
|
||||
m_clientHandler->GetBrowser()->GetMainFrame()->Copy();
|
||||
}
|
||||
|
||||
void wxWebViewChromium::Paste()
|
||||
{
|
||||
m_clientHandler->GetBrowser()->GetMainFrame()->Paste();
|
||||
}
|
||||
|
||||
void wxWebViewChromium::Undo()
|
||||
{
|
||||
m_clientHandler->GetBrowser()->GetMainFrame()->Undo();
|
||||
}
|
||||
|
||||
void wxWebViewChromium::Redo()
|
||||
{
|
||||
m_clientHandler->GetBrowser()->GetMainFrame()->Redo();
|
||||
}
|
||||
|
||||
void wxWebViewChromium::SelectAll()
|
||||
{
|
||||
m_clientHandler->GetBrowser()->GetMainFrame()->SelectAll();
|
||||
}
|
||||
|
||||
void wxWebViewChromium::DeleteSelection()
|
||||
{
|
||||
wxString jsdelete = "if (window.getSelection) { if (window.getSelection().deleteFromDocument) { window.getSelection().deleteFromDocument(); } }";
|
||||
RunScript(jsdelete);
|
||||
}
|
||||
|
||||
void wxWebViewChromium::ClearSelection()
|
||||
{
|
||||
wxString jsclear = "if (window.getSelection) { if (window.getSelection().empty) { window.getSelection().empty(); } }";
|
||||
RunScript(jsclear);
|
||||
}
|
||||
|
||||
void wxWebViewChromium::RunScript(const wxString& javascript)
|
||||
{
|
||||
m_clientHandler->GetBrowser()->GetMainFrame()->ExecuteJavaScript(javascript.ToStdString(),
|
||||
"", 0);
|
||||
}
|
||||
|
||||
bool wxWebViewChromium::IsBusy() const
|
||||
{
|
||||
if(m_clientHandler->GetBrowser())
|
||||
return m_clientHandler->GetBrowser()->IsLoading();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void wxWebViewChromium::SetEditable(bool enable)
|
||||
{
|
||||
wxString mode = enable ? "\"on\"" : "\"off\"";
|
||||
RunScript("document.designMode = " + mode);
|
||||
}
|
||||
|
||||
void wxWebViewChromium::DoSetPage(const wxString& html, const wxString& baseUrl)
|
||||
{
|
||||
m_clientHandler->GetBrowser()->GetMainFrame()->LoadString(html.ToStdString(),
|
||||
baseUrl.ToStdString());
|
||||
}
|
||||
|
||||
wxWebViewZoom wxWebViewChromium::GetZoom() const
|
||||
{
|
||||
return m_zoomLevel;
|
||||
}
|
||||
|
||||
|
||||
void wxWebViewChromium::SetZoom(wxWebViewZoom zoom)
|
||||
{
|
||||
m_zoomLevel = zoom;
|
||||
|
||||
double mapzoom;
|
||||
// arbitrary way to map our common zoom enum to float zoom
|
||||
switch (zoom)
|
||||
{
|
||||
case wxWEBVIEW_ZOOM_TINY:
|
||||
mapzoom = -1.0;
|
||||
break;
|
||||
|
||||
case wxWEBVIEW_ZOOM_SMALL:
|
||||
mapzoom = -0.5;
|
||||
break;
|
||||
|
||||
case wxWEBVIEW_ZOOM_MEDIUM:
|
||||
mapzoom = 0.0;
|
||||
break;
|
||||
|
||||
case wxWEBVIEW_ZOOM_LARGE:
|
||||
mapzoom = 0.5;
|
||||
break;
|
||||
|
||||
case wxWEBVIEW_ZOOM_LARGEST:
|
||||
mapzoom = 1.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
wxASSERT(false);
|
||||
}
|
||||
m_clientHandler->GetBrowser()->GetHost()->SetZoomLevel(mapzoom);
|
||||
}
|
||||
|
||||
void wxWebViewChromium::SetZoomType(wxWebViewZoomType type)
|
||||
{
|
||||
// there is only one supported zoom type at the moment so this setter
|
||||
// does nothing beyond checking sanity
|
||||
wxASSERT(type == wxWEBVIEW_ZOOM_TYPE_LAYOUT);
|
||||
}
|
||||
|
||||
wxWebViewZoomType wxWebViewChromium::GetZoomType() const
|
||||
{
|
||||
return wxWEBVIEW_ZOOM_TYPE_LAYOUT;
|
||||
}
|
||||
|
||||
bool wxWebViewChromium::CanSetZoomType(wxWebViewZoomType type) const
|
||||
{
|
||||
return type == wxWEBVIEW_ZOOM_TYPE_LAYOUT;
|
||||
}
|
||||
|
||||
void wxWebViewChromium::RegisterHandler(wxSharedPtr<wxWebViewHandler> handler)
|
||||
{
|
||||
// We currently don't support custom scheme handlers
|
||||
}
|
||||
|
||||
bool wxWebViewChromium::StartUp(int &code, const wxString &path)
|
||||
{
|
||||
CefMainArgs args(wxGetInstance());
|
||||
|
||||
// If there is no subprocess then we need to execute on this process
|
||||
if(path == "")
|
||||
{
|
||||
code = CefExecuteProcess(args, NULL);
|
||||
if(code >= 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
CefSettings settings;
|
||||
// We use a multithreaded message loop so we don't have to integrate
|
||||
// with the wx message loop
|
||||
settings.multi_threaded_message_loop = true;
|
||||
CefString(&settings.browser_subprocess_path) = path.ToStdString();
|
||||
|
||||
return CefInitialize(args, settings, NULL);
|
||||
}
|
||||
|
||||
int wxWebViewChromium::StartUpSubprocess()
|
||||
{
|
||||
CefMainArgs args(wxGetInstance());
|
||||
|
||||
return CefExecuteProcess(args, NULL);
|
||||
}
|
||||
|
||||
void wxWebViewChromium::Shutdown()
|
||||
{
|
||||
CefShutdown();
|
||||
}
|
||||
|
||||
// CefDisplayHandler methods
|
||||
void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser, bool isLoading,
|
||||
bool canGoBack, bool canGoForward)
|
||||
{}
|
||||
|
||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
const CefString& url)
|
||||
{}
|
||||
|
||||
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser, const CefString& title)
|
||||
{
|
||||
m_webview->m_title = title.ToWString();
|
||||
wxString target = browser->GetMainFrame()->GetName().ToString();
|
||||
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEBVIEW_TITLE_CHANGED, m_webview->GetId(), "", target);
|
||||
event.SetString(title.ToWString());
|
||||
event.SetEventObject(m_webview);
|
||||
|
||||
m_webview->HandleWindowEvent(event);
|
||||
}
|
||||
|
||||
bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser, const CefString& message,
|
||||
const CefString& source, int line)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// CefContextMenuHandler methods
|
||||
void ClientHandler::OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
CefRefPtr<CefMenuModel> model)
|
||||
{
|
||||
if(!m_webview->IsContextMenuEnabled())
|
||||
model->Clear();
|
||||
}
|
||||
|
||||
bool ClientHandler::OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
int command_id,
|
||||
CefContextMenuHandler::EventFlags event_flags)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientHandler::OnContextMenuDismissed(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
{}
|
||||
|
||||
// CefLifeSpanHandler methods
|
||||
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)
|
||||
{
|
||||
wxWebViewEvent *event = new wxWebViewEvent(wxEVT_WEBVIEW_NEWWINDOW,
|
||||
m_webview->GetId(),
|
||||
target_url.ToString(),
|
||||
target_frame_name.ToString());
|
||||
event->SetEventObject(m_webview);
|
||||
// We use queue event as this function is called on the render thread
|
||||
m_webview->GetEventHandler()->QueueEvent(event);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser)
|
||||
{
|
||||
if(!m_browser.get())
|
||||
{
|
||||
m_browser = browser;
|
||||
m_browserId = browser->GetIdentifier();
|
||||
}
|
||||
}
|
||||
bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser)
|
||||
{
|
||||
if(browser->GetIdentifier() == m_browserId)
|
||||
{
|
||||
m_browser = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// CefLoadHandler methods
|
||||
void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
{
|
||||
wxString url = frame->GetURL().ToString();
|
||||
wxString target = frame->GetName().ToString();
|
||||
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEBVIEW_NAVIGATING, m_webview->GetId(), url, target);
|
||||
event.SetEventObject(m_webview);
|
||||
|
||||
m_webview->HandleWindowEvent(event);
|
||||
|
||||
if (!event.IsAllowed())
|
||||
{
|
||||
// We do not yet have support for vetoing pages
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode)
|
||||
{
|
||||
wxString url = frame->GetURL().ToString();
|
||||
wxString target = frame->GetName().ToString();
|
||||
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEBVIEW_NAVIGATED, m_webview->GetId(), url, target);
|
||||
event.SetEventObject(m_webview);
|
||||
|
||||
m_webview->HandleWindowEvent(event);
|
||||
|
||||
if(frame->IsMain())
|
||||
{
|
||||
//Get source code when main frame loads ended.
|
||||
CefRefPtr<CefStringVisitor> source_visitor = new wxStringVisitor(
|
||||
m_webview, wxStringVisitor::PAGE_SOURCE);
|
||||
frame->GetSource(source_visitor);
|
||||
|
||||
//Get page text when main frame loads ended.
|
||||
CefRefPtr<CefStringVisitor> text_visitor = new wxStringVisitor(
|
||||
m_webview, wxStringVisitor::PAGE_TEXT);
|
||||
frame->GetText(text_visitor);
|
||||
|
||||
//As we are complete we also add to the history list, but not if the
|
||||
//page is not the main page, ie it is a subframe
|
||||
if(m_webview->m_historyEnabled && !m_webview->m_historyLoadingFromList)
|
||||
{
|
||||
//If we are not at the end of the list, then erase everything
|
||||
//between us and the end before adding the new page
|
||||
if(m_webview->m_historyPosition != static_cast<int>(m_webview->m_historyList.size()) - 1)
|
||||
{
|
||||
m_webview->m_historyList.erase(m_webview->m_historyList.begin() + m_webview->m_historyPosition + 1,
|
||||
m_webview->m_historyList.end());
|
||||
}
|
||||
wxSharedPtr<wxWebViewHistoryItem> item(new wxWebViewHistoryItem(url, m_webview->GetCurrentTitle()));
|
||||
m_webview->m_historyList.push_back(item);
|
||||
m_webview->m_historyPosition++;
|
||||
}
|
||||
//Reset as we are done now
|
||||
m_webview->m_historyLoadingFromList = false;
|
||||
|
||||
wxWebViewEvent levent(wxEVT_COMMAND_WEBVIEW_LOADED, m_webview->GetId(), url, target);
|
||||
levent.SetEventObject(m_webview);
|
||||
|
||||
m_webview->HandleWindowEvent(levent);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl)
|
||||
{
|
||||
//We define a macro for convenience
|
||||
#define ERROR_TYPE_CASE(error, wxtype) case(error): \
|
||||
type = wxtype;\
|
||||
break
|
||||
|
||||
wxWebViewNavigationError type = wxWEBVIEW_NAV_ERR_OTHER;
|
||||
switch (errorCode)
|
||||
{
|
||||
ERROR_TYPE_CASE(ERR_FAILED, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_ABORTED, wxWEBVIEW_NAV_ERR_USER_CANCELLED);
|
||||
ERROR_TYPE_CASE(ERR_INVALID_ARGUMENT, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_INVALID_HANDLE, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_FILE_NOT_FOUND, wxWEBVIEW_NAV_ERR_NOT_FOUND);
|
||||
ERROR_TYPE_CASE(ERR_TIMED_OUT, wxWEBVIEW_NAV_ERR_CONNECTION);
|
||||
ERROR_TYPE_CASE(ERR_FILE_TOO_BIG, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_UNEXPECTED, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_ACCESS_DENIED, wxWEBVIEW_NAV_ERR_AUTH);
|
||||
ERROR_TYPE_CASE(ERR_NOT_IMPLEMENTED, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_CONNECTION_CLOSED, wxWEBVIEW_NAV_ERR_CONNECTION);
|
||||
ERROR_TYPE_CASE(ERR_CONNECTION_RESET, wxWEBVIEW_NAV_ERR_CONNECTION);
|
||||
ERROR_TYPE_CASE(ERR_CONNECTION_REFUSED, wxWEBVIEW_NAV_ERR_CONNECTION);
|
||||
ERROR_TYPE_CASE(ERR_CONNECTION_ABORTED, wxWEBVIEW_NAV_ERR_CONNECTION);
|
||||
ERROR_TYPE_CASE(ERR_CONNECTION_FAILED, wxWEBVIEW_NAV_ERR_CONNECTION);
|
||||
ERROR_TYPE_CASE(ERR_NAME_NOT_RESOLVED, wxWEBVIEW_NAV_ERR_CONNECTION);
|
||||
ERROR_TYPE_CASE(ERR_INTERNET_DISCONNECTED, wxWEBVIEW_NAV_ERR_CONNECTION);
|
||||
ERROR_TYPE_CASE(ERR_SSL_PROTOCOL_ERROR, wxWEBVIEW_NAV_ERR_SECURITY);
|
||||
ERROR_TYPE_CASE(ERR_ADDRESS_INVALID, wxWEBVIEW_NAV_ERR_REQUEST);
|
||||
ERROR_TYPE_CASE(ERR_ADDRESS_UNREACHABLE, wxWEBVIEW_NAV_ERR_CONNECTION);
|
||||
ERROR_TYPE_CASE(ERR_SSL_CLIENT_AUTH_CERT_NEEDED, wxWEBVIEW_NAV_ERR_AUTH);
|
||||
ERROR_TYPE_CASE(ERR_TUNNEL_CONNECTION_FAILED, wxWEBVIEW_NAV_ERR_CONNECTION);
|
||||
ERROR_TYPE_CASE(ERR_NO_SSL_VERSIONS_ENABLED, wxWEBVIEW_NAV_ERR_SECURITY);
|
||||
ERROR_TYPE_CASE(ERR_SSL_VERSION_OR_CIPHER_MISMATCH, wxWEBVIEW_NAV_ERR_SECURITY);
|
||||
ERROR_TYPE_CASE(ERR_SSL_RENEGOTIATION_REQUESTED, wxWEBVIEW_NAV_ERR_REQUEST);
|
||||
ERROR_TYPE_CASE(ERR_CERT_COMMON_NAME_INVALID, wxWEBVIEW_NAV_ERR_CERTIFICATE);
|
||||
ERROR_TYPE_CASE(ERR_CERT_DATE_INVALID, wxWEBVIEW_NAV_ERR_CERTIFICATE);
|
||||
ERROR_TYPE_CASE(ERR_CERT_AUTHORITY_INVALID, wxWEBVIEW_NAV_ERR_CERTIFICATE);
|
||||
ERROR_TYPE_CASE(ERR_CERT_CONTAINS_ERRORS, wxWEBVIEW_NAV_ERR_CERTIFICATE);
|
||||
ERROR_TYPE_CASE(ERR_CERT_NO_REVOCATION_MECHANISM, wxWEBVIEW_NAV_ERR_CERTIFICATE);
|
||||
ERROR_TYPE_CASE(ERR_CERT_UNABLE_TO_CHECK_REVOCATION, wxWEBVIEW_NAV_ERR_CERTIFICATE);
|
||||
ERROR_TYPE_CASE(ERR_CERT_REVOKED, wxWEBVIEW_NAV_ERR_CERTIFICATE);
|
||||
ERROR_TYPE_CASE(ERR_CERT_INVALID, wxWEBVIEW_NAV_ERR_CERTIFICATE);
|
||||
ERROR_TYPE_CASE(ERR_CERT_END, wxWEBVIEW_NAV_ERR_CERTIFICATE);
|
||||
ERROR_TYPE_CASE(ERR_INVALID_URL, wxWEBVIEW_NAV_ERR_REQUEST);
|
||||
ERROR_TYPE_CASE(ERR_DISALLOWED_URL_SCHEME, wxWEBVIEW_NAV_ERR_REQUEST);
|
||||
ERROR_TYPE_CASE(ERR_UNKNOWN_URL_SCHEME, wxWEBVIEW_NAV_ERR_REQUEST);
|
||||
ERROR_TYPE_CASE(ERR_TOO_MANY_REDIRECTS, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_UNSAFE_REDIRECT, wxWEBVIEW_NAV_ERR_SECURITY);
|
||||
ERROR_TYPE_CASE(ERR_UNSAFE_PORT, wxWEBVIEW_NAV_ERR_SECURITY);
|
||||
ERROR_TYPE_CASE(ERR_INVALID_RESPONSE, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_INVALID_CHUNKED_ENCODING, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_METHOD_NOT_SUPPORTED, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_UNEXPECTED_PROXY_AUTH, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_EMPTY_RESPONSE, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_RESPONSE_HEADERS_TOO_BIG, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_CACHE_MISS, wxWEBVIEW_NAV_ERR_OTHER);
|
||||
ERROR_TYPE_CASE(ERR_INSECURE_RESPONSE, wxWEBVIEW_NAV_ERR_SECURITY);
|
||||
}
|
||||
|
||||
wxString url = failedUrl.ToString();
|
||||
wxString target = frame->GetName().ToString();
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEBVIEW_ERROR, m_webview->GetId(), url, target);
|
||||
event.SetEventObject(m_webview);
|
||||
event.SetInt(type);
|
||||
event.SetString(errorText.ToString());
|
||||
|
||||
m_webview->HandleWindowEvent(event);
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue