- Add CefURLRequest support (issue #517).

- Add CefBrowserProcessHandler interface (issue #650).
- Internally re-register supported schemes with CefCookieManager after changing the storage path (issue #651).
- Add CefResourceHandler callbacks for blocking cookie loading and saving (issue #652).
- Allow custom scheme handlers for requests that do not originate from browser content (issue #653).
- Use 'int' instead of 'RequestFlags' for CefRequest::GetFlags and SetFlags (issue #654).
- Rename cef_request.h CreateObject methods to Create (issue #655).
- Add #ifdef guards to cef_tuple.h to allow the use of both cef_runnable.h and base/bind.h in the same unit test source file.
- Retrieve cookieable schemes as part of ClientApp::RegisterCustomSchemes and register with the global cookie manager.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@697 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-06-19 16:29:49 +00:00
parent 7e6932cd00
commit 9df142f832
91 changed files with 4881 additions and 392 deletions

View File

@@ -134,30 +134,28 @@ typedef struct _cef_app_t {
void (CEF_CALLBACK *on_register_custom_schemes)(struct _cef_app_t* self,
struct _cef_scheme_registrar_t* registrar);
///
// Return the handler for render process events. This function is called by
// the render process main thread.
///
struct _cef_render_process_handler_t* (
CEF_CALLBACK *get_render_process_handler)(struct _cef_app_t* self);
///
// Return the handler for resource bundle events. If
// CefSettings.pack_loading_disabled is true (1) a handler must be returned.
// If no handler is returned resources will be loaded from pack files. This
// function is called by the browser and rendere processes on multiple
// threads.
// function is called by the browser and render processes on multiple threads.
///
struct _cef_resource_bundle_handler_t* (
CEF_CALLBACK *get_resource_bundle_handler)(struct _cef_app_t* self);
///
// Return the handler for proxy events. If no handler is returned the default
// system handler will be used. This function is called by the browser process
// IO thread.
// Return the handler for functionality specific to the browser process. This
// function is called on multiple threads in the browser process.
///
struct _cef_proxy_handler_t* (CEF_CALLBACK *get_proxy_handler)(
struct _cef_app_t* self);
struct _cef_browser_process_handler_t* (
CEF_CALLBACK *get_browser_process_handler)(struct _cef_app_t* self);
///
// Return the handler for functionality specific to the render process. This
// function is called on the render process main thread.
///
struct _cef_render_process_handler_t* (
CEF_CALLBACK *get_render_process_handler)(struct _cef_app_t* self);
} cef_app_t;

View File

@@ -0,0 +1,80 @@
// Copyright (c) 2012 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "include/capi/cef_base_capi.h"
///
// Structure used to implement browser process callbacks. The functions of this
// structure will be called on the browser process main thread unless otherwise
// indicated.
///
typedef struct _cef_browser_process_handler_t {
///
// Base structure.
///
cef_base_t base;
///
// Return the handler for proxy events. If no handler is returned the default
// system handler will be used. This function is called on the browser process
// IO thread.
///
struct _cef_proxy_handler_t* (CEF_CALLBACK *get_proxy_handler)(
struct _cef_browser_process_handler_t* self);
///
// Called on the browser process UI thread immediately after the CEF context
// has been initialized.
///
void (CEF_CALLBACK *on_context_initialized)(
struct _cef_browser_process_handler_t* self);
} cef_browser_process_handler_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_

View File

@@ -86,7 +86,7 @@ typedef struct _cef_load_handler_t {
///
void (CEF_CALLBACK *on_load_error)(struct _cef_load_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
enum cef_handler_errorcode_t errorCode, const cef_string_t* errorText,
enum cef_errorcode_t errorCode, const cef_string_t* errorText,
const cef_string_t* failedUrl);
} cef_load_handler_t;

View File

@@ -55,6 +55,11 @@ typedef struct _cef_request_t {
///
cef_base_t base;
///
// Returns true (1) if this object is read-only.
///
int (CEF_CALLBACK *is_read_only)(struct _cef_request_t* self);
///
// Get the fully qualified URL.
///
@@ -112,20 +117,20 @@ typedef struct _cef_request_t {
cef_string_multimap_t headerMap);
///
// Get the flags used in combination with CefWebURLRequest.
// Get the flags used in combination with cef_urlrequest_t. See
// cef_urlrequest_flags_t for supported values.
///
enum cef_weburlrequest_flags_t (CEF_CALLBACK *get_flags)(
struct _cef_request_t* self);
int (CEF_CALLBACK *get_flags)(struct _cef_request_t* self);
///
// Set the flags used in combination with CefWebURLRequest.
// Set the flags used in combination with cef_urlrequest_t. See
// cef_urlrequest_flags_t for supported values.
///
void (CEF_CALLBACK *set_flags)(struct _cef_request_t* self,
enum cef_weburlrequest_flags_t flags);
void (CEF_CALLBACK *set_flags)(struct _cef_request_t* self, int flags);
///
// Set the URL to the first party for cookies used in combination with
// CefWebURLRequest.
// cef_urlrequest_t.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_first_party_for_cookies)(
@@ -133,7 +138,7 @@ typedef struct _cef_request_t {
///
// Get the URL to the first party for cookies used in combination with
// CefWebURLRequest.
// cef_urlrequest_t.
///
void (CEF_CALLBACK *set_first_party_for_cookies)(struct _cef_request_t* self,
const cef_string_t* url);
@@ -156,6 +161,11 @@ typedef struct _cef_post_data_t {
///
cef_base_t base;
///
// Returns true (1) if this object is read-only.
///
int (CEF_CALLBACK *is_read_only)(struct _cef_post_data_t* self);
///
// Returns the number of existing post data elements.
///
@@ -203,6 +213,11 @@ typedef struct _cef_post_data_element_t {
///
cef_base_t base;
///
// Returns true (1) if this object is read-only.
///
int (CEF_CALLBACK *is_read_only)(struct _cef_post_data_element_t* self);
///
// Remove all contents from the post data element.
///

View File

@@ -90,6 +90,21 @@ typedef struct _cef_resource_handler_t {
void* data_out, int bytes_to_read, int* bytes_read,
struct _cef_callback_t* callback);
///
// Return true (1) if the specified cookie can be sent with the request or
// false (0) otherwise. If false (0) is returned for any cookie then no
// cookies will be sent with the request.
///
int (CEF_CALLBACK *can_get_cookie)(struct _cef_resource_handler_t* self,
const struct _cef_cookie_t* cookie);
///
// Return true (1) if the specified cookie returned with the response can be
// set or false (0) otherwise.
///
int (CEF_CALLBACK *can_set_cookie)(struct _cef_resource_handler_t* self,
const struct _cef_cookie_t* cookie);
///
// Request processing has been canceled.
///

View File

@@ -55,6 +55,11 @@ typedef struct _cef_response_t {
///
cef_base_t base;
///
// Returns true (1) if this object is read-only.
///
int (CEF_CALLBACK *is_read_only)(struct _cef_response_t* self);
///
// Get the response status code.
///
@@ -112,6 +117,12 @@ typedef struct _cef_response_t {
} cef_response_t;
///
// Create a new cef_response_t object.
///
CEF_EXPORT cef_response_t* cef_response_create();
#ifdef __cplusplus
}
#endif

View File

@@ -140,10 +140,11 @@ typedef struct _cef_scheme_handler_factory_t {
cef_base_t base;
///
// Return a new resource handler instance to handle the request. |browser|
// will be the browser window that initiated the request. If the request was
// initiated using the CefWebURLRequest API |browser| will be NULL. The
// |request| object passed to this function will not contain cookie data.
// Return a new resource handler instance to handle the request. |browser| and
// |frame| will be the browser window and frame respectively that originated
// the request or NULL if the request did not originate from a browser window
// (for example, if the request came from cef_urlrequest_t). The |request|
// object passed to this function will not contain cookie data.
///
struct _cef_resource_handler_t* (CEF_CALLBACK *create)(
struct _cef_scheme_handler_factory_t* self,

View File

@@ -0,0 +1,164 @@
// Copyright (c) 2012 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "include/capi/cef_base_capi.h"
///
// Structure used to make a URL request. URL requests are not associated with a
// browser instance so no cef_client_t callbacks will be executed. URL requests
// can be created on any valid CEF thread in either the browser or render
// process. Once created the functions of the URL request object must be
// accessed on the same thread that created it.
///
typedef struct _cef_urlrequest_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns the request object used to create this URL request. The returned
// object is read-only and should not be modified.
///
struct _cef_request_t* (CEF_CALLBACK *get_request)(
struct _cef_urlrequest_t* self);
///
// Returns the client.
///
struct _cef_urlrequest_client_t* (CEF_CALLBACK *get_client)(
struct _cef_urlrequest_t* self);
///
// Returns the request status.
///
enum cef_urlrequest_status_t (CEF_CALLBACK *get_request_status)(
struct _cef_urlrequest_t* self);
///
// Returns the request error if status is UR_CANCELED or UR_FAILED, or 0
// otherwise.
///
enum cef_errorcode_t (CEF_CALLBACK *get_request_error)(
struct _cef_urlrequest_t* self);
///
// Returns the response, or NULL if no response information is available.
// Response information will only be available after the upload has completed.
// The returned object is read-only and should not be modified.
///
struct _cef_response_t* (CEF_CALLBACK *get_response)(
struct _cef_urlrequest_t* self);
///
// Cancel the request.
///
void (CEF_CALLBACK *cancel)(struct _cef_urlrequest_t* self);
} cef_urlrequest_t;
///
// Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request
// functions are supported. The |request| object will be marked as read-only
// after calling this function.
///
CEF_EXPORT cef_urlrequest_t* cef_urlrequest_create(
struct _cef_request_t* request, struct _cef_urlrequest_client_t* client);
///
// Structure that should be implemented by the cef_urlrequest_t client. The
// functions of this structure will be called on the same thread that created
// the request.
///
typedef struct _cef_urlrequest_client_t {
///
// Base structure.
///
cef_base_t base;
///
// Notifies the client that the request has completed. Use the
// cef_urlrequest_t::GetRequestStatus function to determine if the request was
// successful or not.
///
void (CEF_CALLBACK *on_request_complete)(
struct _cef_urlrequest_client_t* self,
struct _cef_urlrequest_t* request);
///
// Notifies the client of upload progress. |current| denotes the number of
// bytes sent so far and |total| is the total size of uploading data (or -1 if
// chunked upload is enabled). This function will only be called if the
// UR_FLAG_REPORT_UPLOAD_PROGRESS flag is set on the request.
///
void (CEF_CALLBACK *on_upload_progress)(struct _cef_urlrequest_client_t* self,
struct _cef_urlrequest_t* request, uint64 current, uint64 total);
///
// Notifies the client of download progress. |current| denotes the number of
// bytes received up to the call and |total| is the expected total size of the
// response (or -1 if not determined).
///
void (CEF_CALLBACK *on_download_progress)(
struct _cef_urlrequest_client_t* self, struct _cef_urlrequest_t* request,
uint64 current, uint64 total);
///
// Called when some part of the response is read. |data| contains the current
// bytes received since the last call. This function will not be called if the
// UR_FLAG_NO_DOWNLOAD_DATA flag is set on the request.
///
void (CEF_CALLBACK *on_download_data)(struct _cef_urlrequest_client_t* self,
struct _cef_urlrequest_t* request, const void* data,
size_t data_length);
} cef_urlrequest_client_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_

View File

@@ -40,8 +40,8 @@
#pragma once
#include "include/cef_base.h"
#include "include/cef_browser_process_handler.h"
#include "include/cef_command_line.h"
#include "include/cef_proxy_handler.h"
#include "include/cef_render_process_handler.h"
#include "include/cef_resource_bundle_handler.h"
#include "include/cef_scheme.h"
@@ -142,20 +142,11 @@ class CefApp : public virtual CefBase {
CefRefPtr<CefSchemeRegistrar> registrar) {
}
///
// Return the handler for render process events. This method is called by the
// render process main thread.
///
/*--cef()--*/
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() {
return NULL;
}
///
// Return the handler for resource bundle events. If
// CefSettings.pack_loading_disabled is true a handler must be returned. If no
// handler is returned resources will be loaded from pack files. This method
// is called by the browser and rendere processes on multiple threads.
// is called by the browser and render processes on multiple threads.
///
/*--cef()--*/
virtual CefRefPtr<CefResourceBundleHandler> GetResourceBundleHandler() {
@@ -163,12 +154,20 @@ class CefApp : public virtual CefBase {
}
///
// Return the handler for proxy events. If no handler is returned the default
// system handler will be used. This method is called by the browser process
// IO thread.
// Return the handler for functionality specific to the browser process. This
// method is called on multiple threads in the browser process.
///
/*--cef()--*/
virtual CefRefPtr<CefProxyHandler> GetProxyHandler() {
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() {
return NULL;
}
///
// Return the handler for functionality specific to the render process. This
// method is called on the render process main thread.
///
/*--cef()--*/
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() {
return NULL;
}
};

View File

@@ -0,0 +1,69 @@
// Copyright (c) 2012 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.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_BROWSER_PROCESS_HANDLER_H_
#define CEF_INCLUDE_CEF_BROWSER_PROCESS_HANDLER_H_
#pragma once
#include "include/cef_base.h"
#include "include/cef_proxy_handler.h"
///
// Class used to implement browser process callbacks. The methods of this class
// will be called on the browser process main thread unless otherwise indicated.
///
/*--cef(source=client)--*/
class CefBrowserProcessHandler : public virtual CefBase {
public:
///
// Return the handler for proxy events. If no handler is returned the default
// system handler will be used. This method is called on the browser process
// IO thread.
///
/*--cef()--*/
virtual CefRefPtr<CefProxyHandler> GetProxyHandler() {
return NULL;
}
///
// Called on the browser process UI thread immediately after the CEF context
// has been initialized.
///
/*--cef()--*/
virtual void OnContextInitialized() {}
};
#endif // CEF_INCLUDE_CEF_BROWSER_PROCESS_HANDLER_H_

View File

@@ -49,7 +49,7 @@
/*--cef(source=client)--*/
class CefLoadHandler : public virtual CefBase {
public:
typedef cef_handler_errorcode_t ErrorCode;
typedef cef_errorcode_t ErrorCode;
///
// Called when the browser begins loading a frame. The |frame| value will

View File

@@ -49,23 +49,29 @@ class CefPostDataElement;
// Class used to represent a web request. The methods of this class may be
// called on any thread.
///
/*--cef(source=library)--*/
/*--cef(source=library,no_debugct_check)--*/
class CefRequest : public virtual CefBase {
public:
typedef std::multimap<CefString, CefString> HeaderMap;
typedef cef_weburlrequest_flags_t RequestFlags;
///
// Create a new CefRequest object.
///
/*--cef()--*/
static CefRefPtr<CefRequest> CreateRequest();
static CefRefPtr<CefRequest> Create();
///
// Returns true if this object is read-only.
///
/*--cef()--*/
virtual bool IsReadOnly() =0;
///
// Get the fully qualified URL.
///
/*--cef()--*/
virtual CefString GetURL() =0;
///
// Set the fully qualified URL.
///
@@ -78,6 +84,7 @@ class CefRequest : public virtual CefBase {
///
/*--cef()--*/
virtual CefString GetMethod() =0;
///
// Set the request method type.
///
@@ -89,6 +96,7 @@ class CefRequest : public virtual CefBase {
///
/*--cef()--*/
virtual CefRefPtr<CefPostData> GetPostData() =0;
///
// Set the post data.
///
@@ -100,6 +108,7 @@ class CefRequest : public virtual CefBase {
///
/*--cef()--*/
virtual void GetHeaderMap(HeaderMap& headerMap) =0;
///
// Set the header values.
///
@@ -116,25 +125,29 @@ class CefRequest : public virtual CefBase {
const HeaderMap& headerMap) =0;
///
// Get the flags used in combination with CefWebURLRequest.
// Get the flags used in combination with CefURLRequest. See
// cef_urlrequest_flags_t for supported values.
///
/*--cef(default_retval=WUR_FLAG_NONE)--*/
virtual RequestFlags GetFlags() =0;
/*--cef(default_retval=UR_FLAG_NONE)--*/
virtual int GetFlags() =0;
///
// Set the flags used in combination with CefWebURLRequest.
// Set the flags used in combination with CefURLRequest. See
// cef_urlrequest_flags_t for supported values.
///
/*--cef()--*/
virtual void SetFlags(RequestFlags flags) =0;
virtual void SetFlags(int flags) =0;
///
// Set the URL to the first party for cookies used in combination with
// CefWebURLRequest.
// CefURLRequest.
///
/*--cef()--*/
virtual CefString GetFirstPartyForCookies() =0;
///
// Get the URL to the first party for cookies used in combination with
// CefWebURLRequest.
// CefURLRequest.
///
/*--cef()--*/
virtual void SetFirstPartyForCookies(const CefString& url) =0;
@@ -145,7 +158,7 @@ class CefRequest : public virtual CefBase {
// Class used to represent post data for a web request. The methods of this
// class may be called on any thread.
///
/*--cef(source=library)--*/
/*--cef(source=library,no_debugct_check)--*/
class CefPostData : public virtual CefBase {
public:
typedef std::vector<CefRefPtr<CefPostDataElement> > ElementVector;
@@ -154,7 +167,13 @@ class CefPostData : public virtual CefBase {
// Create a new CefPostData object.
///
/*--cef()--*/
static CefRefPtr<CefPostData> CreatePostData();
static CefRefPtr<CefPostData> Create();
///
// Returns true if this object is read-only.
///
/*--cef()--*/
virtual bool IsReadOnly() =0;
///
// Returns the number of existing post data elements.
@@ -193,7 +212,7 @@ class CefPostData : public virtual CefBase {
// Class used to represent a single element in the request post data. The
// methods of this class may be called on any thread.
///
/*--cef(source=library)--*/
/*--cef(source=library,no_debugct_check)--*/
class CefPostDataElement : public virtual CefBase {
public:
///
@@ -205,7 +224,13 @@ class CefPostDataElement : public virtual CefBase {
// Create a new CefPostDataElement object.
///
/*--cef()--*/
static CefRefPtr<CefPostDataElement> CreatePostDataElement();
static CefRefPtr<CefPostDataElement> Create();
///
// Returns true if this object is read-only.
///
/*--cef()--*/
virtual bool IsReadOnly() =0;
///
// Remove all contents from the post data element.

View File

@@ -41,6 +41,7 @@
#include "include/cef_base.h"
#include "include/cef_browser.h"
#include "include/cef_callback.h"
#include "include/cef_cookie.h"
#include "include/cef_request.h"
#include "include/cef_response.h"
@@ -90,6 +91,21 @@ class CefResourceHandler : public virtual CefBase {
int& bytes_read,
CefRefPtr<CefCallback> callback) =0;
///
// Return true if the specified cookie can be sent with the request or false
// otherwise. If false is returned for any cookie then no cookies will be sent
// with the request.
///
/*--cef()--*/
virtual bool CanGetCookie(const CefCookie& cookie) { return true; }
///
// Return true if the specified cookie returned with the response can be set
// or false otherwise.
///
/*--cef()--*/
virtual bool CanSetCookie(const CefCookie& cookie) { return true; }
///
// Request processing has been canceled.
///

View File

@@ -45,16 +45,29 @@
// Class used to represent a web response. The methods of this class may be
// called on any thread.
///
/*--cef(source=library)--*/
/*--cef(source=library,no_debugct_check)--*/
class CefResponse : public virtual CefBase {
public:
typedef std::multimap<CefString, CefString> HeaderMap;
///
// Create a new CefResponse object.
///
/*--cef()--*/
static CefRefPtr<CefResponse> Create();
///
// Returns true if this object is read-only.
///
/*--cef()--*/
virtual bool IsReadOnly() =0;
///
// Get the response status code.
///
/*--cef()--*/
virtual int GetStatus() =0;
///
// Set the response status code.
///
@@ -66,6 +79,7 @@ class CefResponse : public virtual CefBase {
///
/*--cef()--*/
virtual CefString GetStatusText() =0;
///
// Set the response status text.
///
@@ -77,6 +91,7 @@ class CefResponse : public virtual CefBase {
///
/*--cef()--*/
virtual CefString GetMimeType() = 0;
///
// Set the response mime type.
///
@@ -94,6 +109,7 @@ class CefResponse : public virtual CefBase {
///
/*--cef()--*/
virtual void GetHeaderMap(HeaderMap& headerMap) =0;
///
// Set all response header fields.
///

View File

@@ -143,11 +143,12 @@ class CefSchemeHandlerFactory : public virtual CefBase {
public:
///
// Return a new resource handler instance to handle the request. |browser|
// will be the browser window that initiated the request. If the request was
// initiated using the CefWebURLRequest API |browser| will be NULL. The
// and |frame| will be the browser window and frame respectively that
// originated the request or NULL if the request did not originate from a
// browser window (for example, if the request came from CefURLRequest). The
// |request| object passed to this method will not contain cookie data.
///
/*--cef()--*/
/*--cef(optional_param=browser,optional_param=frame)--*/
virtual CefRefPtr<CefResourceHandler> Create(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,

159
include/cef_urlrequest.h Normal file
View File

@@ -0,0 +1,159 @@
// Copyright (c) 2012 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.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_URLREQUEST_H_
#define CEF_INCLUDE_CEF_URLREQUEST_H_
#pragma once
#include "include/cef_base.h"
#include "include/cef_request.h"
#include "include/cef_response.h"
class CefURLRequestClient;
///
// Class used to make a URL request. URL requests are not associated with a
// browser instance so no CefClient callbacks will be executed. URL requests
// can be created on any valid CEF thread in either the browser or render
// process. Once created the methods of the URL request object must be accessed
// on the same thread that created it.
///
/*--cef(source=library)--*/
class CefURLRequest : public virtual CefBase {
public:
typedef cef_urlrequest_status_t Status;
typedef cef_errorcode_t ErrorCode;
///
// Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request
// methods are supported. The |request| object will be marked as read-only
// after calling this method.
///
/*--cef()--*/
static CefRefPtr<CefURLRequest> Create(
CefRefPtr<CefRequest> request,
CefRefPtr<CefURLRequestClient> client);
///
// Returns the request object used to create this URL request. The returned
// object is read-only and should not be modified.
///
/*--cef()--*/
virtual CefRefPtr<CefRequest> GetRequest() =0;
///
// Returns the client.
///
/*--cef()--*/
virtual CefRefPtr<CefURLRequestClient> GetClient() =0;
///
// Returns the request status.
///
/*--cef(default_retval=UR_UNKNOWN)--*/
virtual Status GetRequestStatus() =0;
///
// Returns the request error if status is UR_CANCELED or UR_FAILED, or 0
// otherwise.
///
/*--cef(default_retval=ERR_NONE)--*/
virtual ErrorCode GetRequestError() =0;
///
// Returns the response, or NULL if no response information is available.
// Response information will only be available after the upload has completed.
// The returned object is read-only and should not be modified.
///
/*--cef()--*/
virtual CefRefPtr<CefResponse> GetResponse() =0;
///
// Cancel the request.
///
/*--cef()--*/
virtual void Cancel() =0;
};
///
// Interface that should be implemented by the CefURLRequest client. The
// methods of this class will be called on the same thread that created the
// request.
///
/*--cef(source=client)--*/
class CefURLRequestClient : public virtual CefBase {
public:
///
// Notifies the client that the request has completed. Use the
// CefURLRequest::GetRequestStatus method to determine if the request was
// successful or not.
///
/*--cef()--*/
virtual void OnRequestComplete(CefRefPtr<CefURLRequest> request) =0;
///
// Notifies the client of upload progress. |current| denotes the number of
// bytes sent so far and |total| is the total size of uploading data (or -1 if
// chunked upload is enabled). This method will only be called if the
// UR_FLAG_REPORT_UPLOAD_PROGRESS flag is set on the request.
///
/*--cef()--*/
virtual void OnUploadProgress(CefRefPtr<CefURLRequest> request,
uint64 current,
uint64 total) =0;
///
// Notifies the client of download progress. |current| denotes the number of
// bytes received up to the call and |total| is the expected total size of the
// response (or -1 if not determined).
///
/*--cef()--*/
virtual void OnDownloadProgress(CefRefPtr<CefURLRequest> request,
uint64 current,
uint64 total) =0;
///
// Called when some part of the response is read. |data| contains the current
// bytes received since the last call. This method will not be called if the
// UR_FLAG_NO_DOWNLOAD_DATA flag is set on the request.
///
/*--cef()--*/
virtual void OnDownloadData(CefRefPtr<CefURLRequest> request,
const void* data,
size_t data_length) =0;
};
#endif // CEF_INCLUDE_CEF_URLREQUEST_H_

View File

@@ -57,6 +57,10 @@
#define CEF_INCLUDE_INTERNAL_CEF_TUPLE_H_
#pragma once
// If base/tuple.h is included first then exclude this file. This is to
// facilitate the use of both base/bind.h and cef_runnable.h in unit tests.
#ifndef BASE_TUPLE_H__
#if defined(OS_CHROMEOS)
// To troubleshoot crosbug.com/7327.
#include "base/logging.h"
@@ -1079,4 +1083,6 @@ inline void DispatchToMethod(ObjT* obj, Method method,
&out->a, &out->b, &out->c, &out->d, &out->e);
}
#endif // BASE_TUPLE_H__
#endif // CEF_INCLUDE_INTERNAL_CEF_TUPLE_H_

View File

@@ -565,7 +565,8 @@ enum cef_storage_type_t {
// Supported error code values. See net\base\net_error_list.h for complete
// descriptions of the error codes.
///
enum cef_handler_errorcode_t {
enum cef_errorcode_t {
ERR_NONE = 0,
ERR_FAILED = -2,
ERR_ABORTED = -3,
ERR_INVALID_ARGUMENT = -4,
@@ -646,14 +647,95 @@ enum cef_postdataelement_type_t {
PDE_TYPE_FILE,
};
enum cef_weburlrequest_flags_t {
WUR_FLAG_NONE = 0,
WUR_FLAG_SKIP_CACHE = 0x1,
WUR_FLAG_ALLOW_CACHED_CREDENTIALS = 0x2,
WUR_FLAG_ALLOW_COOKIES = 0x4,
WUR_FLAG_REPORT_UPLOAD_PROGRESS = 0x8,
WUR_FLAG_REPORT_LOAD_TIMING = 0x10,
WUR_FLAG_REPORT_RAW_HEADERS = 0x20
///
// Flags used to customize the behavior of CefURLRequest.
///
enum cef_urlrequest_flags_t {
///
// Default behavior.
///
UR_FLAG_NONE = 0,
///
// If set the cache will be skipped when handling the request.
///
UR_FLAG_SKIP_CACHE = 1 << 0,
///
// If set user name, password, and cookies may be sent with the request.
///
UR_FLAG_ALLOW_CACHED_CREDENTIALS = 1 << 1,
///
// If set cookies may be sent with the request and saved from the response.
// UR_FLAG_ALLOW_CACHED_CREDENTIALS must also be set.
///
UR_FLAG_ALLOW_COOKIES = 1 << 2,
///
// If set upload progress events will be generated when a request has a body.
///
UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 << 3,
///
// If set load timing info will be collected for the request.
///
UR_FLAG_REPORT_LOAD_TIMING = 1 << 4,
///
// If set the headers sent and received for the request will be recorded.
///
UR_FLAG_REPORT_RAW_HEADERS = 1 << 5,
///
// If set the CefURLRequestClient::OnDownloadData method will not be called.
///
UR_FLAG_NO_DOWNLOAD_DATA = 1 << 6,
///
// If set 5XX redirect errors will be propagated to the observer instead of
// automatically re-tried. This currently only applies for requests
// originated in the browser process.
///
UR_FLAG_NO_RETRY_ON_5XX = 1 << 7,
};
///
// Flags that represent CefURLRequest status.
///
enum cef_urlrequest_status_t {
///
// Unknown status.
///
UR_UNKNOWN = 0,
///
// Request succeeded.
///
UR_SUCCESS,
///
// An IO request is pending, and the caller will be informed when it is
// completed.
///
UR_IO_PENDING,
///
// Request was successful but was handled by an external program, so there
// is no response data. This usually means the current page should not be
// navigated, but no error should be displayed.
///
UR_HANDLED_EXTERNALLY,
///
// Request was canceled programatically.
///
UR_CANCELED,
///
// Request failed for some reason.
///
UR_FAILED,
};
///