mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add DLL build support and wrapper that allows clients to transparently switch between static and dynamic CEF builds.
- The libcef project now builds libcef_static.lib instead of libcef.lib. - The libcef_dll project builds libcef.lib and libcef.dll. This DLL exports the new CEF C API defined in cef_capi.h, cef_nplugin_capi.h, cef_string.h and cef_string_map.h. - The libcef_dll_wrapper project builds libcef_dll_wrapper.lib. This static library wraps the new C API calls with an implementation of the CEF C++ interface as defined in cef.h and cef_nplugin.h. - The cefclient project now uses the DLL instead of the static library. - Type definitions have been moved from cef.h to cef_types.h so that they can be shared by both cef.h and cef_capi.h. This change required some enumeration member name modifications throughout the code base. - Fixed variable naming inconsistencies. - Added CefVariant::GetArraySize() method and _NPN_ArrayObjectGetVectorSize() function. - Remove the ProjectSection(WebsiteProperties) sections from cef.sln to improve VS2005 performance. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@16 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
191
include/cef.h
191
include/cef.h
@@ -31,12 +31,13 @@
|
||||
#ifndef _CEF_H
|
||||
#define _CEF_H
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "cef_ptr.h"
|
||||
#include "cef_types.h"
|
||||
|
||||
|
||||
|
||||
// This function should only be called once when the application is started.
|
||||
// Create the thread to host the UI message loop. A return value of true
|
||||
// indicates that it succeeded and false indicates that it failed. Set
|
||||
@@ -177,11 +178,7 @@ public:
|
||||
|
||||
// Define frame target types. Using TF_FOCUSED will target the focused
|
||||
// frame and using TF_MAIN will target the main frame.
|
||||
enum TargetFrame
|
||||
{
|
||||
TF_FOCUSED = 0,
|
||||
TF_MAIN = 1
|
||||
};
|
||||
typedef cef_targetframe_t TargetFrame;
|
||||
|
||||
// Execute undo in the target frame.
|
||||
virtual void Undo(TargetFrame targetFrame) =0;
|
||||
@@ -232,11 +229,11 @@ public:
|
||||
// found, if any. The renderer may request this URL to show the developer the
|
||||
// source of the error. The |start_line| parameter is the base line number
|
||||
// to use for error reporting.
|
||||
virtual void ExecuteJavaScript(const std::wstring& js_code,
|
||||
const std::wstring& script_url,
|
||||
int start_line, TargetFrame targetFrame) =0;
|
||||
virtual void ExecuteJavaScript(const std::wstring& jsCode,
|
||||
const std::wstring& scriptUrl,
|
||||
int startLine, TargetFrame targetFrame) =0;
|
||||
|
||||
// Register a new handler tied to the specified JS object |name|. Returns
|
||||
// Register a new handler tied to the specified JS object |name|. Returns
|
||||
// true if the handler is registered successfully.
|
||||
// A JS handler will be accessible to JavaScript as window.<classname>.
|
||||
virtual bool AddJSHandler(const std::wstring& classname,
|
||||
@@ -281,11 +278,7 @@ public:
|
||||
// processing is required. Returning RV_CONTINUE indicates that the
|
||||
// implementation did not handle the method and that the default handler
|
||||
// should be called.
|
||||
enum RetVal
|
||||
{
|
||||
RV_HANDLED = 0,
|
||||
RV_CONTINUE = 1
|
||||
};
|
||||
typedef cef_retval_t RetVal;
|
||||
|
||||
// Event called before a new window is created. The |parentBrowser| parameter
|
||||
// will point to the parent browser window, if any. The |popup| parameter
|
||||
@@ -296,7 +289,7 @@ public:
|
||||
// same handler as the parent window. To change the handler for the new
|
||||
// window modify the object that |handler| points to.
|
||||
virtual RetVal HandleBeforeCreated(CefRefPtr<CefBrowser> parentBrowser,
|
||||
CefWindowInfo& createInfo, bool popup,
|
||||
CefWindowInfo& windowInfo, bool popup,
|
||||
CefRefPtr<CefHandler>& handler,
|
||||
std::wstring& url) =0;
|
||||
|
||||
@@ -315,15 +308,7 @@ public:
|
||||
const std::wstring& title) =0;
|
||||
|
||||
// Various browser navigation types supported by chrome.
|
||||
enum NavType
|
||||
{
|
||||
NAVTYPE_LINKCLICKED = 0,
|
||||
NAVTYPE_FORMSUBMITTED,
|
||||
NAVTYPE_BACKFORWARD,
|
||||
NAVTYPE_RELOAD,
|
||||
NAVTYPE_FORMRESUBMITTED,
|
||||
NAVTYPE_OTHER
|
||||
};
|
||||
typedef cef_handler_navtype_t NavType;
|
||||
|
||||
// Event called before browser navigation. The client has an opportunity to
|
||||
// modify the |request| object if desired. Return RV_HANDLED to cancel
|
||||
@@ -343,57 +328,7 @@ public:
|
||||
|
||||
// Supported error code values. See net\base\net_error_list.h for complete
|
||||
// descriptions of the error codes.
|
||||
enum ErrorCode
|
||||
{
|
||||
ERR_FAILED = -2,
|
||||
ERR_ABORTED = -3,
|
||||
ERR_INVALID_ARGUMENT = -4,
|
||||
ERR_INVALID_HANDLE = -5,
|
||||
ERR_FILE_NOT_FOUND = -6,
|
||||
ERR_TIMED_OUT = -7,
|
||||
ERR_FILE_TOO_BIG = -8,
|
||||
ERR_UNEXPECTED = -9,
|
||||
ERR_ACCESS_DENIED = -10,
|
||||
ERR_NOT_IMPLEMENTED = -11,
|
||||
ERR_CONNECTION_CLOSED = -100,
|
||||
ERR_CONNECTION_RESET = -101,
|
||||
ERR_CONNECTION_REFUSED = -102,
|
||||
ERR_CONNECTION_ABORTED = -103,
|
||||
ERR_CONNECTION_FAILED = -104,
|
||||
ERR_NAME_NOT_RESOLVED = -105,
|
||||
ERR_INTERNET_DISCONNECTED = -106,
|
||||
ERR_SSL_PROTOCOL_ERROR = -107,
|
||||
ERR_ADDRESS_INVALID = -108,
|
||||
ERR_ADDRESS_UNREACHABLE = -109,
|
||||
ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110,
|
||||
ERR_TUNNEL_CONNECTION_FAILED = -111,
|
||||
ERR_NO_SSL_VERSIONS_ENABLED = -112,
|
||||
ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113,
|
||||
ERR_SSL_RENEGOTIATION_REQUESTED = -114,
|
||||
ERR_CERT_COMMON_NAME_INVALID = -200,
|
||||
ERR_CERT_DATE_INVALID = -201,
|
||||
ERR_CERT_AUTHORITY_INVALID = -202,
|
||||
ERR_CERT_CONTAINS_ERRORS = -203,
|
||||
ERR_CERT_NO_REVOCATION_MECHANISM = -204,
|
||||
ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205,
|
||||
ERR_CERT_REVOKED = -206,
|
||||
ERR_CERT_INVALID = -207,
|
||||
ERR_CERT_END = -208,
|
||||
ERR_INVALID_URL = -300,
|
||||
ERR_DISALLOWED_URL_SCHEME = -301,
|
||||
ERR_UNKNOWN_URL_SCHEME = -302,
|
||||
ERR_TOO_MANY_REDIRECTS = -310,
|
||||
ERR_UNSAFE_REDIRECT = -311,
|
||||
ERR_UNSAFE_PORT = -312,
|
||||
ERR_INVALID_RESPONSE = -320,
|
||||
ERR_INVALID_CHUNKED_ENCODING = -321,
|
||||
ERR_METHOD_NOT_SUPPORTED = -322,
|
||||
ERR_UNEXPECTED_PROXY_AUTH = -323,
|
||||
ERR_EMPTY_RESPONSE = -324,
|
||||
ERR_RESPONSE_HEADERS_TOO_BIG = -325,
|
||||
ERR_CACHE_MISS = -400,
|
||||
ERR_INSECURE_RESPONSE = -501,
|
||||
};
|
||||
typedef cef_handler_errorcode_t ErrorCode;
|
||||
|
||||
// Called when the browser fails to load a resource. |errorCode is the
|
||||
// error code number and |failedUrl| is the URL that failed to load. To
|
||||
@@ -417,79 +352,16 @@ public:
|
||||
std::wstring& mimeType,
|
||||
int loadFlags) =0;
|
||||
|
||||
// Structure representing menu information
|
||||
struct MenuInfo
|
||||
{
|
||||
int typeFlags;
|
||||
int x;
|
||||
int y;
|
||||
std::wstring linkUrl;
|
||||
std::wstring imageUrl;
|
||||
std::wstring pageUrl;
|
||||
std::wstring frameUrl;
|
||||
std::wstring selectionText;
|
||||
std::wstring misspelledWord;
|
||||
int editFlags;
|
||||
std::string securityInfo;
|
||||
};
|
||||
|
||||
// The MenuInfo typeFlags value will be a combination of the following
|
||||
enum MenuTypeBits {
|
||||
// No node is selected
|
||||
MENUTYPE_NONE = 0x0,
|
||||
// The top page is selected
|
||||
MENUTYPE_PAGE = 0x1,
|
||||
// A subframe page is selected
|
||||
MENUTYPE_FRAME = 0x2,
|
||||
// A link is selected
|
||||
MENUTYPE_LINK = 0x4,
|
||||
// An image is selected
|
||||
MENUTYPE_IMAGE = 0x8,
|
||||
// There is a textual or mixed selection that is selected
|
||||
MENUTYPE_SELECTION = 0x10,
|
||||
// An editable element is selected
|
||||
MENUTYPE_EDITABLE = 0x20,
|
||||
// A misspelled word is selected
|
||||
MENUTYPE_MISSPELLED_WORD = 0x40,
|
||||
};
|
||||
|
||||
// The MenuInfo editFlags value will be a combination of the following
|
||||
enum MenuCapabilityBits
|
||||
{
|
||||
CAN_DO_NONE = 0x0,
|
||||
CAN_UNDO = 0x1,
|
||||
CAN_REDO = 0x2,
|
||||
CAN_CUT = 0x4,
|
||||
CAN_COPY = 0x8,
|
||||
CAN_PASTE = 0x10,
|
||||
CAN_DELETE = 0x20,
|
||||
CAN_SELECT_ALL = 0x40,
|
||||
CAN_GO_FORWARD = 0x80,
|
||||
CAN_GO_BACK = 0x100,
|
||||
};
|
||||
// Structure representing menu information.
|
||||
typedef cef_handler_menuinfo_t MenuInfo;
|
||||
|
||||
// Event called before a context menu is displayed. To cancel display of the
|
||||
// default context menu return RV_HANDLED.
|
||||
virtual RetVal HandleBeforeMenu(CefRefPtr<CefBrowser> browser,
|
||||
const MenuInfo& menuInfo) =0;
|
||||
|
||||
// Supported menu ID values
|
||||
enum MenuId
|
||||
{
|
||||
ID_NAV_BACK = 10,
|
||||
ID_NAV_FORWARD = 11,
|
||||
ID_NAV_RELOAD = 12,
|
||||
ID_NAV_STOP = 13,
|
||||
ID_UNDO = 20,
|
||||
ID_REDO = 21,
|
||||
ID_CUT = 22,
|
||||
ID_COPY = 23,
|
||||
ID_PASTE = 24,
|
||||
ID_DELETE = 25,
|
||||
ID_SELECTALL = 26,
|
||||
ID_PRINT = 30,
|
||||
ID_VIEWSOURCE = 31,
|
||||
};
|
||||
// Supported menu ID values.
|
||||
typedef cef_handler_menuid_t MenuId;
|
||||
|
||||
// Event called to optionally override the default text for a context menu
|
||||
// item. |label| contains the default text and may be modified to substitute
|
||||
@@ -541,7 +413,7 @@ public:
|
||||
// |result| to the resulting value.
|
||||
virtual RetVal HandleJSPrompt(CefRefPtr<CefBrowser> browser,
|
||||
const std::wstring& message,
|
||||
const std::wstring& default_value,
|
||||
const std::wstring& defaultValue,
|
||||
bool& retval,
|
||||
std::wstring& result) =0;
|
||||
|
||||
@@ -563,7 +435,7 @@ public:
|
||||
|
||||
// Optional name of the target frame.
|
||||
virtual std::wstring GetFrame() =0;
|
||||
virtual void SetFrame(const std::wstring& url) =0;
|
||||
virtual void SetFrame(const std::wstring& frame) =0;
|
||||
|
||||
// Optional request method type, defaulting to POST if post data is provided
|
||||
// and GET otherwise.
|
||||
@@ -606,8 +478,7 @@ public:
|
||||
// succeeds.
|
||||
virtual bool RemoveElement(CefRefPtr<CefPostDataElement> element) =0;
|
||||
|
||||
// Add the specified post data element. Returns true if the add
|
||||
// succeeds.
|
||||
// Add the specified post data element. Returns true if the add succeeds.
|
||||
virtual bool AddElement(CefRefPtr<CefPostDataElement> element) =0;
|
||||
|
||||
// Remove all existing post data elements.
|
||||
@@ -620,12 +491,7 @@ class CefPostDataElement : public CefBase
|
||||
{
|
||||
public:
|
||||
// Post data elements may represent either bytes or files.
|
||||
enum Type
|
||||
{
|
||||
TYPE_EMPTY = 0,
|
||||
TYPE_BYTES,
|
||||
TYPE_FILE
|
||||
};
|
||||
typedef cef_postdataelement_type_t Type;
|
||||
|
||||
// Create a new CefPostDataElement object.
|
||||
static CefRefPtr<CefPostDataElement> CreatePostDataElement();
|
||||
@@ -733,18 +599,7 @@ public:
|
||||
class CefVariant : public CefBase
|
||||
{
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
TYPE_NULL = 0,
|
||||
TYPE_BOOL,
|
||||
TYPE_INT,
|
||||
TYPE_DOUBLE,
|
||||
TYPE_STRING,
|
||||
TYPE_BOOL_ARRAY,
|
||||
TYPE_INT_ARRAY,
|
||||
TYPE_DOUBLE_ARRAY,
|
||||
TYPE_STRING_ARRAY
|
||||
};
|
||||
typedef cef_variant_type_t Type;
|
||||
|
||||
// Return the variant data type.
|
||||
virtual Type GetType() =0;
|
||||
@@ -769,6 +624,10 @@ public:
|
||||
virtual bool GetIntArray(std::vector<int>& val) =0;
|
||||
virtual bool GetDoubleArray(std::vector<double>& val) =0;
|
||||
virtual bool GetStringArray(std::vector<std::wstring>& val) =0;
|
||||
|
||||
// Returns the number of values in the array. Returns -1 if the variant
|
||||
// is not an array type.
|
||||
virtual int GetArraySize() =0;
|
||||
};
|
||||
|
||||
#endif // _CEF_H
|
||||
|
620
include/cef_capi.h
Normal file
620
include/cef_capi.h
Normal file
@@ -0,0 +1,620 @@
|
||||
// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#ifndef _CEF_CAPI_H
|
||||
#define _CEF_CAPI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "cef_export.h"
|
||||
#include "cef_string.h"
|
||||
#include "cef_string_map.h"
|
||||
#include "cef_types.h"
|
||||
|
||||
|
||||
// This function should only be called once when the application is started.
|
||||
// Create the thread to host the UI message loop. A return value of true
|
||||
// indicates that it succeeded and false indicates that it failed. Set
|
||||
// |multi_threaded_message_loop| to true to have the message loop run in
|
||||
// a separate thread. If |multi_threaded_message_loop| is false than
|
||||
// the CefDoMessageLoopWork() function must be called from your message loop.
|
||||
CEF_EXPORT int cef_initialize(int multi_threaded_message_loop);
|
||||
|
||||
// This function should only be called once before the application exits.
|
||||
// Shut down the thread hosting the UI message loop and destroy any created
|
||||
// windows.
|
||||
CEF_EXPORT void cef_shutdown();
|
||||
|
||||
// Perform message loop processing. Has no affect if the browser UI loop is
|
||||
// running in a separate thread.
|
||||
CEF_EXPORT void cef_do_message_loop_work();
|
||||
|
||||
|
||||
typedef struct _cef_base_t
|
||||
{
|
||||
// Size of the data structure
|
||||
size_t size;
|
||||
|
||||
// Increment the reference count.
|
||||
int (CEF_CALLBACK *add_ref)(struct _cef_base_t* base);
|
||||
// Decrement the reference count. Delete this object when no references
|
||||
// remain.
|
||||
int (CEF_CALLBACK *release)(struct _cef_base_t* base);
|
||||
} cef_base_t;
|
||||
|
||||
|
||||
// Check that the structure |s|, which is defined with a cef_base_t member named
|
||||
// |base|, is large enough to contain the specified member |f|.
|
||||
#define CEF_MEMBER_EXISTS(s, f) \
|
||||
((int)&((s)->f) - (int)(s) + sizeof((s)->f) <= (s)->base.size)
|
||||
|
||||
#define CEF_MEMBER_MISSING(s, f) (!CEF_MEMBER_EXISTS(s, f) || !((s)->f))
|
||||
|
||||
// Structure used to represent a browser window. All functions exposed by this
|
||||
// structure should be thread safe.
|
||||
typedef struct _cef_browser_t
|
||||
{
|
||||
// Base structure
|
||||
cef_base_t base;
|
||||
|
||||
// Returns true (1) if the browser can navigate backwards.
|
||||
int (CEF_CALLBACK *can_go_back)(struct _cef_browser_t* browser);
|
||||
// Navigate backwards.
|
||||
void (CEF_CALLBACK *go_back)(struct _cef_browser_t* browser);
|
||||
// Returns true (1) if the browser can navigate forwards.
|
||||
int (CEF_CALLBACK *can_go_forward)(struct _cef_browser_t* browser);
|
||||
// Navigate backwards.
|
||||
void (CEF_CALLBACK *go_forward)(struct _cef_browser_t* browser);
|
||||
// Reload the current page.
|
||||
void (CEF_CALLBACK *reload)(struct _cef_browser_t* browser);
|
||||
// Stop loading the page.
|
||||
void (CEF_CALLBACK *stop_load)(struct _cef_browser_t* browser);
|
||||
|
||||
// Execute undo in the target frame.
|
||||
void (CEF_CALLBACK *undo)(struct _cef_browser_t* browser,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
// Execute redo in the target frame.
|
||||
void (CEF_CALLBACK *redo)(struct _cef_browser_t* browser,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
// Execute cut in the target frame.
|
||||
void (CEF_CALLBACK *cut)(struct _cef_browser_t* browser,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
// Execute copy in the target frame.
|
||||
void (CEF_CALLBACK *copy)(struct _cef_browser_t* browser,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
// Execute paste in the target frame.
|
||||
void (CEF_CALLBACK *paste)(struct _cef_browser_t* browser,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
// Execute delete in the target frame.
|
||||
void (CEF_CALLBACK *del)(struct _cef_browser_t* browser,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
// Execute select all in the target frame.
|
||||
void (CEF_CALLBACK *select_all)(struct _cef_browser_t* browser,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
|
||||
// Execute printing in the target frame. The user will be prompted with
|
||||
// the print dialog appropriate to the operating system.
|
||||
void (CEF_CALLBACK *print)(struct _cef_browser_t* browser,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
|
||||
// Save the target frame's HTML source to a temporary file and open it in
|
||||
// the default text viewing application.
|
||||
void (CEF_CALLBACK *view_source)(struct _cef_browser_t* browser,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
|
||||
// Returns the target frame's HTML source as a string. The returned string
|
||||
// must be released using cef_string_free().
|
||||
cef_string_t (CEF_CALLBACK *get_source)(struct _cef_browser_t* browser,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
|
||||
// Returns the target frame's display text as a string. The returned string
|
||||
// must be released using cef_string_free().
|
||||
cef_string_t (CEF_CALLBACK *get_text)(struct _cef_browser_t* browser,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
|
||||
// Load the request represented by the |request| object.
|
||||
void (CEF_CALLBACK *load_request)(struct _cef_browser_t* browser,
|
||||
struct _cef_request_t* request);
|
||||
|
||||
// Convenience method for loading the specified |url| in the optional target
|
||||
// |frame|.
|
||||
void (CEF_CALLBACK *load_url)(struct _cef_browser_t* browser,
|
||||
const wchar_t* url, const wchar_t* frame);
|
||||
|
||||
// Load the contents of |string| with the optional dummy target |url|.
|
||||
void (CEF_CALLBACK *load_string)(struct _cef_browser_t* browser,
|
||||
const wchar_t* string, const wchar_t* url);
|
||||
|
||||
// Load the contents of |stream| with the optional dummy target |url|.
|
||||
void (CEF_CALLBACK *load_stream)(struct _cef_browser_t* browser,
|
||||
struct _cef_stream_reader_t* stream, const wchar_t* url);
|
||||
|
||||
// Execute a string of JavaScript code in the specified target frame. The
|
||||
// |script_url| parameter is the URL where the script in question can be
|
||||
// found, if any. The renderer may request this URL to show the developer the
|
||||
// source of the error. The |start_line| parameter is the base line number
|
||||
// to use for error reporting.
|
||||
void (CEF_CALLBACK *execute_javascript)(struct _cef_browser_t* browser,
|
||||
const wchar_t* jsCode, const wchar_t* scriptUrl, int startLine,
|
||||
enum cef_targetframe_t targetFrame);
|
||||
|
||||
// Register a new handler tied to the specified JS object |name|. Returns
|
||||
// true if the handler is registered successfully.
|
||||
// A JS handler will be accessible to JavaScript as window.<classname>.
|
||||
int (CEF_CALLBACK *add_jshandler)(struct _cef_browser_t* browser,
|
||||
const wchar_t* classname, struct _cef_jshandler_t* handler);
|
||||
|
||||
// Returns true if a JS handler with the specified |name| is currently
|
||||
// registered.
|
||||
int (CEF_CALLBACK *has_jshandler)(struct _cef_browser_t* browser,
|
||||
const wchar_t* classname);
|
||||
|
||||
// Returns the JS handler registered with the specified |name|.
|
||||
struct _cef_jshandler_t* (CEF_CALLBACK *get_jshandler)(
|
||||
struct _cef_browser_t* browser, const wchar_t* classname);
|
||||
|
||||
// Unregister the JS handler registered with the specified |name|. Returns
|
||||
// true if the handler is unregistered successfully.
|
||||
int (CEF_CALLBACK *remove_jshandler)(struct _cef_browser_t* browser,
|
||||
const wchar_t* classname);
|
||||
|
||||
// Unregister all JS handlers that are currently registered.
|
||||
void (CEF_CALLBACK *remove_all_jshandlers)(struct _cef_browser_t* browser);
|
||||
|
||||
// Retrieve the window handle for this browser.
|
||||
cef_window_handle_t (CEF_CALLBACK *get_window_handle)(
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
// Returns true (1) if the window is a popup window.
|
||||
int (CEF_CALLBACK *is_popup)(struct _cef_browser_t* browser);
|
||||
|
||||
// Returns the handler for this browser.
|
||||
struct _cef_handler_t* (CEF_CALLBACK *get_handler)(
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
// Return the currently loaded URL. The returned string must be released
|
||||
// using cef_string_free().
|
||||
cef_string_t (CEF_CALLBACK *get_url)(struct _cef_browser_t* browser);
|
||||
|
||||
} cef_browser_t;
|
||||
|
||||
|
||||
// Structure used to handle events generated by the browser window. All methods
|
||||
// functions by this class should be thread safe.
|
||||
typedef struct _cef_handler_t
|
||||
{
|
||||
// Base structure
|
||||
cef_base_t base;
|
||||
|
||||
// Event called before a new window is created. The |parentBrowser| parameter
|
||||
// will point to the parent browser window, if any. The |popup| parameter
|
||||
// will be true (1) if the new window is a popup window. If you create the
|
||||
// window yourself you should populate the window handle member of
|
||||
// |createInfo| and return RV_HANDLED. Otherwise, return RV_CONTINUE and the
|
||||
// framework will create the window. By default, a newly created window will
|
||||
// recieve the same handler as the parent window. To change the handler for
|
||||
// the new window modify the object that |handler| points to.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_before_created)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* parentBrowser,
|
||||
cef_window_info_t* windowInfo, int popup,
|
||||
struct _cef_handler_t** newHandler, cef_string_t* url);
|
||||
|
||||
// Event called after a new window is created. The return value is currently
|
||||
// ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_after_created)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser);
|
||||
|
||||
// Event called when the address bar changes. The return value is currently
|
||||
// ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_address_change)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
const wchar_t* url);
|
||||
|
||||
// Event called when the page title changes. The return value is currently
|
||||
// ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_title_change)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
const wchar_t* title);
|
||||
|
||||
// Event called before browser navigation. The client has an opportunity to
|
||||
// modify the |request| object if desired. Return RV_HANDLED to cancel
|
||||
// navigation.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_before_browse)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
struct _cef_request_t* request, cef_handler_navtype_t navType,
|
||||
int isRedirect);
|
||||
|
||||
// Event called when the browser begins loading a page. The return value is
|
||||
// currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_load_start)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser);
|
||||
|
||||
// Event called when the browser is done loading a page. This event will
|
||||
// be generated irrespective of whether the request completes successfully.
|
||||
// The return value is currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_load_end)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser);
|
||||
|
||||
// Called when the browser fails to load a resource. |errorCode is the
|
||||
// error code number and |failedUrl| is the URL that failed to load. To
|
||||
// provide custom error text assign the text to |errorText| and return
|
||||
// RV_HANDLED. Otherwise, return RV_CONTINUE for the default error text.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_load_error)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
cef_handler_errorcode_t errorCode, const wchar_t* failedUrl,
|
||||
cef_string_t* errorText);
|
||||
|
||||
// Event called before a resource is loaded. To allow the resource to load
|
||||
// normally return RV_CONTINUE. To redirect the resource to a new url
|
||||
// populate the |redirectUrl| value and return RV_CONTINUE. To specify
|
||||
// data for the resource return a CefStream object in |resourceStream|, set
|
||||
// 'mimeType| to the resource stream's mime type, and return RV_CONTINUE.
|
||||
// To cancel loading of the resource return RV_HANDLED.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_before_resource_load)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
struct _cef_request_t* request, cef_string_t* redirectUrl,
|
||||
struct _cef_stream_reader_t** resourceStream, cef_string_t* mimeType,
|
||||
int loadFlags);
|
||||
|
||||
// Event called before a context menu is displayed. To cancel display of the
|
||||
// default context menu return RV_HANDLED.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_before_menu)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
const cef_handler_menuinfo_t* menuInfo);
|
||||
|
||||
// Event called to optionally override the default text for a context menu
|
||||
// item. |label| contains the default text and may be modified to substitute
|
||||
// alternate text. The return value is currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_get_menu_label)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
cef_handler_menuid_t menuId, cef_string_t* label);
|
||||
|
||||
// Event called when an option is selected from the default context menu.
|
||||
// Return RV_HANDLED to cancel default handling of the action.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_menu_action)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
cef_handler_menuid_t menuId);
|
||||
|
||||
// Event called to format print headers and footers. |printInfo| contains
|
||||
// platform-specific information about the printer context. |url| is the
|
||||
// URL if the currently printing page, |title| is the title of the currently
|
||||
// printing page, |currentPage| is the current page number and |maxPages| is
|
||||
// the total number of pages. Six default header locations are provided
|
||||
// by the implementation: top left, top center, top right, bottom left,
|
||||
// bottom center and bottom right. To use one of these default locations
|
||||
// just assign a string to the appropriate variable. To draw the header
|
||||
// and footer yourself return RV_HANDLED. Otherwise, populate the approprate
|
||||
// variables and return RV_CONTINUE.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_print_header_footer)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
cef_print_info_t* printInfo, const wchar_t* url, const wchar_t* title,
|
||||
int currentPage, int maxPages, cef_string_t* topLeft,
|
||||
cef_string_t* topCenter, cef_string_t* topRight,
|
||||
cef_string_t* bottomLeft, cef_string_t* bottomCenter,
|
||||
cef_string_t* bottomRight);
|
||||
|
||||
// Run a JS alert message. Return RV_CONTINUE to display the default alert
|
||||
// or RV_HANDLED if you displayed a custom alert.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_jsalert)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
const wchar_t* message);
|
||||
|
||||
// Run a JS confirm request. Return RV_CONTINUE to display the default alert
|
||||
// or RV_HANDLED if you displayed a custom alert. If you handled the alert
|
||||
// set |retval| to true (1) if the user accepted the confirmation.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_jsconfirm)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
const wchar_t* message, int* retval);
|
||||
|
||||
// Run a JS prompt request. Return RV_CONTINUE to display the default prompt
|
||||
// or RV_HANDLED if you displayed a custom prompt. If you handled the prompt
|
||||
// set |retval| to true if the user accepted the prompt and request and
|
||||
// |result| to the resulting value.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_jsprompt)(
|
||||
struct _cef_handler_t* handler, cef_browser_t* browser,
|
||||
const wchar_t* message, const wchar_t* defaultValue, int* retval,
|
||||
cef_string_t* result);
|
||||
|
||||
} cef_handler_t;
|
||||
|
||||
|
||||
// Structure used to represent a web request.
|
||||
typedef struct _cef_request_t
|
||||
{
|
||||
// Base structure
|
||||
cef_base_t base;
|
||||
|
||||
// Fully qualified URL to load.
|
||||
cef_string_t (CEF_CALLBACK *get_url)(struct _cef_request_t* request);
|
||||
void (CEF_CALLBACK *set_url)(struct _cef_request_t* request,
|
||||
const wchar_t* url);
|
||||
|
||||
// Optional name of the target frame.
|
||||
cef_string_t (CEF_CALLBACK *get_frame)(struct _cef_request_t* request);
|
||||
void (CEF_CALLBACK *set_frame)(struct _cef_request_t* request,
|
||||
const wchar_t* frame);
|
||||
|
||||
// Optional request method type, defaulting to POST if post data is provided
|
||||
// and GET otherwise.
|
||||
cef_string_t (CEF_CALLBACK *get_method)(struct _cef_request_t* request);
|
||||
void (CEF_CALLBACK *set_method)(struct _cef_request_t* request,
|
||||
const wchar_t* method);
|
||||
|
||||
// Optional post data.
|
||||
struct _cef_post_data_t* (CEF_CALLBACK *get_post_data)(
|
||||
struct _cef_request_t* request);
|
||||
void (CEF_CALLBACK *set_post_data)(struct _cef_request_t* request,
|
||||
struct _cef_post_data_t* postData);
|
||||
|
||||
// Optional header values.
|
||||
void (CEF_CALLBACK *get_header_map)(struct _cef_request_t* request,
|
||||
cef_string_map_t headerMap);
|
||||
void (CEF_CALLBACK *set_header_map)(struct _cef_request_t* request,
|
||||
cef_string_map_t headerMap);
|
||||
|
||||
// Set all values at one time.
|
||||
void (CEF_CALLBACK *set)(struct _cef_request_t* request, const wchar_t* url,
|
||||
const wchar_t* frame, const wchar_t* method,
|
||||
struct _cef_post_data_t* postData, cef_string_map_t headerMap);
|
||||
|
||||
} cef_request_t;
|
||||
|
||||
|
||||
// Structure used to represent post data for a web request.
|
||||
typedef struct _cef_post_data_t
|
||||
{
|
||||
// Base structure
|
||||
cef_base_t base;
|
||||
|
||||
// Returns the number of existing post data elements.
|
||||
size_t (CEF_CALLBACK *get_element_count)(struct _cef_post_data_t* postData);
|
||||
|
||||
// Retrieve the post data element at the specified zero-based index.
|
||||
struct _cef_post_data_element_t* (CEF_CALLBACK *get_element)(
|
||||
struct _cef_post_data_t* postData, int index);
|
||||
|
||||
// Remove the specified post data element. Returns true (1) if the removal
|
||||
// succeeds.
|
||||
int (CEF_CALLBACK *remove_element)(struct _cef_post_data_t* postData,
|
||||
struct _cef_post_data_element_t* element);
|
||||
|
||||
// Add the specified post data element. Returns true (1) if the add succeeds.
|
||||
int (CEF_CALLBACK *add_element)(struct _cef_post_data_t* postData,
|
||||
struct _cef_post_data_element_t* element);
|
||||
|
||||
// Remove all existing post data elements.
|
||||
void (CEF_CALLBACK *remove_elements)(struct _cef_post_data_t* postData);
|
||||
|
||||
} cef_post_data_t;
|
||||
|
||||
|
||||
// Structure used to represent a single element in the request post data.
|
||||
typedef struct _cef_post_data_element_t
|
||||
{
|
||||
// Base structure
|
||||
cef_base_t base;
|
||||
|
||||
// Remove all contents from the post data element.
|
||||
void (CEF_CALLBACK *set_to_empty)(
|
||||
struct _cef_post_data_element_t* postDataElement);
|
||||
|
||||
// The post data element will represent a file.
|
||||
void (CEF_CALLBACK *set_to_file)(
|
||||
struct _cef_post_data_element_t* postDataElement,
|
||||
const wchar_t* fileName);
|
||||
|
||||
// The post data element will represent bytes. The bytes passed
|
||||
// in will be copied.
|
||||
void (CEF_CALLBACK *set_to_bytes)(
|
||||
struct _cef_post_data_element_t* postDataElement, size_t size,
|
||||
const void* bytes);
|
||||
|
||||
// Return the type of this post data element.
|
||||
cef_postdataelement_type_t (CEF_CALLBACK *get_type)(
|
||||
struct _cef_post_data_element_t* postDataElement);
|
||||
|
||||
// Return the file name.
|
||||
cef_string_t (CEF_CALLBACK *get_file)(
|
||||
struct _cef_post_data_element_t* postDataElement);
|
||||
|
||||
// Return the number of bytes.
|
||||
size_t (CEF_CALLBACK *get_bytes_count)(
|
||||
struct _cef_post_data_element_t* postDataElement);
|
||||
|
||||
// Read up to |size| bytes into |bytes| and return the number of bytes
|
||||
// actually read.
|
||||
size_t (CEF_CALLBACK *get_bytes)(
|
||||
struct _cef_post_data_element_t* postDataElement, size_t size,
|
||||
void *bytes);
|
||||
|
||||
} cef_post_data_element_t;
|
||||
|
||||
|
||||
// Structure used to read data from a stream.
|
||||
typedef struct _cef_stream_reader_t
|
||||
{
|
||||
// Base structure
|
||||
cef_base_t base;
|
||||
|
||||
// Read raw binary data.
|
||||
size_t (CEF_CALLBACK *read)(struct _cef_stream_reader_t* stream, void *ptr,
|
||||
size_t size, size_t n);
|
||||
|
||||
// Seek to the specified offset position. |whence| may be any one of
|
||||
// SEEK_CUR, SEEK_END or SEEK_SET.
|
||||
int (CEF_CALLBACK *seek)(struct _cef_stream_reader_t* stream, long offset,
|
||||
int whence);
|
||||
|
||||
// Return the current offset position.
|
||||
long (CEF_CALLBACK *tell)(struct _cef_stream_reader_t* stream);
|
||||
|
||||
// Return non-zero if at end of file.
|
||||
int (CEF_CALLBACK *eof)(struct _cef_stream_reader_t* stream);
|
||||
|
||||
} cef_stream_reader_t;
|
||||
|
||||
|
||||
// Structure used to write data to a stream.
|
||||
typedef struct _cef_stream_writer_t
|
||||
{
|
||||
// Base structure
|
||||
cef_base_t base;
|
||||
|
||||
size_t (CEF_CALLBACK *write)(struct _cef_stream_writer_t* stream,
|
||||
const void *ptr, size_t size, size_t n);
|
||||
|
||||
// Seek to the specified offset position. |whence| may be any one of
|
||||
// SEEK_CUR, SEEK_END or SEEK_SET.
|
||||
int (CEF_CALLBACK *seek)(struct _cef_stream_writer_t* stream, long offset,
|
||||
int whence);
|
||||
|
||||
// Return the current offset position.
|
||||
long (CEF_CALLBACK *tell)(struct _cef_stream_writer_t* stream);
|
||||
|
||||
// Flush the stream.
|
||||
int (CEF_CALLBACK *flush)(struct _cef_stream_writer_t* stream);
|
||||
|
||||
} cef_stream_writer_t;
|
||||
|
||||
|
||||
// Structure for implementing external JavaScript objects.
|
||||
typedef struct _cef_jshandler_t
|
||||
{
|
||||
// Base structure
|
||||
cef_base_t base;
|
||||
|
||||
// Return true if the specified method exists.
|
||||
bool (CEF_CALLBACK *has_method)(struct _cef_jshandler_t* jshandler,
|
||||
cef_browser_t* browser, const wchar_t* name);
|
||||
|
||||
// Return true if the specified property exists.
|
||||
bool (CEF_CALLBACK *has_property)(struct _cef_jshandler_t* jshandler,
|
||||
cef_browser_t* browser, const wchar_t* name);
|
||||
|
||||
// Set the property value. Return true if the property is accepted.
|
||||
bool (CEF_CALLBACK *set_property)(struct _cef_jshandler_t* jshandler,
|
||||
cef_browser_t* browser, const wchar_t* name,
|
||||
struct _cef_variant_t* value);
|
||||
|
||||
// Get the property value. Return true if the value is returned.
|
||||
bool (CEF_CALLBACK *get_property)(struct _cef_jshandler_t* jshandler,
|
||||
cef_browser_t* browser, const wchar_t* name,
|
||||
struct _cef_variant_t* value);
|
||||
|
||||
// Execute a method with the specified argument vector and return
|
||||
// value. Return true if the method was handled.
|
||||
bool (CEF_CALLBACK *execute_method)(struct _cef_jshandler_t* jshandler,
|
||||
cef_browser_t* browser, const wchar_t* name, size_t numargs,
|
||||
struct _cef_variant_t** args, struct _cef_variant_t* retval);
|
||||
|
||||
} cef_jshandler_t;
|
||||
|
||||
|
||||
typedef struct _cef_variant_t
|
||||
{
|
||||
// Base structure
|
||||
cef_base_t base;
|
||||
|
||||
// Return the variant data type.
|
||||
cef_variant_type_t (CEF_CALLBACK *get_type)(struct _cef_variant_t* variant);
|
||||
|
||||
// Assign various data types.
|
||||
void (CEF_CALLBACK *set_null)(struct _cef_variant_t* variant);
|
||||
void (CEF_CALLBACK *set_bool)(struct _cef_variant_t* variant, int val);
|
||||
void (CEF_CALLBACK *set_int)(struct _cef_variant_t* variant, int val);
|
||||
void (CEF_CALLBACK *set_double)(struct _cef_variant_t* variant, double val);
|
||||
void (CEF_CALLBACK *set_string)(struct _cef_variant_t* variant,
|
||||
const wchar_t* val);
|
||||
void (CEF_CALLBACK *set_bool_array)(struct _cef_variant_t* variant,
|
||||
size_t count, const int* vals);
|
||||
void (CEF_CALLBACK *set_int_array)(struct _cef_variant_t* variant,
|
||||
size_t count, const int* vals);
|
||||
void (CEF_CALLBACK *set_double_array)(struct _cef_variant_t* variant,
|
||||
size_t count, const double* vals);
|
||||
void (CEF_CALLBACK *set_string_array)(struct _cef_variant_t* variant,
|
||||
size_t count, const cef_string_t* vals);
|
||||
|
||||
// Retrieve various data types.
|
||||
int (CEF_CALLBACK *get_bool)(struct _cef_variant_t* variant);
|
||||
int (CEF_CALLBACK *get_int)(struct _cef_variant_t* variant);
|
||||
double (CEF_CALLBACK *get_double)(struct _cef_variant_t* variant);
|
||||
cef_string_t (CEF_CALLBACK *get_string)(struct _cef_variant_t* variant);
|
||||
|
||||
// Returns the number of values in the array. Returns -1 if the variant
|
||||
// is not an array type.
|
||||
int (CEF_CALLBACK *get_array_size)(struct _cef_variant_t* variant);
|
||||
|
||||
// Reads up to |maxcount| values into the specified |vals| array. Returns
|
||||
// the number of values actually read in.
|
||||
size_t (CEF_CALLBACK *get_bool_array)(struct _cef_variant_t* variant,
|
||||
size_t maxcount, int* vals);
|
||||
size_t (CEF_CALLBACK *get_int_array)(struct _cef_variant_t* variant,
|
||||
size_t maxcount, int* vals);
|
||||
size_t (CEF_CALLBACK *get_double_array)(struct _cef_variant_t* variant,
|
||||
size_t maxcount, double* vals);
|
||||
size_t (CEF_CALLBACK *get_string_array)(struct _cef_variant_t* variant,
|
||||
size_t maxcount, cef_string_t* vals);
|
||||
|
||||
} cef_variant_t;
|
||||
|
||||
|
||||
// Create a new browser window using the window parameters specified
|
||||
// by |windowInfo|. All values will be copied internally and the actual
|
||||
// window will be created on the UI thread. The |popup| parameter should
|
||||
// be true (1) if the new window is a popup window. This method call will not
|
||||
// block.
|
||||
CEF_EXPORT int cef_create_browser(cef_window_info_t* windowInfo, int popup,
|
||||
cef_handler_t* handler, const wchar_t* url);
|
||||
|
||||
// Create a new request structure.
|
||||
CEF_EXPORT cef_request_t* cef_create_request();
|
||||
|
||||
// Create a new post data structure.
|
||||
CEF_EXPORT cef_post_data_t* cef_create_post_data();
|
||||
|
||||
// Create a new post data element structure.
|
||||
CEF_EXPORT cef_post_data_element_t* cef_create_post_data_element();
|
||||
|
||||
// Create a new stream reader structure for reading from the specified file.
|
||||
CEF_EXPORT cef_stream_reader_t* cef_create_stream_reader_for_file(
|
||||
const wchar_t* fileName);
|
||||
|
||||
// Create a new stream reader structure for reading from the specified data.
|
||||
CEF_EXPORT cef_stream_reader_t* cef_create_stream_reader_for_data(void *data,
|
||||
size_t size);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CEF_CAPI_H
|
41
include/cef_export.h
Normal file
41
include/cef_export.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#ifdef _MSC_VER // MSVC
|
||||
#ifdef BUILDING_CEF_SHARED
|
||||
#define CEF_EXPORT __declspec(dllexport)
|
||||
#elif USING_CEF_SHARED
|
||||
#define CEF_EXPORT __declspec(dllimport)
|
||||
#else
|
||||
#define CEF_EXPORT
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
#define CEF_CALLBACK __stdcall
|
||||
#endif // MSVC
|
90
include/cef_nplugin_capi.h
Normal file
90
include/cef_nplugin_capi.h
Normal file
@@ -0,0 +1,90 @@
|
||||
// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#ifndef _CEF_PLUGIN_CAPI_H
|
||||
#define _CEF_PLUGIN_CAPI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "cef_export.h"
|
||||
#include "webkit/glue/plugins/nphostapi.h"
|
||||
#include "third_party/npapi/bindings/npapi.h"
|
||||
|
||||
// Netscape plugins are normally built at separate DLLs that are loaded by the
|
||||
// browser when needed. This interface supports the creation of plugins that
|
||||
// are an embedded component of the application. Embedded plugins built using
|
||||
// this interface use the same Netscape Plugin API as DLL-based plugins.
|
||||
// See https://developer.mozilla.org/En/Gecko_Plugin_API_Reference for complete
|
||||
// documentation on how to use the Netscape Plugin API.
|
||||
|
||||
// This structure provides attribute information and entry point functions for
|
||||
// a plugin.
|
||||
typedef struct _cef_plugin_info_t {
|
||||
// The unique name that identifies the plugin.
|
||||
const wchar_t* unique_name;
|
||||
|
||||
// The friendly display name of the plugin.
|
||||
const wchar_t* display_name;
|
||||
|
||||
// The version string of the plugin.
|
||||
const wchar_t* version;
|
||||
|
||||
// A description of the plugin.
|
||||
const wchar_t* description;
|
||||
|
||||
// A pipe (|) delimited list of mime type values that the plugin supports.
|
||||
const wchar_t* mime_types;
|
||||
|
||||
// A pipe (|) delimited list of extension values. Each value is associated
|
||||
// with the mime type value at the same position. Multiple file extensions
|
||||
// for the same mime type may be delimited with commas (,).
|
||||
const wchar_t* file_extensions;
|
||||
|
||||
// A pipe (|) delimited list of description values. Each value is associated
|
||||
// with the mime type value at the same position.
|
||||
const wchar_t* type_descriptions;
|
||||
|
||||
// Entry point function pointers.
|
||||
NP_GetEntryPointsFunc np_getentrypoints;
|
||||
NP_InitializeFunc np_initialize;
|
||||
NP_ShutdownFunc np_shutdown;
|
||||
} cef_plugin_info_t;
|
||||
|
||||
// Register a plugin with the system. Returns true (1) on success.
|
||||
CEF_EXPORT int cef_register_plugin(const cef_plugin_info_t* plugin_info);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CEF_PLUGIN_CAPI_H
|
86
include/cef_string.h
Normal file
86
include/cef_string.h
Normal file
@@ -0,0 +1,86 @@
|
||||
// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef _CEF_STRING_H
|
||||
#define _CEF_STRING_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "cef_export.h"
|
||||
#include <wchar.h>
|
||||
|
||||
// CEF strings are NUL-terminated wide character strings prefixed with a size
|
||||
// value, similar to the Microsoft BSTR type. Use the below API functions for
|
||||
// allocating, managing and freeing CEF strings.
|
||||
typedef wchar_t* cef_string_t;
|
||||
|
||||
// Return the wide character length of the CEF string as allocated by
|
||||
// cef_string_alloc_len(). The returned value does not include the NUL
|
||||
// terminating character. This length may differ from the string length
|
||||
// as returned by wcslen().
|
||||
CEF_EXPORT size_t cef_string_length(cef_string_t str);
|
||||
|
||||
// Allocate and return a new CEF string that is a copy of |str|. If |str| is
|
||||
// NULL or if allocation fails NULL will be returned. If |str| is of length
|
||||
// 0 a valid empty CEF string will be returned.
|
||||
CEF_EXPORT cef_string_t cef_string_alloc(const wchar_t* str);
|
||||
|
||||
// Allocate and return a new CEF string that is a copy of |str|. |len| is the
|
||||
// wide character length of the new CEF string not including the NUL
|
||||
// terminating character. |str| will be copied without checking for a NUL
|
||||
// terminating character. If |str| is NULL or if allocation fails NULL will
|
||||
// be returned. If |str| is of length 0 a valid empty CEF string will be
|
||||
// returned.
|
||||
CEF_EXPORT cef_string_t cef_string_alloc_length(const wchar_t* str,
|
||||
size_t len);
|
||||
|
||||
// Reallocate an existing CEF string. The contents of |oldstr| will be
|
||||
// replaced with the contents of |newstr|; |newstr| may not be NULL. Returns 1
|
||||
// on success and 0 on failure.
|
||||
CEF_EXPORT int cef_string_realloc(cef_string_t* oldstr, const wchar_t* newstr);
|
||||
|
||||
// Reallocate an existing CEF string. If |newstr| is NULL the contents of
|
||||
// |oldstr| will remain unchanged; otherwise, they will be replaced with the
|
||||
// contents of |newstr|. |len| is the new wide character length of the string
|
||||
// not including the NUL terminating character. Returns 1 on success and 0
|
||||
// on failure.
|
||||
CEF_EXPORT int cef_string_realloc_length(cef_string_t* oldstr,
|
||||
const wchar_t* newstr,
|
||||
size_t len);
|
||||
|
||||
// Free a CEF string. If |str| is NULL this function does nothing.
|
||||
CEF_EXPORT void cef_string_free(cef_string_t str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CEF_STRING_H
|
75
include/cef_string_map.h
Normal file
75
include/cef_string_map.h
Normal file
@@ -0,0 +1,75 @@
|
||||
// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef _CEF_STRING_MAP_H
|
||||
#define _CEF_STRING_MAP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "cef_export.h"
|
||||
#include "cef_string.h"
|
||||
#include <wchar.h>
|
||||
|
||||
// CEF string maps are a set of key/value string pairs.
|
||||
typedef void* cef_string_map_t;
|
||||
|
||||
// Allocate a new string map.
|
||||
CEF_EXPORT cef_string_map_t cef_string_map_alloc();
|
||||
|
||||
// Return the number of elements in the string map.
|
||||
CEF_EXPORT int cef_string_map_size(cef_string_map_t map);
|
||||
|
||||
// Return the value assigned to the specified key.
|
||||
CEF_EXPORT cef_string_t cef_string_map_find(cef_string_map_t map,
|
||||
const wchar_t* key);
|
||||
|
||||
// Return the key at the specified zero-based string map index.
|
||||
CEF_EXPORT cef_string_t cef_string_map_key(cef_string_map_t map, int index);
|
||||
|
||||
// Return the value at the specified zero-based string map index.
|
||||
CEF_EXPORT cef_string_t cef_string_map_value(cef_string_map_t map, int index);
|
||||
|
||||
// Append a new key/value pair at the end of the string map.
|
||||
CEF_EXPORT void cef_string_map_append(cef_string_map_t map, const wchar_t* key,
|
||||
const wchar_t* value);
|
||||
|
||||
// Clear the string map.
|
||||
CEF_EXPORT void cef_string_map_clear(cef_string_map_t map);
|
||||
|
||||
// Free the string map.
|
||||
CEF_EXPORT void cef_string_map_free(cef_string_map_t map);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CEF_STRING_MAP_H
|
227
include/cef_types.h
Normal file
227
include/cef_types.h
Normal file
@@ -0,0 +1,227 @@
|
||||
// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#ifndef _CEF_TYPES_H
|
||||
#define _CEF_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// Bring in platform-specific definitions.
|
||||
#ifdef _WIN32
|
||||
#include "cef_types_win.h"
|
||||
#endif
|
||||
|
||||
|
||||
// Define frame target types. Using TF_FOCUSED will target the focused
|
||||
// frame and using TF_MAIN will target the main frame.
|
||||
enum cef_targetframe_t
|
||||
{
|
||||
TF_FOCUSED = 0,
|
||||
TF_MAIN = 1,
|
||||
};
|
||||
|
||||
// Define handler return value types. Returning RV_HANDLED indicates
|
||||
// that the implementation completely handled the method and that no further
|
||||
// processing is required. Returning RV_CONTINUE indicates that the
|
||||
// implementation did not handle the method and that the default handler
|
||||
// should be called.
|
||||
enum cef_retval_t
|
||||
{
|
||||
RV_HANDLED = 0,
|
||||
RV_CONTINUE = 1,
|
||||
};
|
||||
|
||||
// Various browser navigation types supported by chrome.
|
||||
enum cef_handler_navtype_t
|
||||
{
|
||||
NAVTYPE_LINKCLICKED = 0,
|
||||
NAVTYPE_FORMSUBMITTED,
|
||||
NAVTYPE_BACKFORWARD,
|
||||
NAVTYPE_RELOAD,
|
||||
NAVTYPE_FORMRESUBMITTED,
|
||||
NAVTYPE_OTHER,
|
||||
};
|
||||
|
||||
// Supported error code values. See net\base\net_error_list.h for complete
|
||||
// descriptions of the error codes.
|
||||
enum cef_handler_errorcode_t
|
||||
{
|
||||
ERR_FAILED = -2,
|
||||
ERR_ABORTED = -3,
|
||||
ERR_INVALID_ARGUMENT = -4,
|
||||
ERR_INVALID_HANDLE = -5,
|
||||
ERR_FILE_NOT_FOUND = -6,
|
||||
ERR_TIMED_OUT = -7,
|
||||
ERR_FILE_TOO_BIG = -8,
|
||||
ERR_UNEXPECTED = -9,
|
||||
ERR_ACCESS_DENIED = -10,
|
||||
ERR_NOT_IMPLEMENTED = -11,
|
||||
ERR_CONNECTION_CLOSED = -100,
|
||||
ERR_CONNECTION_RESET = -101,
|
||||
ERR_CONNECTION_REFUSED = -102,
|
||||
ERR_CONNECTION_ABORTED = -103,
|
||||
ERR_CONNECTION_FAILED = -104,
|
||||
ERR_NAME_NOT_RESOLVED = -105,
|
||||
ERR_INTERNET_DISCONNECTED = -106,
|
||||
ERR_SSL_PROTOCOL_ERROR = -107,
|
||||
ERR_ADDRESS_INVALID = -108,
|
||||
ERR_ADDRESS_UNREACHABLE = -109,
|
||||
ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110,
|
||||
ERR_TUNNEL_CONNECTION_FAILED = -111,
|
||||
ERR_NO_SSL_VERSIONS_ENABLED = -112,
|
||||
ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113,
|
||||
ERR_SSL_RENEGOTIATION_REQUESTED = -114,
|
||||
ERR_CERT_COMMON_NAME_INVALID = -200,
|
||||
ERR_CERT_DATE_INVALID = -201,
|
||||
ERR_CERT_AUTHORITY_INVALID = -202,
|
||||
ERR_CERT_CONTAINS_ERRORS = -203,
|
||||
ERR_CERT_NO_REVOCATION_MECHANISM = -204,
|
||||
ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205,
|
||||
ERR_CERT_REVOKED = -206,
|
||||
ERR_CERT_INVALID = -207,
|
||||
ERR_CERT_END = -208,
|
||||
ERR_INVALID_URL = -300,
|
||||
ERR_DISALLOWED_URL_SCHEME = -301,
|
||||
ERR_UNKNOWN_URL_SCHEME = -302,
|
||||
ERR_TOO_MANY_REDIRECTS = -310,
|
||||
ERR_UNSAFE_REDIRECT = -311,
|
||||
ERR_UNSAFE_PORT = -312,
|
||||
ERR_INVALID_RESPONSE = -320,
|
||||
ERR_INVALID_CHUNKED_ENCODING = -321,
|
||||
ERR_METHOD_NOT_SUPPORTED = -322,
|
||||
ERR_UNEXPECTED_PROXY_AUTH = -323,
|
||||
ERR_EMPTY_RESPONSE = -324,
|
||||
ERR_RESPONSE_HEADERS_TOO_BIG = -325,
|
||||
ERR_CACHE_MISS = -400,
|
||||
ERR_INSECURE_RESPONSE = -501,
|
||||
};
|
||||
|
||||
// Structure representing menu information.
|
||||
typedef struct _cef_handler_menuinfo_t
|
||||
{
|
||||
int typeFlags;
|
||||
int x;
|
||||
int y;
|
||||
const wchar_t* linkUrl;
|
||||
const wchar_t* imageUrl;
|
||||
const wchar_t* pageUrl;
|
||||
const wchar_t* frameUrl;
|
||||
const wchar_t* selectionText;
|
||||
const wchar_t* misspelledWord;
|
||||
int editFlags;
|
||||
const wchar_t* securityInfo;
|
||||
} cef_handler_menuinfo_t;
|
||||
|
||||
// The cef_handler_menuinfo_t typeFlags value will be a combination of the
|
||||
// following values.
|
||||
enum cef_handler_menutypebits_t
|
||||
{
|
||||
// No node is selected
|
||||
MENUTYPE_NONE = 0x0,
|
||||
// The top page is selected
|
||||
MENUTYPE_PAGE = 0x1,
|
||||
// A subframe page is selected
|
||||
MENUTYPE_FRAME = 0x2,
|
||||
// A link is selected
|
||||
MENUTYPE_LINK = 0x4,
|
||||
// An image is selected
|
||||
MENUTYPE_IMAGE = 0x8,
|
||||
// There is a textual or mixed selection that is selected
|
||||
MENUTYPE_SELECTION = 0x10,
|
||||
// An editable element is selected
|
||||
MENUTYPE_EDITABLE = 0x20,
|
||||
// A misspelled word is selected
|
||||
MENUTYPE_MISSPELLED_WORD = 0x40,
|
||||
};
|
||||
|
||||
// The cef_handler_menuinfo_t editFlags value will be a combination of the
|
||||
// following values.
|
||||
enum cef_handler_menucapabilitybits_t
|
||||
{
|
||||
MENU_CAN_DO_NONE = 0x0,
|
||||
MENU_CAN_UNDO = 0x1,
|
||||
MENU_CAN_REDO = 0x2,
|
||||
MENU_CAN_CUT = 0x4,
|
||||
MENU_CAN_COPY = 0x8,
|
||||
MENU_CAN_PASTE = 0x10,
|
||||
MENU_CAN_DELETE = 0x20,
|
||||
MENU_CAN_SELECT_ALL = 0x40,
|
||||
MENU_CAN_GO_FORWARD = 0x80,
|
||||
MENU_CAN_GO_BACK = 0x100,
|
||||
};
|
||||
|
||||
// Supported menu ID values.
|
||||
enum cef_handler_menuid_t
|
||||
{
|
||||
MENU_ID_NAV_BACK = 10,
|
||||
MENU_ID_NAV_FORWARD = 11,
|
||||
MENU_ID_NAV_RELOAD = 12,
|
||||
MENU_ID_NAV_STOP = 13,
|
||||
MENU_ID_UNDO = 20,
|
||||
MENU_ID_REDO = 21,
|
||||
MENU_ID_CUT = 22,
|
||||
MENU_ID_COPY = 23,
|
||||
MENU_ID_PASTE = 24,
|
||||
MENU_ID_DELETE = 25,
|
||||
MENU_ID_SELECTALL = 26,
|
||||
MENU_ID_PRINT = 30,
|
||||
MENU_ID_VIEWSOURCE = 31,
|
||||
};
|
||||
|
||||
// Post data elements may represent either bytes or files.
|
||||
enum cef_postdataelement_type_t
|
||||
{
|
||||
PDE_TYPE_EMPTY = 0,
|
||||
PDE_TYPE_BYTES,
|
||||
PDE_TYPE_FILE,
|
||||
};
|
||||
|
||||
enum cef_variant_type_t
|
||||
{
|
||||
VARIANT_TYPE_NULL = 0,
|
||||
VARIANT_TYPE_BOOL,
|
||||
VARIANT_TYPE_INT,
|
||||
VARIANT_TYPE_DOUBLE,
|
||||
VARIANT_TYPE_STRING,
|
||||
VARIANT_TYPE_BOOL_ARRAY,
|
||||
VARIANT_TYPE_INT_ARRAY,
|
||||
VARIANT_TYPE_DOUBLE_ARRAY,
|
||||
VARIANT_TYPE_STRING_ARRAY,
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CEF_TYPES_H
|
76
include/cef_types_win.h
Normal file
76
include/cef_types_win.h
Normal file
@@ -0,0 +1,76 @@
|
||||
// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#ifndef _CEF_TYPES_WIN_H
|
||||
#define _CEF_TYPES_WIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include "cef_string.h"
|
||||
|
||||
// Class representing window information.
|
||||
typedef struct _cef_window_info_t
|
||||
{
|
||||
// Standard parameters required by CreateWindowEx()
|
||||
DWORD m_dwExStyle;
|
||||
cef_string_t m_windowName;
|
||||
DWORD m_dwStyle;
|
||||
int m_x;
|
||||
int m_y;
|
||||
int m_nWidth;
|
||||
int m_nHeight;
|
||||
HWND m_hWndParent;
|
||||
HMENU m_hMenu;
|
||||
|
||||
// Handle for the new browser window.
|
||||
HWND m_hWnd;
|
||||
} cef_window_info_t;
|
||||
|
||||
// Class representing print context information.
|
||||
typedef struct _cef_print_info_t
|
||||
{
|
||||
HDC m_hDC;
|
||||
RECT m_Rect;
|
||||
double m_Scale;
|
||||
} cef_print_info_t;
|
||||
|
||||
// Window handle.
|
||||
#define cef_window_handle_t HWND
|
||||
#endif // _WIN32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CEF_TYPES_WIN_H
|
@@ -33,6 +33,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include "cef_types_win.h"
|
||||
|
||||
// Atomic increment and decrement.
|
||||
#define CefAtomicIncrement(p) InterlockedIncrement(p)
|
||||
@@ -64,12 +65,29 @@ public:
|
||||
};
|
||||
|
||||
// Class representing window information.
|
||||
class CefWindowInfo
|
||||
class CefWindowInfo : public cef_window_info_t
|
||||
{
|
||||
public:
|
||||
CefWindowInfo()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
~CefWindowInfo()
|
||||
{
|
||||
if(m_windowName)
|
||||
cef_string_free(m_windowName);
|
||||
}
|
||||
|
||||
CefWindowInfo(const cef_window_info_t& r)
|
||||
{
|
||||
Init();
|
||||
*this = r;
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
m_dwExStyle = 0;
|
||||
m_windowName = NULL;
|
||||
m_dwStyle = 0;
|
||||
m_x = 0;
|
||||
m_y = 0;
|
||||
@@ -79,19 +97,16 @@ public:
|
||||
m_hMenu = 0;
|
||||
m_hWnd = NULL;
|
||||
}
|
||||
~CefWindowInfo()
|
||||
{
|
||||
}
|
||||
|
||||
CefWindowInfo(const CefWindowInfo& r)
|
||||
{
|
||||
*this = r;
|
||||
}
|
||||
|
||||
CefWindowInfo& operator=(const CefWindowInfo& r)
|
||||
CefWindowInfo& operator=(const cef_window_info_t& r)
|
||||
{
|
||||
m_dwExStyle = r.m_dwExStyle;
|
||||
m_windowName = r.m_windowName;
|
||||
if(m_windowName)
|
||||
cef_string_free(m_windowName);
|
||||
if(r.m_windowName)
|
||||
m_windowName = cef_string_alloc(r.m_windowName);
|
||||
else
|
||||
m_windowName = NULL;
|
||||
m_dwStyle = r.m_dwStyle;
|
||||
m_x = r.m_x;
|
||||
m_y = r.m_y;
|
||||
@@ -100,7 +115,6 @@ public:
|
||||
m_hWndParent = r.m_hWndParent;
|
||||
m_hMenu = r.m_hMenu;
|
||||
m_hWnd = r.m_hWnd;
|
||||
m_ClientInfo = r.m_ClientInfo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -123,47 +137,42 @@ public:
|
||||
m_y = CW_USEDEFAULT;
|
||||
m_nWidth = CW_USEDEFAULT;
|
||||
m_nHeight = CW_USEDEFAULT;
|
||||
m_windowName = windowName;
|
||||
|
||||
if(m_windowName)
|
||||
cef_string_free(m_windowName);
|
||||
if(windowName)
|
||||
m_windowName = cef_string_alloc(windowName);
|
||||
else
|
||||
m_windowName = NULL;
|
||||
}
|
||||
|
||||
// Standard parameters required by CreateWindowEx()
|
||||
DWORD m_dwExStyle;
|
||||
std::wstring m_windowName;
|
||||
DWORD m_dwStyle;
|
||||
int m_x;
|
||||
int m_y;
|
||||
int m_nWidth;
|
||||
int m_nHeight;
|
||||
HWND m_hWndParent;
|
||||
HMENU m_hMenu;
|
||||
|
||||
// Handle for the new browser window.
|
||||
HWND m_hWnd;
|
||||
|
||||
// A parameter that can be used to store client-specific information.
|
||||
CefRefPtr<CefBase> m_ClientInfo;
|
||||
};
|
||||
|
||||
// Class representing print context information.
|
||||
class CefPrintInfo
|
||||
class CefPrintInfo : public cef_print_info_t
|
||||
{
|
||||
public:
|
||||
CefPrintInfo()
|
||||
{
|
||||
m_hDC = NULL;
|
||||
m_Rect.left = m_Rect.right = m_Rect.top = m_Rect.bottom = 0;
|
||||
m_Scale = 0;
|
||||
Init();
|
||||
}
|
||||
~CefPrintInfo()
|
||||
{
|
||||
}
|
||||
|
||||
CefPrintInfo(const CefPrintInfo& r)
|
||||
CefPrintInfo(const cef_print_info_t& r)
|
||||
{
|
||||
Init();
|
||||
*this = r;
|
||||
}
|
||||
|
||||
CefPrintInfo& operator=(const CefPrintInfo& r)
|
||||
void Init()
|
||||
{
|
||||
m_hDC = NULL;
|
||||
m_Rect.left = m_Rect.right = m_Rect.top = m_Rect.bottom = 0;
|
||||
m_Scale = 0;
|
||||
}
|
||||
|
||||
CefPrintInfo& operator=(const cef_print_info_t& r)
|
||||
{
|
||||
m_hDC = r.m_hDC;
|
||||
m_Rect.left = r.m_Rect.left;
|
||||
@@ -173,14 +182,10 @@ public:
|
||||
m_Scale = r.m_Scale;
|
||||
return *this;
|
||||
}
|
||||
|
||||
HDC m_hDC;
|
||||
RECT m_Rect;
|
||||
double m_Scale;
|
||||
};
|
||||
|
||||
// Window handle.
|
||||
#define CefWindowHandle HWND
|
||||
#define CefWindowHandle cef_window_handle_t
|
||||
#endif // _WIN32
|
||||
|
||||
#endif // _CEF_WIN_H
|
||||
|
Reference in New Issue
Block a user