mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-18 05:00:48 +01:00
- Update to Chromium revision 133430.
- Move custom scheme registration to CefApp::OnRegisterCustomSchemes(). This is required by the introduction of ContentClient::AddAdditionalSchemes() and fixes a race condition when registering standard schemes in different processes. - Execute V8 functions using V8Proxy. This is required for inspector instrumentation to work correctly and fixes an assertion in WebCore related to V8RecursionScope. - Enable verbose V8 TryCatch logging. - Mac: Expose UnderlayOpenGLHostingWindow interface that should be used for all CEF windows. - Add CefSettings.remote_debugging_port option. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@602 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
97561ac51a
commit
6c8f4644aa
@ -17,5 +17,5 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'chromium_url': 'http://src.chromium.org/svn/trunk/src',
|
'chromium_url': 'http://src.chromium.org/svn/trunk/src',
|
||||||
'chromium_revision': '131752',
|
'chromium_revision': '133430',
|
||||||
}
|
}
|
||||||
|
11
cef.gyp
11
cef.gyp
@ -802,7 +802,6 @@
|
|||||||
'libcef/browser/resource_request_job.cc',
|
'libcef/browser/resource_request_job.cc',
|
||||||
'libcef/browser/resource_request_job.h',
|
'libcef/browser/resource_request_job.h',
|
||||||
'libcef/browser/scheme_impl.cc',
|
'libcef/browser/scheme_impl.cc',
|
||||||
'libcef/browser/scheme_impl.h',
|
|
||||||
'libcef/browser/sqlite_diagnostics_stub.cc',
|
'libcef/browser/sqlite_diagnostics_stub.cc',
|
||||||
'libcef/browser/stream_impl.cc',
|
'libcef/browser/stream_impl.cc',
|
||||||
'libcef/browser/stream_impl.h',
|
'libcef/browser/stream_impl.h',
|
||||||
@ -840,6 +839,8 @@
|
|||||||
'libcef/common/response_impl.h',
|
'libcef/common/response_impl.h',
|
||||||
'libcef/common/response_manager.cc',
|
'libcef/common/response_manager.cc',
|
||||||
'libcef/common/response_manager.h',
|
'libcef/common/response_manager.h',
|
||||||
|
'libcef/common/scheme_registrar_impl.cc',
|
||||||
|
'libcef/common/scheme_registrar_impl.h',
|
||||||
'libcef/common/string_list_impl.cc',
|
'libcef/common/string_list_impl.cc',
|
||||||
'libcef/common/string_map_impl.cc',
|
'libcef/common/string_map_impl.cc',
|
||||||
'libcef/common/string_multimap_impl.cc',
|
'libcef/common/string_multimap_impl.cc',
|
||||||
@ -862,8 +863,6 @@
|
|||||||
'libcef/renderer/content_renderer_client.h',
|
'libcef/renderer/content_renderer_client.h',
|
||||||
'libcef/renderer/frame_impl.cc',
|
'libcef/renderer/frame_impl.cc',
|
||||||
'libcef/renderer/frame_impl.h',
|
'libcef/renderer/frame_impl.h',
|
||||||
'libcef/renderer/render_message_filter.cc',
|
|
||||||
'libcef/renderer/render_message_filter.h',
|
|
||||||
'libcef/renderer/render_process_observer.cc',
|
'libcef/renderer/render_process_observer.cc',
|
||||||
'libcef/renderer/render_process_observer.h',
|
'libcef/renderer/render_process_observer.h',
|
||||||
'libcef/renderer/thread_util.h',
|
'libcef/renderer/thread_util.h',
|
||||||
@ -1053,11 +1052,17 @@
|
|||||||
'sources': [
|
'sources': [
|
||||||
'tests/cefclient/client_app.cpp',
|
'tests/cefclient/client_app.cpp',
|
||||||
'tests/cefclient/client_app.h',
|
'tests/cefclient/client_app.h',
|
||||||
|
'tests/cefclient/client_switches.cpp',
|
||||||
|
'tests/cefclient/client_switches.h',
|
||||||
'tests/cefclient/process_helper_mac.cpp',
|
'tests/cefclient/process_helper_mac.cpp',
|
||||||
'tests/unittests/client_app_delegates.cc',
|
'tests/unittests/client_app_delegates.cc',
|
||||||
|
'tests/unittests/cookie_unittest.cc',
|
||||||
'tests/unittests/process_message_unittest.cc',
|
'tests/unittests/process_message_unittest.cc',
|
||||||
|
'tests/unittests/scheme_handler_unittest.cc',
|
||||||
'tests/unittests/test_handler.cc',
|
'tests/unittests/test_handler.cc',
|
||||||
'tests/unittests/test_handler.h',
|
'tests/unittests/test_handler.h',
|
||||||
|
'tests/unittests/test_suite.cc',
|
||||||
|
'tests/unittests/test_suite.h',
|
||||||
'tests/unittests/test_util.cc',
|
'tests/unittests/test_util.cc',
|
||||||
'tests/unittests/test_util.h',
|
'tests/unittests/test_util.h',
|
||||||
'tests/unittests/v8_unittest.cc',
|
'tests/unittests/v8_unittest.cc',
|
||||||
|
@ -150,6 +150,8 @@
|
|||||||
'libcef_dll/cpptoc/response_cpptoc.h',
|
'libcef_dll/cpptoc/response_cpptoc.h',
|
||||||
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc',
|
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h',
|
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h',
|
||||||
|
'libcef_dll/cpptoc/scheme_registrar_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/scheme_registrar_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/stream_reader_cpptoc.cc',
|
'libcef_dll/cpptoc/stream_reader_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/stream_reader_cpptoc.h',
|
'libcef_dll/cpptoc/stream_reader_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/stream_writer_cpptoc.cc',
|
'libcef_dll/cpptoc/stream_writer_cpptoc.cc',
|
||||||
@ -246,6 +248,8 @@
|
|||||||
'libcef_dll/ctocpp/response_ctocpp.h',
|
'libcef_dll/ctocpp/response_ctocpp.h',
|
||||||
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc',
|
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h',
|
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h',
|
||||||
|
'libcef_dll/ctocpp/scheme_registrar_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/scheme_registrar_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/stream_reader_ctocpp.cc',
|
'libcef_dll/ctocpp/stream_reader_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/stream_reader_ctocpp.h',
|
'libcef_dll/ctocpp/stream_reader_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/stream_writer_ctocpp.cc',
|
'libcef_dll/ctocpp/stream_writer_ctocpp.cc',
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
'variables': {
|
'variables': {
|
||||||
'includes_common': [
|
'includes_common': [
|
||||||
'include/cef_base.h',
|
'include/cef_base.h',
|
||||||
|
'include/cef_pack_resources.h',
|
||||||
|
'include/cef_pack_strings.h',
|
||||||
'include/cef_runnable.h',
|
'include/cef_runnable.h',
|
||||||
'include/cef_version.h',
|
'include/cef_version.h',
|
||||||
'include/internal/cef_build.h',
|
'include/internal/cef_build.h',
|
||||||
@ -130,6 +132,8 @@
|
|||||||
'tests/cefclient/process_helper_mac.cpp',
|
'tests/cefclient/process_helper_mac.cpp',
|
||||||
'tests/cefclient/resource_util.h',
|
'tests/cefclient/resource_util.h',
|
||||||
'tests/cefclient/resource_util_mac.mm',
|
'tests/cefclient/resource_util_mac.mm',
|
||||||
|
'tests/cefclient/scheme_test.cpp',
|
||||||
|
'tests/cefclient/scheme_test.h',
|
||||||
'tests/cefclient/string_util.cpp',
|
'tests/cefclient/string_util.cpp',
|
||||||
'tests/cefclient/string_util.h',
|
'tests/cefclient/string_util.h',
|
||||||
'tests/cefclient/util.h',
|
'tests/cefclient/util.h',
|
||||||
|
@ -125,6 +125,15 @@ typedef struct _cef_app_t {
|
|||||||
struct _cef_app_t* self, const cef_string_t* process_type,
|
struct _cef_app_t* self, const cef_string_t* process_type,
|
||||||
struct _cef_command_line_t* command_line);
|
struct _cef_command_line_t* command_line);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Provides an opportunity to register custom schemes. Do not keep a reference
|
||||||
|
// to the |registrar| object. This function is called on the main thread for
|
||||||
|
// each process and the registered schemes should be the same across all
|
||||||
|
// processes.
|
||||||
|
///
|
||||||
|
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
|
// Return the handler for render process events. This function is called by
|
||||||
// the render process main thread.
|
// the render process main thread.
|
||||||
|
@ -144,8 +144,8 @@ typedef struct _cef_frame_t {
|
|||||||
// reporting.
|
// reporting.
|
||||||
///
|
///
|
||||||
void (CEF_CALLBACK *execute_java_script)(struct _cef_frame_t* self,
|
void (CEF_CALLBACK *execute_java_script)(struct _cef_frame_t* self,
|
||||||
const cef_string_t* jsCode, const cef_string_t* scriptUrl,
|
const cef_string_t* code, const cef_string_t* script_url,
|
||||||
int startLine);
|
int start_line);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Returns true (1) if this is the main (top-level) frame.
|
// Returns true (1) if this is the main (top-level) frame.
|
||||||
|
@ -45,53 +45,6 @@ extern "C" {
|
|||||||
#include "include/capi/cef_base_capi.h"
|
#include "include/capi/cef_base_capi.h"
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
// Register a custom scheme. This function should not be called for the built-in
|
|
||||||
// HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes.
|
|
||||||
//
|
|
||||||
// If |is_standard| is true (1) the scheme will be treated as a standard scheme.
|
|
||||||
// Standard schemes are subject to URL canonicalization and parsing rules as
|
|
||||||
// defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1 available
|
|
||||||
// at http://www.ietf.org/rfc/rfc1738.txt
|
|
||||||
//
|
|
||||||
// In particular, the syntax for standard scheme URLs must be of the form: <pre>
|
|
||||||
// [scheme]://[username]:[password]@[host]:[port]/[url-path]
|
|
||||||
// </pre> Standard scheme URLs must have a host component that is a fully
|
|
||||||
// qualified domain name as defined in Section 3.5 of RFC 1034 [13] and Section
|
|
||||||
// 2.1 of RFC 1123. These URLs will be canonicalized to "scheme://host/path" in
|
|
||||||
// the simplest case and "scheme://username:password@host:port/path" in the most
|
|
||||||
// explicit case. For example, "scheme:host/path" and "scheme:///host/path" will
|
|
||||||
// both be canonicalized to "scheme://host/path". The origin of a standard
|
|
||||||
// scheme URL is the combination of scheme, host and port (i.e.,
|
|
||||||
// "scheme://host:port" in the most explicit case).
|
|
||||||
//
|
|
||||||
// For non-standard scheme URLs only the "scheme:" component is parsed and
|
|
||||||
// canonicalized. The remainder of the URL will be passed to the handler as-is.
|
|
||||||
// For example, "scheme:///some%20text" will remain the same. Non-standard
|
|
||||||
// scheme URLs cannot be used as a target for form submission.
|
|
||||||
//
|
|
||||||
// If |is_local| is true (1) the scheme will be treated as local (i.e., with the
|
|
||||||
// same security rules as those applied to "file" URLs). Normal pages cannot
|
|
||||||
// link to or access local URLs. Also, by default, local URLs can only perform
|
|
||||||
// XMLHttpRequest calls to the same URL (origin + path) that originated the
|
|
||||||
// request. To allow XMLHttpRequest calls from a local URL to other URLs with
|
|
||||||
// the same origin set the CefSettings.file_access_from_file_urls_allowed value
|
|
||||||
// to true (1). To allow XMLHttpRequest calls from a local URL to all origins
|
|
||||||
// set the CefSettings.universal_access_from_file_urls_allowed value to true
|
|
||||||
// (1).
|
|
||||||
//
|
|
||||||
// If |is_display_isolated| is true (1) the scheme will be treated as display-
|
|
||||||
// isolated. This means that pages cannot display these URLs unless they are
|
|
||||||
// from the same scheme. For example, pages in another origin cannot create
|
|
||||||
// iframes or hyperlinks to URLs with this scheme.
|
|
||||||
//
|
|
||||||
// This function may be called on any thread. It should only be called once per
|
|
||||||
// unique |scheme_name| value. If |scheme_name| is already registered or if an
|
|
||||||
// error occurs this function will return false (0).
|
|
||||||
///
|
|
||||||
CEF_EXPORT int cef_register_custom_scheme(const cef_string_t* scheme_name,
|
|
||||||
int is_standard, int is_local, int is_display_isolated);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Register a scheme handler factory for the specified |scheme_name| and
|
// Register a scheme handler factory for the specified |scheme_name| and
|
||||||
// optional |domain_name|. An NULL |domain_name| value for a standard scheme
|
// optional |domain_name|. An NULL |domain_name| value for a standard scheme
|
||||||
@ -99,7 +52,7 @@ CEF_EXPORT int cef_register_custom_scheme(const cef_string_t* scheme_name,
|
|||||||
// will be ignored for non-standard schemes. If |scheme_name| is a built-in
|
// will be ignored for non-standard schemes. If |scheme_name| is a built-in
|
||||||
// scheme and no handler is returned by |factory| then the built-in scheme
|
// scheme and no handler is returned by |factory| then the built-in scheme
|
||||||
// handler factory will be called. If |scheme_name| is a custom scheme the
|
// handler factory will be called. If |scheme_name| is a custom scheme the
|
||||||
// cef_register_custom_scheme() function should be called for that scheme. This
|
// CefRegisterCustomScheme() function should be called for that scheme. This
|
||||||
// function may be called multiple times to change or remove the factory that
|
// function may be called multiple times to change or remove the factory that
|
||||||
// matches the specified |scheme_name| and optional |domain_name|. Returns false
|
// matches the specified |scheme_name| and optional |domain_name|. Returns false
|
||||||
// (0) if an error occurs. This function may be called on any thread.
|
// (0) if an error occurs. This function may be called on any thread.
|
||||||
@ -114,6 +67,67 @@ CEF_EXPORT int cef_register_scheme_handler_factory(
|
|||||||
///
|
///
|
||||||
CEF_EXPORT int cef_clear_scheme_handler_factories();
|
CEF_EXPORT int cef_clear_scheme_handler_factories();
|
||||||
|
|
||||||
|
///
|
||||||
|
// Structure that manages custom scheme registrations.
|
||||||
|
///
|
||||||
|
typedef struct _cef_scheme_registrar_t {
|
||||||
|
///
|
||||||
|
// Base structure.
|
||||||
|
///
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Register a custom scheme. This function should not be called for the built-
|
||||||
|
// in HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes.
|
||||||
|
//
|
||||||
|
// If |is_standard| is true (1) the scheme will be treated as a standard
|
||||||
|
// scheme. Standard schemes are subject to URL canonicalization and parsing
|
||||||
|
// rules as defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1
|
||||||
|
// available at http://www.ietf.org/rfc/rfc1738.txt
|
||||||
|
//
|
||||||
|
// In particular, the syntax for standard scheme URLs must be of the form:
|
||||||
|
// <pre>
|
||||||
|
// [scheme]://[username]:[password]@[host]:[port]/[url-path]
|
||||||
|
// </pre> Standard scheme URLs must have a host component that is a fully
|
||||||
|
// qualified domain name as defined in Section 3.5 of RFC 1034 [13] and
|
||||||
|
// Section 2.1 of RFC 1123. These URLs will be canonicalized to
|
||||||
|
// "scheme://host/path" in the simplest case and
|
||||||
|
// "scheme://username:password@host:port/path" in the most explicit case. For
|
||||||
|
// example, "scheme:host/path" and "scheme:///host/path" will both be
|
||||||
|
// canonicalized to "scheme://host/path". The origin of a standard scheme URL
|
||||||
|
// is the combination of scheme, host and port (i.e., "scheme://host:port" in
|
||||||
|
// the most explicit case).
|
||||||
|
//
|
||||||
|
// For non-standard scheme URLs only the "scheme:" component is parsed and
|
||||||
|
// canonicalized. The remainder of the URL will be passed to the handler as-
|
||||||
|
// is. For example, "scheme:///some%20text" will remain the same. Non-standard
|
||||||
|
// scheme URLs cannot be used as a target for form submission.
|
||||||
|
//
|
||||||
|
// If |is_local| is true (1) the scheme will be treated as local (i.e., with
|
||||||
|
// the same security rules as those applied to "file" URLs). Normal pages
|
||||||
|
// cannot link to or access local URLs. Also, by default, local URLs can only
|
||||||
|
// perform XMLHttpRequest calls to the same URL (origin + path) that
|
||||||
|
// originated the request. To allow XMLHttpRequest calls from a local URL to
|
||||||
|
// other URLs with the same origin set the
|
||||||
|
// CefSettings.file_access_from_file_urls_allowed value to true (1). To allow
|
||||||
|
// XMLHttpRequest calls from a local URL to all origins set the
|
||||||
|
// CefSettings.universal_access_from_file_urls_allowed value to true (1).
|
||||||
|
//
|
||||||
|
// If |is_display_isolated| is true (1) the scheme will be treated as display-
|
||||||
|
// isolated. This means that pages cannot display these URLs unless they are
|
||||||
|
// from the same scheme. For example, pages in another origin cannot create
|
||||||
|
// iframes or hyperlinks to URLs with this scheme.
|
||||||
|
//
|
||||||
|
// This function may be called on any thread. It should only be called once
|
||||||
|
// per unique |scheme_name| value. If |scheme_name| is already registered or
|
||||||
|
// if an error occurs this function will return false (0).
|
||||||
|
///
|
||||||
|
int (CEF_CALLBACK *add_custom_scheme)(struct _cef_scheme_registrar_t* self,
|
||||||
|
const cef_string_t* scheme_name, int is_standard, int is_local,
|
||||||
|
int is_display_isolated);
|
||||||
|
} cef_scheme_registrar_t;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Structure that creates cef_resource_handler_t instances for handling scheme
|
// Structure that creates cef_resource_handler_t instances for handling scheme
|
||||||
// requests. The functions of this structure will always be called on the IO
|
// requests. The functions of this structure will always be called on the IO
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "include/cef_proxy_handler.h"
|
#include "include/cef_proxy_handler.h"
|
||||||
#include "include/cef_render_process_handler.h"
|
#include "include/cef_render_process_handler.h"
|
||||||
#include "include/cef_resource_bundle_handler.h"
|
#include "include/cef_resource_bundle_handler.h"
|
||||||
|
#include "include/cef_scheme.h"
|
||||||
|
|
||||||
class CefApp;
|
class CefApp;
|
||||||
|
|
||||||
@ -130,6 +131,17 @@ class CefApp : public virtual CefBase {
|
|||||||
CefRefPtr<CefCommandLine> command_line) {
|
CefRefPtr<CefCommandLine> command_line) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
// Provides an opportunity to register custom schemes. Do not keep a reference
|
||||||
|
// to the |registrar| object. This method is called on the main thread for
|
||||||
|
// each process and the registered schemes should be the same across all
|
||||||
|
// processes.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual void OnRegisterCustomSchemes(
|
||||||
|
CefRefPtr<CefSchemeRegistrar> registrar) {
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
// Return the handler for render process events. This method is called by the
|
// Return the handler for render process events. This method is called by the
|
||||||
// render process main thread.
|
// render process main thread.
|
||||||
|
@ -66,9 +66,10 @@
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
// Copy of definition from ui/base/cocoa/underlay_opengl_hosting_window.h.
|
// Copy of definition from ui/base/cocoa/underlay_opengl_hosting_window.h.
|
||||||
@protocol UnderlayableSurface
|
// Common base class for windows that host a OpenGL surface that renders under
|
||||||
- (void)underlaySurfaceAdded;
|
// the window. Contains methods relating to hole punching so that the OpenGL
|
||||||
- (void)underlaySurfaceRemoved;
|
// surface is visible through the window.
|
||||||
|
@interface UnderlayOpenGLHostingWindow : NSWindow
|
||||||
@end
|
@end
|
||||||
|
|
||||||
// The Mac OS X 10.6 SDK introduced new protocols used for delegates. These
|
// The Mac OS X 10.6 SDK introduced new protocols used for delegates. These
|
||||||
@ -112,11 +113,6 @@ DEFINE_EMPTY_PROTOCOL(NSWindowDelegate)
|
|||||||
@protocol CefAppProtocol<CrAppControlProtocol>
|
@protocol CefAppProtocol<CrAppControlProtocol>
|
||||||
@end
|
@end
|
||||||
|
|
||||||
// All CEF windows should implement this protocol to be informed explicitly
|
|
||||||
// about underlay surfaces.
|
|
||||||
@protocol CefUnderlayableSurface<UnderlayableSurface>
|
|
||||||
@end
|
|
||||||
|
|
||||||
// Controls the state of |isHandlingSendEvent| in the event loop so that it is
|
// Controls the state of |isHandlingSendEvent| in the event loop so that it is
|
||||||
// reset properly.
|
// reset properly.
|
||||||
class CefScopedSendingEvent {
|
class CefScopedSendingEvent {
|
||||||
|
@ -151,10 +151,10 @@ class CefFrame : public virtual CefBase {
|
|||||||
// error. The |start_line| parameter is the base line number to use for error
|
// error. The |start_line| parameter is the base line number to use for error
|
||||||
// reporting.
|
// reporting.
|
||||||
///
|
///
|
||||||
/*--cef(optional_param=scriptUrl)--*/
|
/*--cef(optional_param=script_url)--*/
|
||||||
virtual void ExecuteJavaScript(const CefString& jsCode,
|
virtual void ExecuteJavaScript(const CefString& code,
|
||||||
const CefString& scriptUrl,
|
const CefString& script_url,
|
||||||
int startLine) =0;
|
int start_line) =0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Returns true if this is the main (top-level) frame.
|
// Returns true if this is the main (top-level) frame.
|
||||||
|
@ -47,56 +47,6 @@
|
|||||||
|
|
||||||
class CefSchemeHandlerFactory;
|
class CefSchemeHandlerFactory;
|
||||||
|
|
||||||
///
|
|
||||||
// Register a custom scheme. This method should not be called for the built-in
|
|
||||||
// HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes.
|
|
||||||
//
|
|
||||||
// If |is_standard| is true the scheme will be treated as a standard scheme.
|
|
||||||
// Standard schemes are subject to URL canonicalization and parsing rules as
|
|
||||||
// defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1 available
|
|
||||||
// at http://www.ietf.org/rfc/rfc1738.txt
|
|
||||||
//
|
|
||||||
// In particular, the syntax for standard scheme URLs must be of the form:
|
|
||||||
// <pre>
|
|
||||||
// [scheme]://[username]:[password]@[host]:[port]/[url-path]
|
|
||||||
// </pre>
|
|
||||||
// Standard scheme URLs must have a host component that is a fully qualified
|
|
||||||
// domain name as defined in Section 3.5 of RFC 1034 [13] and Section 2.1 of RFC
|
|
||||||
// 1123. These URLs will be canonicalized to "scheme://host/path" in the
|
|
||||||
// simplest case and "scheme://username:password@host:port/path" in the most
|
|
||||||
// explicit case. For example, "scheme:host/path" and "scheme:///host/path" will
|
|
||||||
// both be canonicalized to "scheme://host/path". The origin of a standard
|
|
||||||
// scheme URL is the combination of scheme, host and port (i.e.,
|
|
||||||
// "scheme://host:port" in the most explicit case).
|
|
||||||
//
|
|
||||||
// For non-standard scheme URLs only the "scheme:" component is parsed and
|
|
||||||
// canonicalized. The remainder of the URL will be passed to the handler as-is.
|
|
||||||
// For example, "scheme:///some%20text" will remain the same. Non-standard
|
|
||||||
// scheme URLs cannot be used as a target for form submission.
|
|
||||||
//
|
|
||||||
// If |is_local| is true the scheme will be treated as local (i.e., with the
|
|
||||||
// same security rules as those applied to "file" URLs). Normal pages cannot
|
|
||||||
// link to or access local URLs. Also, by default, local URLs can only perform
|
|
||||||
// XMLHttpRequest calls to the same URL (origin + path) that originated the
|
|
||||||
// request. To allow XMLHttpRequest calls from a local URL to other URLs with
|
|
||||||
// the same origin set the CefSettings.file_access_from_file_urls_allowed value
|
|
||||||
// to true. To allow XMLHttpRequest calls from a local URL to all origins set
|
|
||||||
// the CefSettings.universal_access_from_file_urls_allowed value to true.
|
|
||||||
//
|
|
||||||
// If |is_display_isolated| is true the scheme will be treated as display-
|
|
||||||
// isolated. This means that pages cannot display these URLs unless they are
|
|
||||||
// from the same scheme. For example, pages in another origin cannot create
|
|
||||||
// iframes or hyperlinks to URLs with this scheme.
|
|
||||||
//
|
|
||||||
// This function may be called on any thread. It should only be called once
|
|
||||||
// per unique |scheme_name| value. If |scheme_name| is already registered or if
|
|
||||||
// an error occurs this method will return false.
|
|
||||||
///
|
|
||||||
/*--cef()--*/
|
|
||||||
bool CefRegisterCustomScheme(const CefString& scheme_name,
|
|
||||||
bool is_standard,
|
|
||||||
bool is_local,
|
|
||||||
bool is_display_isolated);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Register a scheme handler factory for the specified |scheme_name| and
|
// Register a scheme handler factory for the specified |scheme_name| and
|
||||||
@ -125,15 +75,75 @@ bool CefClearSchemeHandlerFactories();
|
|||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Class that creates CefResourceHandler instances for handling scheme requests. The
|
// Class that manages custom scheme registrations.
|
||||||
// methods of this class will always be called on the IO thread.
|
///
|
||||||
|
/*--cef(source=library)--*/
|
||||||
|
class CefSchemeRegistrar : public virtual CefBase {
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
// Register a custom scheme. This method should not be called for the built-in
|
||||||
|
// HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes.
|
||||||
|
//
|
||||||
|
// If |is_standard| is true the scheme will be treated as a standard scheme.
|
||||||
|
// Standard schemes are subject to URL canonicalization and parsing rules as
|
||||||
|
// defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1 available
|
||||||
|
// at http://www.ietf.org/rfc/rfc1738.txt
|
||||||
|
//
|
||||||
|
// In particular, the syntax for standard scheme URLs must be of the form:
|
||||||
|
// <pre>
|
||||||
|
// [scheme]://[username]:[password]@[host]:[port]/[url-path]
|
||||||
|
// </pre>
|
||||||
|
// Standard scheme URLs must have a host component that is a fully qualified
|
||||||
|
// domain name as defined in Section 3.5 of RFC 1034 [13] and Section 2.1 of
|
||||||
|
// RFC 1123. These URLs will be canonicalized to "scheme://host/path" in the
|
||||||
|
// simplest case and "scheme://username:password@host:port/path" in the most
|
||||||
|
// explicit case. For example, "scheme:host/path" and "scheme:///host/path"
|
||||||
|
// will both be canonicalized to "scheme://host/path". The origin of a
|
||||||
|
// standard scheme URL is the combination of scheme, host and port (i.e.,
|
||||||
|
// "scheme://host:port" in the most explicit case).
|
||||||
|
//
|
||||||
|
// For non-standard scheme URLs only the "scheme:" component is parsed and
|
||||||
|
// canonicalized. The remainder of the URL will be passed to the handler
|
||||||
|
// as-is. For example, "scheme:///some%20text" will remain the same.
|
||||||
|
// Non-standard scheme URLs cannot be used as a target for form submission.
|
||||||
|
//
|
||||||
|
// If |is_local| is true the scheme will be treated as local (i.e., with the
|
||||||
|
// same security rules as those applied to "file" URLs). Normal pages cannot
|
||||||
|
// link to or access local URLs. Also, by default, local URLs can only perform
|
||||||
|
// XMLHttpRequest calls to the same URL (origin + path) that originated the
|
||||||
|
// request. To allow XMLHttpRequest calls from a local URL to other URLs with
|
||||||
|
// the same origin set the CefSettings.file_access_from_file_urls_allowed
|
||||||
|
// value to true. To allow XMLHttpRequest calls from a local URL to all
|
||||||
|
// origins set the CefSettings.universal_access_from_file_urls_allowed value
|
||||||
|
// to true.
|
||||||
|
//
|
||||||
|
// If |is_display_isolated| is true the scheme will be treated as display-
|
||||||
|
// isolated. This means that pages cannot display these URLs unless they are
|
||||||
|
// from the same scheme. For example, pages in another origin cannot create
|
||||||
|
// iframes or hyperlinks to URLs with this scheme.
|
||||||
|
//
|
||||||
|
// This function may be called on any thread. It should only be called once
|
||||||
|
// per unique |scheme_name| value. If |scheme_name| is already registered or
|
||||||
|
// if an error occurs this method will return false.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual bool AddCustomScheme(const CefString& scheme_name,
|
||||||
|
bool is_standard,
|
||||||
|
bool is_local,
|
||||||
|
bool is_display_isolated) =0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
// Class that creates CefResourceHandler instances for handling scheme requests.
|
||||||
|
// The methods of this class will always be called on the IO thread.
|
||||||
///
|
///
|
||||||
/*--cef(source=client)--*/
|
/*--cef(source=client)--*/
|
||||||
class CefSchemeHandlerFactory : public virtual CefBase {
|
class CefSchemeHandlerFactory : public virtual CefBase {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
// Return a new resource handler instance to handle the request. |browser| will
|
// Return a new resource handler instance to handle the request. |browser|
|
||||||
// be the browser window that initiated the request. If the request was
|
// will be the browser window that initiated the request. If the request was
|
||||||
// initiated using the CefWebURLRequest API |browser| will be NULL. The
|
// initiated using the CefWebURLRequest API |browser| will be NULL. The
|
||||||
// |request| object passed to this method will not contain cookie data.
|
// |request| object passed to this method will not contain cookie data.
|
||||||
///
|
///
|
||||||
|
@ -232,6 +232,14 @@ typedef struct _cef_settings_t {
|
|||||||
// is disabled.
|
// is disabled.
|
||||||
///
|
///
|
||||||
bool pack_loading_disabled;
|
bool pack_loading_disabled;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Set to a value between 1024 and 65535 to enable remote debugging on the
|
||||||
|
// specified port. For example, if 8080 is specified the remote debugging URL
|
||||||
|
// will be http://localhost:8080. CEF can be remotely debugged from any CEF or
|
||||||
|
// Chrome browser window.
|
||||||
|
///
|
||||||
|
int remote_debugging_port;
|
||||||
} cef_settings_t;
|
} cef_settings_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -286,6 +286,7 @@ struct CefSettingsTraits {
|
|||||||
cef_string_set(src->locales_dir_path.str, src->locales_dir_path.length,
|
cef_string_set(src->locales_dir_path.str, src->locales_dir_path.length,
|
||||||
&target->locales_dir_path, copy);
|
&target->locales_dir_path, copy);
|
||||||
target->pack_loading_disabled = src->pack_loading_disabled;
|
target->pack_loading_disabled = src->pack_loading_disabled;
|
||||||
|
target->remote_debugging_port = src->remote_debugging_port;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "base/bind_helpers.h"
|
#include "base/bind_helpers.h"
|
||||||
#include "content/browser/renderer_host/render_view_host_impl.h"
|
#include "content/browser/renderer_host/render_view_host_impl.h"
|
||||||
#include "content/browser/renderer_host/resource_request_info_impl.h"
|
#include "content/browser/renderer_host/resource_request_info_impl.h"
|
||||||
#include "content/browser/tab_contents/tab_contents.h"
|
#include "content/browser/web_contents/web_contents_impl.h"
|
||||||
#include "content/public/browser/navigation_controller.h"
|
#include "content/public/browser/navigation_controller.h"
|
||||||
#include "content/public/browser/navigation_entry.h"
|
#include "content/public/browser/navigation_entry.h"
|
||||||
#include "content/public/browser/notification_details.h"
|
#include "content/public/browser/notification_details.h"
|
||||||
@ -160,9 +160,10 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::GetBrowserForHost(
|
|||||||
const content::RenderViewHost* host) {
|
const content::RenderViewHost* host) {
|
||||||
DCHECK(host);
|
DCHECK(host);
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
TabContents* tab_contents = static_cast<TabContents*>(host->GetDelegate());
|
WebContentsImpl* web_contents =
|
||||||
if (tab_contents)
|
static_cast<WebContentsImpl*>(host->GetDelegate());
|
||||||
return static_cast<CefBrowserHostImpl*>(tab_contents->GetDelegate());
|
if (web_contents)
|
||||||
|
return static_cast<CefBrowserHostImpl*>(web_contents->GetDelegate());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "libcef/browser/browser_message_filter.h"
|
#include "libcef/browser/browser_message_filter.h"
|
||||||
|
|
||||||
#include "libcef/browser/origin_whitelist_impl.h"
|
#include "libcef/browser/origin_whitelist_impl.h"
|
||||||
#include "libcef/browser/scheme_impl.h"
|
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/cef_messages.h"
|
#include "libcef/common/cef_messages.h"
|
||||||
|
|
||||||
@ -49,6 +48,5 @@ void CefBrowserMessageFilter::RegisterOnUIThread() {
|
|||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
|
||||||
// Send existing registrations to the new render process.
|
// Send existing registrations to the new render process.
|
||||||
RegisterSchemesWithHost(host_);
|
|
||||||
RegisterCrossOriginWhitelistEntriesWithHost(host_);
|
RegisterCrossOriginWhitelistEntriesWithHost(host_);
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "libcef/browser/scheme_impl.h"
|
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
@ -15,7 +13,6 @@
|
|||||||
#include "libcef/browser/resource_request_job.h"
|
#include "libcef/browser/resource_request_job.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/browser/url_request_context_getter.h"
|
#include "libcef/browser/url_request_context_getter.h"
|
||||||
#include "libcef/common/cef_messages.h"
|
|
||||||
#include "libcef/common/request_impl.h"
|
#include "libcef/common/request_impl.h"
|
||||||
#include "libcef/common/response_impl.h"
|
#include "libcef/common/response_impl.h"
|
||||||
|
|
||||||
@ -25,7 +22,6 @@
|
|||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/synchronization/lock.h"
|
#include "base/synchronization/lock.h"
|
||||||
#include "content/public/browser/render_process_host.h"
|
|
||||||
#include "googleurl/src/url_util.h"
|
#include "googleurl/src/url_util.h"
|
||||||
#include "net/base/completion_callback.h"
|
#include "net/base/completion_callback.h"
|
||||||
#include "net/base/io_buffer.h"
|
#include "net/base/io_buffer.h"
|
||||||
@ -53,13 +49,6 @@ bool IsStandardScheme(const std::string& scheme) {
|
|||||||
return url_util::IsStandard(scheme.c_str(), scheme_comp);
|
return url_util::IsStandard(scheme.c_str(), scheme_comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterStandardScheme(const std::string& scheme) {
|
|
||||||
CEF_REQUIRE_UIT();
|
|
||||||
url_parse::Component scheme_comp(0, scheme.length());
|
|
||||||
if (!url_util::IsStandard(scheme.c_str(), scheme_comp))
|
|
||||||
url_util::AddStandardScheme(scheme.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copied from net/url_request/url_request_job_manager.cc.
|
// Copied from net/url_request/url_request_job_manager.cc.
|
||||||
struct SchemeToFactory {
|
struct SchemeToFactory {
|
||||||
const char* scheme;
|
const char* scheme;
|
||||||
@ -200,69 +189,6 @@ class CefUrlRequestManager {
|
|||||||
handler_map_.clear();
|
handler_map_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a scheme has already been registered.
|
|
||||||
bool HasRegisteredScheme(const std::string& scheme) {
|
|
||||||
std::string scheme_lower = ToLower(scheme);
|
|
||||||
|
|
||||||
// Don't register builtin schemes.
|
|
||||||
if (IsBuiltinScheme(scheme_lower))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
scheme_map_lock_.Acquire();
|
|
||||||
bool registered = (scheme_map_.find(scheme_lower) != scheme_map_.end());
|
|
||||||
scheme_map_lock_.Release();
|
|
||||||
return registered;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register a scheme.
|
|
||||||
bool RegisterScheme(const std::string& scheme,
|
|
||||||
bool is_standard,
|
|
||||||
bool is_local,
|
|
||||||
bool is_display_isolated) {
|
|
||||||
if (HasRegisteredScheme(scheme)) {
|
|
||||||
NOTREACHED() << "Scheme already registered: " << scheme;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string scheme_lower = ToLower(scheme);
|
|
||||||
|
|
||||||
SchemeInfo info;
|
|
||||||
info.is_standard = is_standard;
|
|
||||||
info.is_local = is_local;
|
|
||||||
info.is_display_isolated = is_display_isolated;
|
|
||||||
|
|
||||||
scheme_map_lock_.Acquire();
|
|
||||||
scheme_map_.insert(std::make_pair(scheme_lower, info));
|
|
||||||
scheme_map_lock_.Release();
|
|
||||||
|
|
||||||
if (is_standard && !content::RenderProcessHost::run_renderer_in_process()) {
|
|
||||||
// When running in multi-process mode the scheme must be registered with
|
|
||||||
// url_util in the browser process as well.
|
|
||||||
RegisterStandardScheme(scheme_lower);
|
|
||||||
}
|
|
||||||
|
|
||||||
SendRegisterScheme(scheme_lower, is_standard, is_local,
|
|
||||||
is_display_isolated);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send all existing scheme registrations to the specified host.
|
|
||||||
void RegisterSchemesWithHost(content::RenderProcessHost* host) {
|
|
||||||
base::AutoLock lock_scope(scheme_map_lock_);
|
|
||||||
|
|
||||||
if (scheme_map_.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
SchemeMap::const_iterator it = scheme_map_.begin();
|
|
||||||
for (; it != scheme_map_.end(); ++it) {
|
|
||||||
host->Send(
|
|
||||||
new CefProcessMsg_RegisterScheme(it->first, it->second.is_standard,
|
|
||||||
it->second.is_local,
|
|
||||||
it->second.is_display_isolated));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Retrieve the matching handler factory, if any. |scheme| will already be in
|
// Retrieve the matching handler factory, if any. |scheme| will already be in
|
||||||
// lower case.
|
// lower case.
|
||||||
@ -328,40 +254,12 @@ class CefUrlRequestManager {
|
|||||||
return job;
|
return job;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the register scheme message to all currently existing hosts.
|
|
||||||
void SendRegisterScheme(const std::string& scheme_name,
|
|
||||||
bool is_standard,
|
|
||||||
bool is_local,
|
|
||||||
bool is_display_isolated) {
|
|
||||||
CEF_REQUIRE_UIT();
|
|
||||||
|
|
||||||
content::RenderProcessHost::iterator i(
|
|
||||||
content::RenderProcessHost::AllHostsIterator());
|
|
||||||
for (; !i.IsAtEnd(); i.Advance()) {
|
|
||||||
i.GetCurrentValue()->Send(
|
|
||||||
new CefProcessMsg_RegisterScheme(scheme_name, is_standard, is_local,
|
|
||||||
is_display_isolated));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Map (scheme, domain) to factories. This map will only be accessed on the IO
|
// Map (scheme, domain) to factories. This map will only be accessed on the IO
|
||||||
// thread.
|
// thread.
|
||||||
typedef std::map<std::pair<std::string, std::string>,
|
typedef std::map<std::pair<std::string, std::string>,
|
||||||
CefRefPtr<CefSchemeHandlerFactory> > HandlerMap;
|
CefRefPtr<CefSchemeHandlerFactory> > HandlerMap;
|
||||||
HandlerMap handler_map_;
|
HandlerMap handler_map_;
|
||||||
|
|
||||||
struct SchemeInfo {
|
|
||||||
bool is_standard;
|
|
||||||
bool is_local;
|
|
||||||
bool is_display_isolated;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Map of registered schemes. Access to this map must be protected by the
|
|
||||||
// associated lock.
|
|
||||||
typedef std::map<std::string, SchemeInfo> SchemeMap;
|
|
||||||
SchemeMap scheme_map_;
|
|
||||||
base::Lock scheme_map_lock_;
|
|
||||||
|
|
||||||
DISALLOW_EVIL_CONSTRUCTORS(CefUrlRequestManager);
|
DISALLOW_EVIL_CONSTRUCTORS(CefUrlRequestManager);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -374,34 +272,6 @@ CefUrlRequestManager* CefUrlRequestManager::GetInstance() {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
bool CefRegisterCustomScheme(const CefString& scheme_name,
|
|
||||||
bool is_standard,
|
|
||||||
bool is_local,
|
|
||||||
bool is_display_isolated) {
|
|
||||||
// Verify that the context is in a valid state.
|
|
||||||
if (!CONTEXT_STATE_VALID()) {
|
|
||||||
NOTREACHED() << "context not valid";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CEF_CURRENTLY_ON(CEF_UIT)) {
|
|
||||||
// Must be executed on the UI thread.
|
|
||||||
return CefUrlRequestManager::GetInstance()->RegisterScheme(scheme_name,
|
|
||||||
is_standard, is_local, is_display_isolated);
|
|
||||||
} else {
|
|
||||||
// Verify that the scheme has not already been registered.
|
|
||||||
if (CefUrlRequestManager::GetInstance()->HasRegisteredScheme(scheme_name)) {
|
|
||||||
NOTREACHED() << "Scheme already registered: " << scheme_name;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_POST_TASK(CEF_UIT,
|
|
||||||
base::Bind(base::IgnoreResult(&CefRegisterCustomScheme), scheme_name,
|
|
||||||
is_standard, is_local, is_display_isolated));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CefRegisterSchemeHandlerFactory(
|
bool CefRegisterSchemeHandlerFactory(
|
||||||
const CefString& scheme_name,
|
const CefString& scheme_name,
|
||||||
const CefString& domain_name,
|
const CefString& domain_name,
|
||||||
@ -440,8 +310,3 @@ bool CefClearSchemeHandlerFactories() {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterSchemesWithHost(content::RenderProcessHost* host) {
|
|
||||||
CEF_REQUIRE_UIT();
|
|
||||||
CefUrlRequestManager::GetInstance()->RegisterSchemesWithHost(host);
|
|
||||||
}
|
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
|
||||||
// be found in the LICENSE file.
|
|
||||||
|
|
||||||
#ifndef CEF_LIBCEF_BROWSER_SCHEME_IMPL_H_
|
|
||||||
#define CEF_LIBCEF_BROWSER_SCHEME_IMPL_H_
|
|
||||||
|
|
||||||
namespace content {
|
|
||||||
class RenderProcessHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called when a new RenderProcessHost is created to send existing scheme
|
|
||||||
// registration information.
|
|
||||||
void RegisterSchemesWithHost(content::RenderProcessHost* host);
|
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_BROWSER_SCHEME_IMPL_H_
|
|
@ -120,13 +120,6 @@ IPC_MESSAGE_ROUTED1(CefMsg_Response,
|
|||||||
IPC_MESSAGE_ROUTED1(CefMsg_ResponseAck,
|
IPC_MESSAGE_ROUTED1(CefMsg_ResponseAck,
|
||||||
int /* request_id */)
|
int /* request_id */)
|
||||||
|
|
||||||
// Sent to child processes to register a scheme.
|
|
||||||
IPC_MESSAGE_CONTROL4(CefProcessMsg_RegisterScheme,
|
|
||||||
std::string /* sheme_name */,
|
|
||||||
bool /* is_standard */,
|
|
||||||
bool /* is_local */,
|
|
||||||
bool /* is_display_isolated */)
|
|
||||||
|
|
||||||
// Sent to child processes to add or remove a cross-origin whitelist entry.
|
// Sent to child processes to add or remove a cross-origin whitelist entry.
|
||||||
IPC_MESSAGE_CONTROL5(CefProcessMsg_ModifyCrossOriginWhitelistEntry,
|
IPC_MESSAGE_CONTROL5(CefProcessMsg_ModifyCrossOriginWhitelistEntry,
|
||||||
bool /* add */,
|
bool /* add */,
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "include/cef_stream.h"
|
#include "include/cef_stream.h"
|
||||||
#include "include/cef_version.h"
|
#include "include/cef_version.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
|
#include "libcef/common/scheme_registrar_impl.h"
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
@ -42,6 +43,21 @@ void CefContentClient::AddNPAPIPlugins(
|
|||||||
webkit::npapi::PluginList* plugin_list) {
|
webkit::npapi::PluginList* plugin_list) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefContentClient::AddAdditionalSchemes(
|
||||||
|
std::vector<std::string>* standard_schemes,
|
||||||
|
std::vector<std::string>* savable_schemes) {
|
||||||
|
if (application_.get()) {
|
||||||
|
CefRefPtr<CefSchemeRegistrarImpl> schemeRegistrar(
|
||||||
|
new CefSchemeRegistrarImpl());
|
||||||
|
application_->OnRegisterCustomSchemes(schemeRegistrar.get());
|
||||||
|
schemeRegistrar->GetStandardSchemes(standard_schemes);
|
||||||
|
|
||||||
|
// No references to the registar should be kept.
|
||||||
|
schemeRegistrar->Detach();
|
||||||
|
DCHECK(schemeRegistrar->VerifyRefCount());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CefContentClient::HasWebUIScheme(const GURL& url) const {
|
bool CefContentClient::HasWebUIScheme(const GURL& url) const {
|
||||||
// There are no WebUI URLs in CEF.
|
// There are no WebUI URLs in CEF.
|
||||||
return false;
|
return false;
|
||||||
|
@ -28,6 +28,9 @@ class CefContentClient : public content::ContentClient {
|
|||||||
std::vector<content::PepperPluginInfo>* plugins) OVERRIDE;
|
std::vector<content::PepperPluginInfo>* plugins) OVERRIDE;
|
||||||
virtual void AddNPAPIPlugins(
|
virtual void AddNPAPIPlugins(
|
||||||
webkit::npapi::PluginList* plugin_list) OVERRIDE;
|
webkit::npapi::PluginList* plugin_list) OVERRIDE;
|
||||||
|
virtual void AddAdditionalSchemes(
|
||||||
|
std::vector<std::string>* standard_schemes,
|
||||||
|
std::vector<std::string>* savable_schemes) OVERRIDE;
|
||||||
virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE;
|
virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE;
|
||||||
virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
|
virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
|
||||||
virtual std::string GetUserAgent() const OVERRIDE;
|
virtual std::string GetUserAgent() const OVERRIDE;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
|
#include "base/string_number_conversions.h"
|
||||||
#include "base/synchronization/waitable_event.h"
|
#include "base/synchronization/waitable_event.h"
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
#include "content/public/browser/browser_main_runner.h"
|
#include "content/public/browser/browser_main_runner.h"
|
||||||
@ -197,6 +198,12 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.remote_debugging_port >= 1024 &&
|
||||||
|
settings.remote_debugging_port <= 65535) {
|
||||||
|
command_line->AppendSwitchASCII(switches::kRemoteDebuggingPort,
|
||||||
|
base::IntToString(settings.remote_debugging_port));
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(cef): Figure out how to support the sandbox.
|
// TODO(cef): Figure out how to support the sandbox.
|
||||||
if (!command_line->HasSwitch(switches::kNoSandbox))
|
if (!command_line->HasSwitch(switches::kNoSandbox))
|
||||||
command_line->AppendSwitch(switches::kNoSandbox);
|
command_line->AppendSwitch(switches::kNoSandbox);
|
||||||
@ -211,6 +218,9 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
|||||||
commandLinePtr->Detach(NULL);
|
commandLinePtr->Detach(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content::SetContentClient(&content_client_);
|
||||||
|
InitializeContentClient(process_type);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,12 +230,6 @@ void CefMainDelegate::PreSandboxStartup() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
||||||
std::string process_type =
|
|
||||||
command_line.GetSwitchValueASCII(switches::kProcessType);
|
|
||||||
|
|
||||||
content::SetContentClient(&content_client_);
|
|
||||||
InitializeContentClient(process_type);
|
|
||||||
|
|
||||||
if (command_line.HasSwitch(switches::kPackLoadingDisabled))
|
if (command_line.HasSwitch(switches::kPackLoadingDisabled))
|
||||||
content_client_.set_pack_loading_disabled(true);
|
content_client_.set_pack_loading_disabled(true);
|
||||||
else
|
else
|
||||||
@ -341,6 +345,8 @@ void CefMainDelegate::InitializeContentClient(
|
|||||||
void CefMainDelegate::InitializeResourceBundle() {
|
void CefMainDelegate::InitializeResourceBundle() {
|
||||||
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
|
// Mac OS-X does not support customization of the pack load paths.
|
||||||
|
#if !defined(OS_MACOSX)
|
||||||
FilePath pak_file, locales_dir;
|
FilePath pak_file, locales_dir;
|
||||||
|
|
||||||
if (command_line.HasSwitch(switches::kPackFilePath))
|
if (command_line.HasSwitch(switches::kPackFilePath))
|
||||||
@ -360,6 +366,7 @@ void CefMainDelegate::InitializeResourceBundle() {
|
|||||||
|
|
||||||
if (!locales_dir.empty())
|
if (!locales_dir.empty())
|
||||||
PathService::Override(ui::DIR_LOCALES, locales_dir);
|
PathService::Override(ui::DIR_LOCALES, locales_dir);
|
||||||
|
#endif // !defined(OS_MACOSX)
|
||||||
|
|
||||||
std::string locale = command_line.GetSwitchValueASCII(switches::kLocale);
|
std::string locale = command_line.GetSwitchValueASCII(switches::kLocale);
|
||||||
if (locale.empty())
|
if (locale.empty())
|
||||||
@ -372,7 +379,7 @@ void CefMainDelegate::InitializeResourceBundle() {
|
|||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
// Explicitly load cef.pak on Windows.
|
// Explicitly load cef.pak on Windows.
|
||||||
if (file_util::PathExists(pak_file))
|
if (file_util::PathExists(pak_file))
|
||||||
ResourceBundle::AddDataPackToSharedInstance(pak_file);
|
ResourceBundle::GetSharedInstance().AddDataPack(pak_file);
|
||||||
else
|
else
|
||||||
NOTREACHED() << "Could not load cef.pak";
|
NOTREACHED() << "Could not load cef.pak";
|
||||||
#endif
|
#endif
|
||||||
|
67
libcef/common/scheme_registrar_impl.cc
Normal file
67
libcef/common/scheme_registrar_impl.cc
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||||
|
// be found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "libcef/common/scheme_registrar_impl.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "libcef/renderer/content_renderer_client.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
|
#include "base/logging.h"
|
||||||
|
|
||||||
|
CefSchemeRegistrarImpl::CefSchemeRegistrarImpl()
|
||||||
|
: supported_thread_id_(base::PlatformThread::CurrentId()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefSchemeRegistrarImpl::AddCustomScheme(
|
||||||
|
const CefString& scheme_name,
|
||||||
|
bool is_standard,
|
||||||
|
bool is_local,
|
||||||
|
bool is_display_isolated) {
|
||||||
|
if (!VerifyContext())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (is_standard)
|
||||||
|
standard_schemes_.push_back(scheme_name);
|
||||||
|
|
||||||
|
if (CefContentRendererClient::Get()) {
|
||||||
|
// Register the custom scheme with WebKit.
|
||||||
|
CefContentRendererClient::Get()->AddCustomScheme(scheme_name, is_local,
|
||||||
|
is_display_isolated);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefSchemeRegistrarImpl::GetStandardSchemes(
|
||||||
|
std::vector<std::string>* standard_schemes) {
|
||||||
|
if (!VerifyContext())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (standard_schemes_.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
standard_schemes->insert(standard_schemes->end(), standard_schemes_.begin(),
|
||||||
|
standard_schemes_.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefSchemeRegistrarImpl::VerifyRefCount() {
|
||||||
|
return (GetRefCt() == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefSchemeRegistrarImpl::Detach() {
|
||||||
|
if (VerifyContext())
|
||||||
|
supported_thread_id_ = base::kInvalidThreadId;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefSchemeRegistrarImpl::VerifyContext() {
|
||||||
|
if (base::PlatformThread::CurrentId() != supported_thread_id_) {
|
||||||
|
// This object should only be accessed from the thread that created it.
|
||||||
|
NOTREACHED();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
46
libcef/common/scheme_registrar_impl.h
Normal file
46
libcef/common/scheme_registrar_impl.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||||
|
// be found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_COMMON_SCHEME_REGISTRAR_IMPL_H_
|
||||||
|
#define CEF_LIBCEF_COMMON_SCHEME_REGISTRAR_IMPL_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "include/cef_scheme.h"
|
||||||
|
|
||||||
|
#include "base/threading/platform_thread.h"
|
||||||
|
|
||||||
|
class CefSchemeRegistrarImpl : public CefSchemeRegistrar {
|
||||||
|
public:
|
||||||
|
CefSchemeRegistrarImpl();
|
||||||
|
|
||||||
|
// CefSchemeRegistrar methods.
|
||||||
|
virtual bool AddCustomScheme(const CefString& scheme_name,
|
||||||
|
bool is_standard,
|
||||||
|
bool is_local,
|
||||||
|
bool is_display_isolated) OVERRIDE;
|
||||||
|
|
||||||
|
void GetStandardSchemes(std::vector<std::string>* standard_schemes);
|
||||||
|
|
||||||
|
// Verify that only a single reference exists to all CefSchemeRegistrarImpl
|
||||||
|
// objects.
|
||||||
|
bool VerifyRefCount();
|
||||||
|
|
||||||
|
void Detach();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Verify that the object is being accessed from the correct thread.
|
||||||
|
bool VerifyContext();
|
||||||
|
|
||||||
|
base::PlatformThreadId supported_thread_id_;
|
||||||
|
|
||||||
|
std::vector<std::string> standard_schemes_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefSchemeRegistrarImpl);
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefSchemeRegistrarImpl);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_COMMON_SCHEME_REGISTRAR_IMPL_H_
|
@ -7,7 +7,6 @@
|
|||||||
#include "libcef/common/cef_messages.h"
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "libcef/common/content_client.h"
|
#include "libcef/common/content_client.h"
|
||||||
#include "libcef/renderer/browser_impl.h"
|
#include "libcef/renderer/browser_impl.h"
|
||||||
#include "libcef/renderer/render_message_filter.h"
|
|
||||||
#include "libcef/renderer/render_process_observer.h"
|
#include "libcef/renderer/render_process_observer.h"
|
||||||
#include "libcef/renderer/thread_util.h"
|
#include "libcef/renderer/thread_util.h"
|
||||||
#include "libcef/renderer/v8_impl.h"
|
#include "libcef/renderer/v8_impl.h"
|
||||||
@ -17,9 +16,18 @@
|
|||||||
#include "content/public/renderer/render_view.h"
|
#include "content/public/renderer/render_view.h"
|
||||||
#include "ipc/ipc_sync_channel.h"
|
#include "ipc/ipc_sync_channel.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
||||||
#include "v8/include/v8.h"
|
#include "v8/include/v8.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct CefContentRendererClient::SchemeInfo {
|
||||||
|
std::string scheme_name;
|
||||||
|
bool is_local;
|
||||||
|
bool is_display_isolated;
|
||||||
|
};
|
||||||
|
|
||||||
CefContentRendererClient::CefContentRendererClient() {
|
CefContentRendererClient::CefContentRendererClient() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,13 +79,38 @@ void CefContentRendererClient::OnBrowserDestroyed(CefBrowserImpl* browser) {
|
|||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefContentRendererClient::AddCustomScheme(
|
||||||
|
const std::string& scheme_name,
|
||||||
|
bool is_local,
|
||||||
|
bool is_display_isolated) {
|
||||||
|
SchemeInfo info = {scheme_name, is_local, is_display_isolated};
|
||||||
|
scheme_info_list_.push_back(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefContentRendererClient::RegisterCustomSchemes() {
|
||||||
|
if (scheme_info_list_.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
SchemeInfoList::const_iterator it = scheme_info_list_.begin();
|
||||||
|
for (; it != scheme_info_list_.end(); ++it) {
|
||||||
|
const SchemeInfo& info = *it;
|
||||||
|
if (info.is_local) {
|
||||||
|
WebKit::WebSecurityPolicy::registerURLSchemeAsLocal(
|
||||||
|
WebKit::WebString::fromUTF8(info.scheme_name));
|
||||||
|
}
|
||||||
|
if (info.is_display_isolated) {
|
||||||
|
WebKit::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(
|
||||||
|
WebKit::WebString::fromUTF8(info.scheme_name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CefContentRendererClient::RenderThreadStarted() {
|
void CefContentRendererClient::RenderThreadStarted() {
|
||||||
render_loop_ = base::MessageLoopProxy::current();
|
render_loop_ = base::MessageLoopProxy::current();
|
||||||
observer_.reset(new CefRenderProcessObserver());
|
observer_.reset(new CefRenderProcessObserver());
|
||||||
|
|
||||||
content::RenderThread* thread = content::RenderThread::Get();
|
content::RenderThread* thread = content::RenderThread::Get();
|
||||||
thread->AddObserver(observer_.get());
|
thread->AddObserver(observer_.get());
|
||||||
thread->GetChannel()->AddFilter(new CefRenderMessageFilter);
|
|
||||||
|
|
||||||
thread->Send(new CefProcessHostMsg_RenderThreadStarted);
|
thread->Send(new CefProcessHostMsg_RenderThreadStarted);
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#define CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_
|
#define CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "libcef/renderer/browser_impl.h"
|
#include "libcef/renderer/browser_impl.h"
|
||||||
@ -37,6 +37,14 @@ class CefContentRendererClient : public content::ContentRendererClient {
|
|||||||
// Called from CefBrowserImpl::OnDestruct().
|
// Called from CefBrowserImpl::OnDestruct().
|
||||||
void OnBrowserDestroyed(CefBrowserImpl* browser);
|
void OnBrowserDestroyed(CefBrowserImpl* browser);
|
||||||
|
|
||||||
|
// Add a custom scheme registration.
|
||||||
|
void AddCustomScheme(const std::string& scheme_name,
|
||||||
|
bool is_local,
|
||||||
|
bool is_display_isolated);
|
||||||
|
|
||||||
|
// Register the custom schemes with WebKit.
|
||||||
|
void RegisterCustomSchemes();
|
||||||
|
|
||||||
// Render thread message loop proxy.
|
// Render thread message loop proxy.
|
||||||
base::MessageLoopProxy* render_loop() const { return render_loop_.get(); }
|
base::MessageLoopProxy* render_loop() const { return render_loop_.get(); }
|
||||||
|
|
||||||
@ -110,6 +118,11 @@ class CefContentRendererClient : public content::ContentRendererClient {
|
|||||||
// Map of RenderView pointers to CefBrowserImpl references.
|
// Map of RenderView pointers to CefBrowserImpl references.
|
||||||
typedef std::map<content::RenderView*, CefRefPtr<CefBrowserImpl> > BrowserMap;
|
typedef std::map<content::RenderView*, CefRefPtr<CefBrowserImpl> > BrowserMap;
|
||||||
BrowserMap browsers_;
|
BrowserMap browsers_;
|
||||||
|
|
||||||
|
// Information about custom schemes that need to be registered with WebKit.
|
||||||
|
struct SchemeInfo;
|
||||||
|
typedef std::list<SchemeInfo> SchemeInfoList;
|
||||||
|
SchemeInfoList scheme_info_list_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_
|
#endif // CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_
|
||||||
|
@ -1,69 +0,0 @@
|
|||||||
/// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
|
||||||
// Portions (c) 2011 The Chromium Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#include "libcef/renderer/render_message_filter.h"
|
|
||||||
#include "libcef/renderer/thread_util.h"
|
|
||||||
#include "libcef/common/cef_messages.h"
|
|
||||||
|
|
||||||
#include "base/bind.h"
|
|
||||||
#include "googleurl/src/gurl.h"
|
|
||||||
#include "googleurl/src/url_util.h"
|
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
|
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
|
||||||
|
|
||||||
CefRenderMessageFilter::CefRenderMessageFilter()
|
|
||||||
: channel_(NULL) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CefRenderMessageFilter::~CefRenderMessageFilter() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefRenderMessageFilter::OnFilterAdded(IPC::Channel* channel) {
|
|
||||||
channel_ = channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefRenderMessageFilter::OnFilterRemoved() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CefRenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
|
||||||
bool handled = true;
|
|
||||||
IPC_BEGIN_MESSAGE_MAP(CefRenderMessageFilter, message)
|
|
||||||
IPC_MESSAGE_HANDLER(CefProcessMsg_RegisterScheme, OnRegisterScheme)
|
|
||||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
|
||||||
IPC_END_MESSAGE_MAP()
|
|
||||||
return handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefRenderMessageFilter::OnRegisterScheme(
|
|
||||||
const std::string& scheme_name,
|
|
||||||
bool is_standard,
|
|
||||||
bool is_local,
|
|
||||||
bool is_display_isolated) {
|
|
||||||
if (is_standard) {
|
|
||||||
// Make this registration as early as possible.
|
|
||||||
url_parse::Component scheme_comp(0, scheme_name.length());
|
|
||||||
if (!url_util::IsStandard(scheme_name.c_str(), scheme_comp))
|
|
||||||
url_util::AddStandardScheme(scheme_name.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_POST_TASK_RT(
|
|
||||||
base::Bind(&CefRenderMessageFilter::RegisterSchemeOnRenderThread, this,
|
|
||||||
scheme_name, is_local, is_display_isolated));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefRenderMessageFilter::RegisterSchemeOnRenderThread(
|
|
||||||
const std::string& scheme_name,
|
|
||||||
bool is_local,
|
|
||||||
bool is_display_isolated) {
|
|
||||||
CEF_REQUIRE_RT();
|
|
||||||
if (is_local) {
|
|
||||||
WebKit::WebSecurityPolicy::registerURLSchemeAsLocal(
|
|
||||||
WebKit::WebString::fromUTF8(scheme_name));
|
|
||||||
}
|
|
||||||
if (is_display_isolated) {
|
|
||||||
WebKit::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(
|
|
||||||
WebKit::WebString::fromUTF8(scheme_name));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
|
||||||
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#ifndef CEF_LIBCEF_RENDERER_RENDER_MESSAGE_FILTER_H_
|
|
||||||
#define CEF_LIBCEF_RENDERER_RENDER_MESSAGE_FILTER_H_
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include "ipc/ipc_channel_proxy.h"
|
|
||||||
|
|
||||||
// This class sends and receives control messages on the renderer process.
|
|
||||||
class CefRenderMessageFilter : public IPC::ChannelProxy::MessageFilter {
|
|
||||||
public:
|
|
||||||
CefRenderMessageFilter();
|
|
||||||
virtual ~CefRenderMessageFilter();
|
|
||||||
|
|
||||||
// IPC::ChannelProxy::MessageFilter implementation.
|
|
||||||
virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
|
|
||||||
virtual void OnFilterRemoved() OVERRIDE;
|
|
||||||
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// Message handlers called on the IO thread.
|
|
||||||
void OnRegisterScheme(const std::string& scheme_name,
|
|
||||||
bool is_standard,
|
|
||||||
bool is_local,
|
|
||||||
bool is_display_isolated);
|
|
||||||
|
|
||||||
void RegisterSchemeOnRenderThread(const std::string& scheme_name,
|
|
||||||
bool is_local,
|
|
||||||
bool is_display_isolated);
|
|
||||||
|
|
||||||
IPC::Channel* channel_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefRenderMessageFilter);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_RENDERER_RENDER_MESSAGE_FILTER_H_
|
|
@ -6,6 +6,7 @@
|
|||||||
#include "libcef/renderer/render_process_observer.h"
|
#include "libcef/renderer/render_process_observer.h"
|
||||||
#include "libcef/common/cef_messages.h"
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "libcef/common/content_client.h"
|
#include "libcef/common/content_client.h"
|
||||||
|
#include "libcef/renderer/content_renderer_client.h"
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
@ -49,6 +50,9 @@ void CefRenderProcessObserver::WebKitInitialized() {
|
|||||||
// TODO(cef): Enable these once the implementation supports it.
|
// TODO(cef): Enable these once the implementation supports it.
|
||||||
WebKit::WebRuntimeFeatures::enableNotifications(false);
|
WebKit::WebRuntimeFeatures::enableNotifications(false);
|
||||||
|
|
||||||
|
// Register any custom schemes with WebKit.
|
||||||
|
CefContentRendererClient::Get()->RegisterCustomSchemes();
|
||||||
|
|
||||||
// Notify the render process handler.
|
// Notify the render process handler.
|
||||||
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
|
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
|
||||||
if (application.get()) {
|
if (application.get()) {
|
||||||
|
@ -2,10 +2,19 @@
|
|||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "libcef/renderer/v8_impl.h"
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "base/compiler_specific.h"
|
||||||
|
|
||||||
|
#include "third_party/WebKit/Source/WebCore/config.h"
|
||||||
|
MSVC_PUSH_WARNING_LEVEL(0);
|
||||||
|
#include "V8Proxy.h" // NOLINT(build/include)
|
||||||
|
#include "V8RecursionScope.h" // NOLINT(build/include)
|
||||||
|
MSVC_POP_WARNING();
|
||||||
|
#undef LOG
|
||||||
|
|
||||||
|
#include "libcef/renderer/v8_impl.h"
|
||||||
|
|
||||||
#include "libcef/common/tracker.h"
|
#include "libcef/common/tracker.h"
|
||||||
#include "libcef/renderer/browser_impl.h"
|
#include "libcef/renderer/browser_impl.h"
|
||||||
#include "libcef/renderer/thread_util.h"
|
#include "libcef/renderer/thread_util.h"
|
||||||
@ -16,7 +25,6 @@
|
|||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h"
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static const char kCefTrackObject[] = "Cef::TrackObject";
|
static const char kCefTrackObject[] = "Cef::TrackObject";
|
||||||
@ -61,7 +69,7 @@ class V8TrackObject : public CefTrackNode {
|
|||||||
inline CefRefPtr<CefV8Accessor> GetAccessor() {
|
inline CefRefPtr<CefV8Accessor> GetAccessor() {
|
||||||
return accessor_;
|
return accessor_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetHandler(CefRefPtr<CefV8Handler> handler) {
|
inline void SetHandler(CefRefPtr<CefV8Handler> handler) {
|
||||||
handler_ = handler;
|
handler_ = handler;
|
||||||
}
|
}
|
||||||
@ -69,7 +77,7 @@ class V8TrackObject : public CefTrackNode {
|
|||||||
inline CefRefPtr<CefV8Handler> GetHandler() {
|
inline CefRefPtr<CefV8Handler> GetHandler() {
|
||||||
return handler_;
|
return handler_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetUserData(CefRefPtr<CefBase> user_data) {
|
inline void SetUserData(CefRefPtr<CefBase> user_data) {
|
||||||
user_data_ = user_data;
|
user_data_ = user_data;
|
||||||
}
|
}
|
||||||
@ -530,16 +538,27 @@ bool CefV8ContextImpl::Eval(const CefString& code,
|
|||||||
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(val);
|
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(val);
|
||||||
v8::Handle<v8::Value> code_val = GetV8String(code);
|
v8::Handle<v8::Value> code_val = GetV8String(code);
|
||||||
|
|
||||||
// Execute the eval function.
|
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch;
|
||||||
v8::Local<v8::Value> func_rv = func->Call(obj, 1, &code_val);
|
try_catch.SetVerbose(true);
|
||||||
|
v8::Local<v8::Value> func_rv;
|
||||||
|
|
||||||
|
retval = NULL;
|
||||||
|
exception = NULL;
|
||||||
|
|
||||||
|
// Execute the function call using the V8Proxy so that inspector
|
||||||
|
// instrumentation works.
|
||||||
|
WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve();
|
||||||
|
DCHECK(proxy);
|
||||||
|
if (proxy)
|
||||||
|
func_rv = proxy->callFunction(func, obj, 1, &code_val);
|
||||||
|
|
||||||
if (try_catch.HasCaught()) {
|
if (try_catch.HasCaught()) {
|
||||||
exception = new CefV8ExceptionImpl(try_catch.Message());
|
exception = new CefV8ExceptionImpl(try_catch.Message());
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else if (!func_rv.IsEmpty()) {
|
||||||
retval = new CefV8ValueImpl(func_rv);
|
retval = new CefV8ValueImpl(func_rv);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Context> CefV8ContextImpl::GetContext() {
|
v8::Local<v8::Context> CefV8ContextImpl::GetContext() {
|
||||||
@ -952,6 +971,7 @@ bool CefV8ValueImpl::DeleteValue(const CefString& key) {
|
|||||||
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
||||||
|
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch;
|
||||||
|
try_catch.SetVerbose(true);
|
||||||
bool del = obj->Delete(GetV8String(key));
|
bool del = obj->Delete(GetV8String(key));
|
||||||
return (!HasCaught(try_catch) && del);
|
return (!HasCaught(try_catch) && del);
|
||||||
}
|
}
|
||||||
@ -969,6 +989,7 @@ bool CefV8ValueImpl::DeleteValue(int index) {
|
|||||||
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
||||||
|
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch;
|
||||||
|
try_catch.SetVerbose(true);
|
||||||
bool del = obj->Delete(index);
|
bool del = obj->Delete(index);
|
||||||
return (!HasCaught(try_catch) && del);
|
return (!HasCaught(try_catch) && del);
|
||||||
}
|
}
|
||||||
@ -986,6 +1007,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(const CefString& key) {
|
|||||||
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
||||||
|
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch;
|
||||||
|
try_catch.SetVerbose(true);
|
||||||
v8::Local<v8::Value> value = obj->Get(GetV8String(key));
|
v8::Local<v8::Value> value = obj->Get(GetV8String(key));
|
||||||
if (!HasCaught(try_catch) && !value.IsEmpty())
|
if (!HasCaught(try_catch) && !value.IsEmpty())
|
||||||
return new CefV8ValueImpl(value);
|
return new CefV8ValueImpl(value);
|
||||||
@ -1005,6 +1027,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(int index) {
|
|||||||
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
||||||
|
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch;
|
||||||
|
try_catch.SetVerbose(true);
|
||||||
v8::Local<v8::Value> value = obj->Get(v8::Number::New(index));
|
v8::Local<v8::Value> value = obj->Get(v8::Number::New(index));
|
||||||
if (!HasCaught(try_catch) && !value.IsEmpty())
|
if (!HasCaught(try_catch) && !value.IsEmpty())
|
||||||
return new CefV8ValueImpl(value);
|
return new CefV8ValueImpl(value);
|
||||||
@ -1021,8 +1044,9 @@ bool CefV8ValueImpl::SetValue(const CefString& key,
|
|||||||
if (impl && !key.empty()) {
|
if (impl && !key.empty()) {
|
||||||
v8::HandleScope handle_scope;
|
v8::HandleScope handle_scope;
|
||||||
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
||||||
|
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch;
|
||||||
|
try_catch.SetVerbose(true);
|
||||||
bool set = obj->Set(GetV8String(key), impl->GetHandle(),
|
bool set = obj->Set(GetV8String(key), impl->GetHandle(),
|
||||||
static_cast<v8::PropertyAttribute>(attribute));
|
static_cast<v8::PropertyAttribute>(attribute));
|
||||||
return (!HasCaught(try_catch) && set);
|
return (!HasCaught(try_catch) && set);
|
||||||
@ -1045,8 +1069,9 @@ bool CefV8ValueImpl::SetValue(int index, CefRefPtr<CefV8Value> value) {
|
|||||||
if (impl) {
|
if (impl) {
|
||||||
v8::HandleScope handle_scope;
|
v8::HandleScope handle_scope;
|
||||||
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
v8::Local<v8::Object> obj = GetHandle()->ToObject();
|
||||||
|
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch;
|
||||||
|
try_catch.SetVerbose(true);
|
||||||
bool set = obj->Set(index, impl->GetHandle());
|
bool set = obj->Set(index, impl->GetHandle());
|
||||||
return (!HasCaught(try_catch) && set);
|
return (!HasCaught(try_catch) && set);
|
||||||
} else {
|
} else {
|
||||||
@ -1083,6 +1108,7 @@ bool CefV8ValueImpl::SetValue(const CefString& key, AccessControl settings,
|
|||||||
NULL : AccessorSetterCallbackImpl;
|
NULL : AccessorSetterCallbackImpl;
|
||||||
|
|
||||||
v8::TryCatch try_catch;
|
v8::TryCatch try_catch;
|
||||||
|
try_catch.SetVerbose(true);
|
||||||
bool set = obj->SetAccessor(GetV8String(key), getter, setter, obj,
|
bool set = obj->SetAccessor(GetV8String(key), getter, setter, obj,
|
||||||
static_cast<v8::AccessControl>(settings),
|
static_cast<v8::AccessControl>(settings),
|
||||||
static_cast<v8::PropertyAttribute>(attribute));
|
static_cast<v8::PropertyAttribute>(attribute));
|
||||||
@ -1250,10 +1276,21 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::ExecuteFunctionWithContext(
|
|||||||
|
|
||||||
CefRefPtr<CefV8Value> retval;
|
CefRefPtr<CefV8Value> retval;
|
||||||
|
|
||||||
v8::TryCatch try_catch;
|
{
|
||||||
v8::Local<v8::Value> func_rv = func->Call(recv, argc, argv);
|
v8::TryCatch try_catch;
|
||||||
if (!HasCaught(try_catch))
|
try_catch.SetVerbose(true);
|
||||||
retval = new CefV8ValueImpl(func_rv);
|
v8::Local<v8::Value> func_rv;
|
||||||
|
|
||||||
|
// Execute the function call using the V8Proxy so that inspector
|
||||||
|
// instrumentation works.
|
||||||
|
WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve();
|
||||||
|
DCHECK(proxy);
|
||||||
|
if (proxy)
|
||||||
|
func_rv = proxy->callFunction(func, recv, argc, argv);
|
||||||
|
|
||||||
|
if (!HasCaught(try_catch) && !func_rv.IsEmpty())
|
||||||
|
retval = new CefV8ValueImpl(func_rv);
|
||||||
|
}
|
||||||
|
|
||||||
if (argv)
|
if (argv)
|
||||||
delete [] argv;
|
delete [] argv;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "libcef_dll/cpptoc/render_process_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/render_process_handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h"
|
||||||
#include "libcef_dll/ctocpp/command_line_ctocpp.h"
|
#include "libcef_dll/ctocpp/command_line_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/scheme_registrar_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
@ -39,6 +40,23 @@ void CEF_CALLBACK app_on_before_command_line_processing(struct _cef_app_t* self,
|
|||||||
CefCommandLineCToCpp::Wrap(command_line));
|
CefCommandLineCToCpp::Wrap(command_line));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK app_on_register_custom_schemes(struct _cef_app_t* self,
|
||||||
|
struct _cef_scheme_registrar_t* registrar) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return;
|
||||||
|
// Verify param: registrar; type: refptr_diff
|
||||||
|
DCHECK(registrar);
|
||||||
|
if (!registrar)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefAppCppToC::Get(self)->OnRegisterCustomSchemes(
|
||||||
|
CefSchemeRegistrarCToCpp::Wrap(registrar));
|
||||||
|
}
|
||||||
|
|
||||||
struct _cef_render_process_handler_t* CEF_CALLBACK app_get_render_process_handler(
|
struct _cef_render_process_handler_t* CEF_CALLBACK app_get_render_process_handler(
|
||||||
struct _cef_app_t* self) {
|
struct _cef_app_t* self) {
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
@ -94,6 +112,7 @@ CefAppCppToC::CefAppCppToC(CefApp* cls)
|
|||||||
: CefCppToC<CefAppCppToC, CefApp, cef_app_t>(cls) {
|
: CefCppToC<CefAppCppToC, CefApp, cef_app_t>(cls) {
|
||||||
struct_.struct_.on_before_command_line_processing =
|
struct_.struct_.on_before_command_line_processing =
|
||||||
app_on_before_command_line_processing;
|
app_on_before_command_line_processing;
|
||||||
|
struct_.struct_.on_register_custom_schemes = app_on_register_custom_schemes;
|
||||||
struct_.struct_.get_render_process_handler = app_get_render_process_handler;
|
struct_.struct_.get_render_process_handler = app_get_render_process_handler;
|
||||||
struct_.struct_.get_resource_bundle_handler = app_get_resource_bundle_handler;
|
struct_.struct_.get_resource_bundle_handler = app_get_resource_bundle_handler;
|
||||||
struct_.struct_.get_proxy_handler = app_get_proxy_handler;
|
struct_.struct_.get_proxy_handler = app_get_proxy_handler;
|
||||||
|
@ -212,24 +212,24 @@ void CEF_CALLBACK frame_load_string(struct _cef_frame_t* self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CEF_CALLBACK frame_execute_java_script(struct _cef_frame_t* self,
|
void CEF_CALLBACK frame_execute_java_script(struct _cef_frame_t* self,
|
||||||
const cef_string_t* jsCode, const cef_string_t* scriptUrl,
|
const cef_string_t* code, const cef_string_t* script_url,
|
||||||
int startLine) {
|
int start_line) {
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
DCHECK(self);
|
DCHECK(self);
|
||||||
if (!self)
|
if (!self)
|
||||||
return;
|
return;
|
||||||
// Verify param: jsCode; type: string_byref_const
|
// Verify param: code; type: string_byref_const
|
||||||
DCHECK(jsCode);
|
DCHECK(code);
|
||||||
if (!jsCode)
|
if (!code)
|
||||||
return;
|
return;
|
||||||
// Unverified params: scriptUrl
|
// Unverified params: script_url
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
CefFrameCppToC::Get(self)->ExecuteJavaScript(
|
CefFrameCppToC::Get(self)->ExecuteJavaScript(
|
||||||
CefString(jsCode),
|
CefString(code),
|
||||||
CefString(scriptUrl),
|
CefString(script_url),
|
||||||
startLine);
|
start_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CEF_CALLBACK frame_is_main(struct _cef_frame_t* self) {
|
int CEF_CALLBACK frame_is_main(struct _cef_frame_t* self) {
|
||||||
|
55
libcef_dll/cpptoc/scheme_registrar_cpptoc.cc
Normal file
55
libcef_dll/cpptoc/scheme_registrar_cpptoc.cc
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/scheme_registrar_cpptoc.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
int CEF_CALLBACK scheme_registrar_add_custom_scheme(
|
||||||
|
struct _cef_scheme_registrar_t* self, const cef_string_t* scheme_name,
|
||||||
|
int is_standard, int is_local, int is_display_isolated) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return 0;
|
||||||
|
// Verify param: scheme_name; type: string_byref_const
|
||||||
|
DCHECK(scheme_name);
|
||||||
|
if (!scheme_name)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefSchemeRegistrarCppToC::Get(self)->AddCustomScheme(
|
||||||
|
CefString(scheme_name),
|
||||||
|
is_standard?true:false,
|
||||||
|
is_local?true:false,
|
||||||
|
is_display_isolated?true:false);
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefSchemeRegistrarCppToC::CefSchemeRegistrarCppToC(CefSchemeRegistrar* cls)
|
||||||
|
: CefCppToC<CefSchemeRegistrarCppToC, CefSchemeRegistrar,
|
||||||
|
cef_scheme_registrar_t>(cls) {
|
||||||
|
struct_.struct_.add_custom_scheme = scheme_registrar_add_custom_scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefSchemeRegistrarCppToC, CefSchemeRegistrar,
|
||||||
|
cef_scheme_registrar_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
37
libcef_dll/cpptoc/scheme_registrar_cpptoc.h
Normal file
37
libcef_dll/cpptoc/scheme_registrar_cpptoc.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_DLL_CPPTOC_SCHEME_REGISTRAR_CPPTOC_H_
|
||||||
|
#define CEF_LIBCEF_DLL_CPPTOC_SCHEME_REGISTRAR_CPPTOC_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef BUILDING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
|
||||||
|
#else // BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef_scheme.h"
|
||||||
|
#include "include/capi/cef_scheme_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed DLL-side only.
|
||||||
|
class CefSchemeRegistrarCppToC
|
||||||
|
: public CefCppToC<CefSchemeRegistrarCppToC, CefSchemeRegistrar,
|
||||||
|
cef_scheme_registrar_t> {
|
||||||
|
public:
|
||||||
|
explicit CefSchemeRegistrarCppToC(CefSchemeRegistrar* cls);
|
||||||
|
virtual ~CefSchemeRegistrarCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BUILDING_CEF_SHARED
|
||||||
|
#endif // CEF_LIBCEF_DLL_CPPTOC_SCHEME_REGISTRAR_CPPTOC_H_
|
||||||
|
|
@ -11,6 +11,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "libcef_dll/cpptoc/command_line_cpptoc.h"
|
#include "libcef_dll/cpptoc/command_line_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/scheme_registrar_cpptoc.h"
|
||||||
#include "libcef_dll/ctocpp/app_ctocpp.h"
|
#include "libcef_dll/ctocpp/app_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/proxy_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/proxy_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/render_process_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/render_process_handler_ctocpp.h"
|
||||||
@ -38,6 +39,23 @@ void CefAppCToCpp::OnBeforeCommandLineProcessing(const CefString& process_type,
|
|||||||
CefCommandLineCppToC::Wrap(command_line));
|
CefCommandLineCppToC::Wrap(command_line));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefAppCToCpp::OnRegisterCustomSchemes(
|
||||||
|
CefRefPtr<CefSchemeRegistrar> registrar) {
|
||||||
|
if (CEF_MEMBER_MISSING(struct_, on_register_custom_schemes))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: registrar; type: refptr_diff
|
||||||
|
DCHECK(registrar.get());
|
||||||
|
if (!registrar.get())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
struct_->on_register_custom_schemes(struct_,
|
||||||
|
CefSchemeRegistrarCppToC::Wrap(registrar));
|
||||||
|
}
|
||||||
|
|
||||||
CefRefPtr<CefRenderProcessHandler> CefAppCToCpp::GetRenderProcessHandler() {
|
CefRefPtr<CefRenderProcessHandler> CefAppCToCpp::GetRenderProcessHandler() {
|
||||||
if (CEF_MEMBER_MISSING(struct_, get_render_process_handler))
|
if (CEF_MEMBER_MISSING(struct_, get_render_process_handler))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -34,6 +34,8 @@ class CefAppCToCpp
|
|||||||
// CefApp methods
|
// CefApp methods
|
||||||
virtual void OnBeforeCommandLineProcessing(const CefString& process_type,
|
virtual void OnBeforeCommandLineProcessing(const CefString& process_type,
|
||||||
CefRefPtr<CefCommandLine> command_line) OVERRIDE;
|
CefRefPtr<CefCommandLine> command_line) OVERRIDE;
|
||||||
|
virtual void OnRegisterCustomSchemes(
|
||||||
|
CefRefPtr<CefSchemeRegistrar> registrar) OVERRIDE;
|
||||||
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() OVERRIDE;
|
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() OVERRIDE;
|
||||||
virtual CefRefPtr<CefResourceBundleHandler> GetResourceBundleHandler(
|
virtual CefRefPtr<CefResourceBundleHandler> GetResourceBundleHandler(
|
||||||
) OVERRIDE;
|
) OVERRIDE;
|
||||||
|
@ -198,24 +198,24 @@ void CefFrameCToCpp::LoadString(const CefString& string_val,
|
|||||||
url.GetStruct());
|
url.GetStruct());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefFrameCToCpp::ExecuteJavaScript(const CefString& jsCode,
|
void CefFrameCToCpp::ExecuteJavaScript(const CefString& code,
|
||||||
const CefString& scriptUrl, int startLine) {
|
const CefString& script_url, int start_line) {
|
||||||
if (CEF_MEMBER_MISSING(struct_, execute_java_script))
|
if (CEF_MEMBER_MISSING(struct_, execute_java_script))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
// Verify param: jsCode; type: string_byref_const
|
// Verify param: code; type: string_byref_const
|
||||||
DCHECK(!jsCode.empty());
|
DCHECK(!code.empty());
|
||||||
if (jsCode.empty())
|
if (code.empty())
|
||||||
return;
|
return;
|
||||||
// Unverified params: scriptUrl
|
// Unverified params: script_url
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
struct_->execute_java_script(struct_,
|
struct_->execute_java_script(struct_,
|
||||||
jsCode.GetStruct(),
|
code.GetStruct(),
|
||||||
scriptUrl.GetStruct(),
|
script_url.GetStruct(),
|
||||||
startLine);
|
start_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefFrameCToCpp::IsMain() {
|
bool CefFrameCToCpp::IsMain() {
|
||||||
|
@ -51,8 +51,8 @@ class CefFrameCToCpp
|
|||||||
virtual void LoadURL(const CefString& url) OVERRIDE;
|
virtual void LoadURL(const CefString& url) OVERRIDE;
|
||||||
virtual void LoadString(const CefString& string_val,
|
virtual void LoadString(const CefString& string_val,
|
||||||
const CefString& url) OVERRIDE;
|
const CefString& url) OVERRIDE;
|
||||||
virtual void ExecuteJavaScript(const CefString& jsCode,
|
virtual void ExecuteJavaScript(const CefString& code,
|
||||||
const CefString& scriptUrl, int startLine) OVERRIDE;
|
const CefString& script_url, int start_line) OVERRIDE;
|
||||||
virtual bool IsMain() OVERRIDE;
|
virtual bool IsMain() OVERRIDE;
|
||||||
virtual bool IsFocused() OVERRIDE;
|
virtual bool IsFocused() OVERRIDE;
|
||||||
virtual CefString GetName() OVERRIDE;
|
virtual CefString GetName() OVERRIDE;
|
||||||
|
46
libcef_dll/ctocpp/scheme_registrar_ctocpp.cc
Normal file
46
libcef_dll/ctocpp/scheme_registrar_ctocpp.cc
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/ctocpp/scheme_registrar_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// VIRTUAL METHODS - Body may be edited by hand.
|
||||||
|
|
||||||
|
bool CefSchemeRegistrarCToCpp::AddCustomScheme(const CefString& scheme_name,
|
||||||
|
bool is_standard, bool is_local, bool is_display_isolated) {
|
||||||
|
if (CEF_MEMBER_MISSING(struct_, add_custom_scheme))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: scheme_name; type: string_byref_const
|
||||||
|
DCHECK(!scheme_name.empty());
|
||||||
|
if (scheme_name.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = struct_->add_custom_scheme(struct_,
|
||||||
|
scheme_name.GetStruct(),
|
||||||
|
is_standard,
|
||||||
|
is_local,
|
||||||
|
is_display_isolated);
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCToCpp<CefSchemeRegistrarCToCpp, CefSchemeRegistrar,
|
||||||
|
cef_scheme_registrar_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
43
libcef_dll/ctocpp/scheme_registrar_ctocpp.h
Normal file
43
libcef_dll/ctocpp/scheme_registrar_ctocpp.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_DLL_CTOCPP_SCHEME_REGISTRAR_CTOCPP_H_
|
||||||
|
#define CEF_LIBCEF_DLL_CTOCPP_SCHEME_REGISTRAR_CTOCPP_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef_scheme.h"
|
||||||
|
#include "include/capi/cef_scheme_capi.h"
|
||||||
|
#include "libcef_dll/ctocpp/ctocpp.h"
|
||||||
|
|
||||||
|
// Wrap a C structure with a C++ class.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefSchemeRegistrarCToCpp
|
||||||
|
: public CefCToCpp<CefSchemeRegistrarCToCpp, CefSchemeRegistrar,
|
||||||
|
cef_scheme_registrar_t> {
|
||||||
|
public:
|
||||||
|
explicit CefSchemeRegistrarCToCpp(cef_scheme_registrar_t* str)
|
||||||
|
: CefCToCpp<CefSchemeRegistrarCToCpp, CefSchemeRegistrar,
|
||||||
|
cef_scheme_registrar_t>(str) {}
|
||||||
|
virtual ~CefSchemeRegistrarCToCpp() {}
|
||||||
|
|
||||||
|
// CefSchemeRegistrar methods
|
||||||
|
virtual bool AddCustomScheme(const CefString& scheme_name, bool is_standard,
|
||||||
|
bool is_local, bool is_display_isolated) OVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // CEF_LIBCEF_DLL_CTOCPP_SCHEME_REGISTRAR_CTOCPP_H_
|
||||||
|
|
@ -40,6 +40,7 @@
|
|||||||
#include "libcef_dll/cpptoc/process_message_cpptoc.h"
|
#include "libcef_dll/cpptoc/process_message_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/response_cpptoc.h"
|
#include "libcef_dll/cpptoc/response_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/scheme_registrar_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/stream_reader_cpptoc.h"
|
#include "libcef_dll/cpptoc/stream_reader_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/stream_writer_cpptoc.h"
|
#include "libcef_dll/cpptoc/stream_writer_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/v8context_cpptoc.h"
|
#include "libcef_dll/cpptoc/v8context_cpptoc.h"
|
||||||
@ -168,6 +169,7 @@ CEF_EXPORT void cef_shutdown() {
|
|||||||
DCHECK_EQ(CefResourceHandlerCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefResourceHandlerCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefResponseCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefResponseCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefSchemeHandlerFactoryCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefSchemeHandlerFactoryCToCpp::DebugObjCt, 0);
|
||||||
|
DCHECK_EQ(CefSchemeRegistrarCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefStreamReaderCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefStreamReaderCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefStreamWriterCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefStreamWriterCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefStringVisitorCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefStringVisitorCToCpp::DebugObjCt, 0);
|
||||||
@ -272,26 +274,6 @@ CEF_EXPORT int cef_clear_cross_origin_whitelist() {
|
|||||||
return _retval;
|
return _retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
CEF_EXPORT int cef_register_custom_scheme(const cef_string_t* scheme_name,
|
|
||||||
int is_standard, int is_local, int is_display_isolated) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Verify param: scheme_name; type: string_byref_const
|
|
||||||
DCHECK(scheme_name);
|
|
||||||
if (!scheme_name)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
bool _retval = CefRegisterCustomScheme(
|
|
||||||
CefString(scheme_name),
|
|
||||||
is_standard?true:false,
|
|
||||||
is_local?true:false,
|
|
||||||
is_display_isolated?true:false);
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT int cef_register_scheme_handler_factory(
|
CEF_EXPORT int cef_register_scheme_handler_factory(
|
||||||
const cef_string_t* scheme_name, const cef_string_t* domain_name,
|
const cef_string_t* scheme_name, const cef_string_t* domain_name,
|
||||||
struct _cef_scheme_handler_factory_t* factory) {
|
struct _cef_scheme_handler_factory_t* factory) {
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
#include "libcef_dll/ctocpp/process_message_ctocpp.h"
|
#include "libcef_dll/ctocpp/process_message_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/response_ctocpp.h"
|
#include "libcef_dll/ctocpp/response_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/scheme_registrar_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/stream_reader_ctocpp.h"
|
#include "libcef_dll/ctocpp/stream_reader_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/stream_writer_ctocpp.h"
|
#include "libcef_dll/ctocpp/stream_writer_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/v8context_ctocpp.h"
|
#include "libcef_dll/ctocpp/v8context_ctocpp.h"
|
||||||
@ -160,6 +161,7 @@ CEF_GLOBAL void CefShutdown() {
|
|||||||
DCHECK_EQ(CefResourceHandlerCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefResourceHandlerCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefResponseCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefResponseCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefSchemeHandlerFactoryCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefSchemeHandlerFactoryCppToC::DebugObjCt, 0);
|
||||||
|
DCHECK_EQ(CefSchemeRegistrarCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefStreamReaderCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefStreamReaderCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefStreamWriterCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefStreamWriterCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefStringVisitorCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefStringVisitorCppToC::DebugObjCt, 0);
|
||||||
@ -264,26 +266,6 @@ CEF_GLOBAL bool CefClearCrossOriginWhitelist() {
|
|||||||
return _retval?true:false;
|
return _retval?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CEF_GLOBAL bool CefRegisterCustomScheme(const CefString& scheme_name,
|
|
||||||
bool is_standard, bool is_local, bool is_display_isolated) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Verify param: scheme_name; type: string_byref_const
|
|
||||||
DCHECK(!scheme_name.empty());
|
|
||||||
if (scheme_name.empty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int _retval = cef_register_custom_scheme(
|
|
||||||
scheme_name.GetStruct(),
|
|
||||||
is_standard,
|
|
||||||
is_local,
|
|
||||||
is_display_isolated);
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_GLOBAL bool CefRegisterSchemeHandlerFactory(const CefString& scheme_name,
|
CEF_GLOBAL bool CefRegisterSchemeHandlerFactory(const CefString& scheme_name,
|
||||||
const CefString& domain_name,
|
const CefString& domain_name,
|
||||||
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
||||||
|
@ -72,7 +72,7 @@ gboolean XMLHttpRequestActivated(GtkWidget* widget) {
|
|||||||
// Callback for Debug > Scheme Handler... menu item.
|
// Callback for Debug > Scheme Handler... menu item.
|
||||||
gboolean SchemeHandlerActivated(GtkWidget* widget) {
|
gboolean SchemeHandlerActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserId())
|
if (g_handler.get() && g_handler->GetBrowserId())
|
||||||
RunSchemeTest(g_handler->GetBrowser());
|
scheme_test::RunTest(g_handler->GetBrowser());
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@ int main(int argc, char* argv[]) {
|
|||||||
CefInitialize(main_args, settings, app.get());
|
CefInitialize(main_args, settings, app.get());
|
||||||
|
|
||||||
// Register the scheme handler.
|
// Register the scheme handler.
|
||||||
InitSchemeTest();
|
scheme_test::InitTest();
|
||||||
|
|
||||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
|
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
|
||||||
|
@ -58,43 +58,6 @@ static NSAutoreleasePool* g_autopool = nil;
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
// Common base class for CEF browser windows. Contains methods relating to hole
|
|
||||||
// punching required in order to display OpenGL underlay windows.
|
|
||||||
@interface ClientWindow : NSWindow<CefUnderlayableSurface> {
|
|
||||||
@private
|
|
||||||
int underlaySurfaceCount_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Informs the window that an underlay surface has been added/removed. The
|
|
||||||
// window is non-opaque while underlay surfaces are present.
|
|
||||||
- (void)underlaySurfaceAdded;
|
|
||||||
- (void)underlaySurfaceRemoved;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation ClientWindow
|
|
||||||
|
|
||||||
- (void)underlaySurfaceAdded {
|
|
||||||
ASSERT(underlaySurfaceCount_ >= 0);
|
|
||||||
++underlaySurfaceCount_;
|
|
||||||
|
|
||||||
// We're having the OpenGL surface render under the window, so the window
|
|
||||||
// needs to be not opaque.
|
|
||||||
if (underlaySurfaceCount_ == 1)
|
|
||||||
[self setOpaque:NO];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)underlaySurfaceRemoved {
|
|
||||||
--underlaySurfaceCount_;
|
|
||||||
ASSERT(underlaySurfaceCount_ >= 0);
|
|
||||||
|
|
||||||
if (underlaySurfaceCount_ == 0)
|
|
||||||
[self setOpaque:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
// Receives notifications from controls and the browser window. Will delete
|
// Receives notifications from controls and the browser window. Will delete
|
||||||
// itself when done.
|
// itself when done.
|
||||||
@interface ClientWindowDelegate : NSObject <NSWindowDelegate>
|
@interface ClientWindowDelegate : NSObject <NSWindowDelegate>
|
||||||
@ -307,7 +270,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
NSRect screen_rect = [[NSScreen mainScreen] visibleFrame];
|
NSRect screen_rect = [[NSScreen mainScreen] visibleFrame];
|
||||||
NSRect window_rect = { {0, screen_rect.size.height - kWindowHeight},
|
NSRect window_rect = { {0, screen_rect.size.height - kWindowHeight},
|
||||||
{kWindowWidth, kWindowHeight} };
|
{kWindowWidth, kWindowHeight} };
|
||||||
NSWindow* mainWnd = [[ClientWindow alloc]
|
NSWindow* mainWnd = [[UnderlayOpenGLHostingWindow alloc]
|
||||||
initWithContentRect:window_rect
|
initWithContentRect:window_rect
|
||||||
styleMask:(NSTitledWindowMask |
|
styleMask:(NSTitledWindowMask |
|
||||||
NSClosableWindowMask |
|
NSClosableWindowMask |
|
||||||
@ -415,7 +378,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
|
|
||||||
- (IBAction)testSchemeHandler:(id)sender {
|
- (IBAction)testSchemeHandler:(id)sender {
|
||||||
if (g_handler.get() && g_handler->GetBrowserId())
|
if (g_handler.get() && g_handler->GetBrowserId())
|
||||||
RunSchemeTest(g_handler->GetBrowser());
|
scheme_test::RunTest(g_handler->GetBrowser());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)testBinding:(id)sender {
|
- (IBAction)testBinding:(id)sender {
|
||||||
@ -503,8 +466,8 @@ int main(int argc, char* argv[]) {
|
|||||||
// Initialize CEF.
|
// Initialize CEF.
|
||||||
CefInitialize(main_args, settings, app.get());
|
CefInitialize(main_args, settings, app.get());
|
||||||
|
|
||||||
// Initialize tests.
|
// Register the scheme handler.
|
||||||
InitSchemeTest();
|
scheme_test::InitTest();
|
||||||
|
|
||||||
// Create the application delegate and window.
|
// Create the application delegate and window.
|
||||||
NSObject* delegate = [[ClientAppDelegate alloc] init];
|
NSObject* delegate = [[ClientAppDelegate alloc] init];
|
||||||
|
@ -77,7 +77,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||||||
CefInitialize(main_args, settings, app.get());
|
CefInitialize(main_args, settings, app.get());
|
||||||
|
|
||||||
// Register the scheme handler.
|
// Register the scheme handler.
|
||||||
InitSchemeTest();
|
scheme_test::InitTest();
|
||||||
|
|
||||||
HACCEL hAccelTable;
|
HACCEL hAccelTable;
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_SCHEME_HANDLER: // Test the scheme handler
|
case ID_TESTS_SCHEME_HANDLER: // Test the scheme handler
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunSchemeTest(browser);
|
scheme_test::RunTest(browser);
|
||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_BINDING: // Test JavaScript binding
|
case ID_TESTS_BINDING: // Test JavaScript binding
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
|
@ -88,10 +88,17 @@ class ClientApp : public CefApp,
|
|||||||
// client_app_delegates.
|
// client_app_delegates.
|
||||||
static void CreateRenderDelegates(RenderDelegateSet& delegates);
|
static void CreateRenderDelegates(RenderDelegateSet& delegates);
|
||||||
|
|
||||||
|
// Registers custom schemes. Implemented in client_app_delegates.
|
||||||
|
static void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar);
|
||||||
|
|
||||||
// CefApp methods.
|
// CefApp methods.
|
||||||
virtual CefRefPtr<CefProxyHandler> GetProxyHandler() OVERRIDE { return this; }
|
virtual void OnRegisterCustomSchemes(
|
||||||
|
CefRefPtr<CefSchemeRegistrar> registrar) OVERRIDE {
|
||||||
|
RegisterCustomSchemes(registrar);
|
||||||
|
}
|
||||||
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler()
|
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler()
|
||||||
OVERRIDE { return this; }
|
OVERRIDE { return this; }
|
||||||
|
virtual CefRefPtr<CefProxyHandler> GetProxyHandler() OVERRIDE { return this; }
|
||||||
|
|
||||||
// CefProxyHandler methods.
|
// CefProxyHandler methods.
|
||||||
virtual void GetProxyForUrl(const CefString& url,
|
virtual void GetProxyForUrl(const CefString& url,
|
||||||
|
@ -3,7 +3,13 @@
|
|||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "cefclient/client_app.h"
|
#include "cefclient/client_app.h"
|
||||||
|
#include "cefclient/scheme_test.h"
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) {
|
void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void ClientApp::RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar) {
|
||||||
|
scheme_test::RegisterCustomSchemes(registrar);
|
||||||
|
}
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
#include "cefclient/resource.h"
|
#include "cefclient/resource.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace scheme_test {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
// Implementation of the schema handler for client:// requests.
|
// Implementation of the schema handler for client:// requests.
|
||||||
class ClientSchemeHandler : public CefResourceHandler {
|
class ClientSchemeHandler : public CefResourceHandler {
|
||||||
@ -160,12 +163,19 @@ class ClientSchemeHandlerFactory : public CefSchemeHandlerFactory {
|
|||||||
IMPLEMENT_REFCOUNTING(ClientSchemeHandlerFactory);
|
IMPLEMENT_REFCOUNTING(ClientSchemeHandlerFactory);
|
||||||
};
|
};
|
||||||
|
|
||||||
void InitSchemeTest() {
|
} // namespace
|
||||||
CefRegisterCustomScheme("client", true, false, false);
|
|
||||||
|
void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar) {
|
||||||
|
registrar->AddCustomScheme("client", true, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitTest() {
|
||||||
CefRegisterSchemeHandlerFactory("client", "tests",
|
CefRegisterSchemeHandlerFactory("client", "tests",
|
||||||
new ClientSchemeHandlerFactory());
|
new ClientSchemeHandlerFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunSchemeTest(CefRefPtr<CefBrowser> browser) {
|
void RunTest(CefRefPtr<CefBrowser> browser) {
|
||||||
browser->GetMainFrame()->LoadURL("client://tests/handler.html");
|
browser->GetMainFrame()->LoadURL("client://tests/handler.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace scheme_test
|
||||||
|
@ -9,11 +9,19 @@
|
|||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
|
|
||||||
class CefBrowser;
|
class CefBrowser;
|
||||||
|
class CefSchemeRegistrar;
|
||||||
|
|
||||||
// Register the scheme handler.
|
namespace scheme_test {
|
||||||
void InitSchemeTest();
|
|
||||||
|
// Register the scheme.
|
||||||
|
void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar);
|
||||||
|
|
||||||
|
// Create the scheme handler.
|
||||||
|
void InitTest();
|
||||||
|
|
||||||
// Run the test.
|
// Run the test.
|
||||||
void RunSchemeTest(CefRefPtr<CefBrowser> browser);
|
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||||
|
|
||||||
|
} // namespace scheme_test
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_
|
||||||
|
@ -15,3 +15,16 @@ void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) {
|
|||||||
extern void CreateV8RendererTests(ClientApp::RenderDelegateSet& delegates);
|
extern void CreateV8RendererTests(ClientApp::RenderDelegateSet& delegates);
|
||||||
CreateV8RendererTests(delegates);
|
CreateV8RendererTests(delegates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void ClientApp::RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar) {
|
||||||
|
// Bring in the scheme handler tests.
|
||||||
|
extern void RegisterSchemeHandlerCustomSchemes(
|
||||||
|
CefRefPtr<CefSchemeRegistrar> registrar);
|
||||||
|
RegisterSchemeHandlerCustomSchemes(registrar);
|
||||||
|
|
||||||
|
// Bring in the cookie tests.
|
||||||
|
extern void RegisterCookieCustomSchemes(
|
||||||
|
CefRefPtr<CefSchemeRegistrar> registrar);
|
||||||
|
RegisterCookieCustomSchemes(registrar);
|
||||||
|
}
|
||||||
|
@ -813,8 +813,6 @@ class CookieTestSchemeHandler : public TestHandler {
|
|||||||
manager2_ = CefCookieManager::CreateManager(CefString());
|
manager2_ = CefCookieManager::CreateManager(CefString());
|
||||||
|
|
||||||
if (scheme_ != "http") {
|
if (scheme_ != "http") {
|
||||||
CefRegisterCustomScheme(scheme_, true, false, false);
|
|
||||||
|
|
||||||
std::vector<CefString> schemes;
|
std::vector<CefString> schemes;
|
||||||
schemes.push_back("http");
|
schemes.push_back("http");
|
||||||
schemes.push_back("https");
|
schemes.push_back("https");
|
||||||
@ -957,3 +955,10 @@ TEST(CookieTest, GetCookieManagerCustom) {
|
|||||||
EXPECT_TRUE(handler->got_cookie2_);
|
EXPECT_TRUE(handler->got_cookie2_);
|
||||||
EXPECT_TRUE(handler->got_cookie3_);
|
EXPECT_TRUE(handler->got_cookie3_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called to register custom schemes.
|
||||||
|
void RegisterCookieCustomSchemes(
|
||||||
|
CefRefPtr<CefSchemeRegistrar> registrar) {
|
||||||
|
// Used by GetCookieManagerCustom test.
|
||||||
|
registrar->AddCustomScheme("ccustom", true, false, false);
|
||||||
|
}
|
||||||
|
@ -325,20 +325,6 @@ TestResults g_TestResults;
|
|||||||
// If |domain| is empty the scheme will be registered as non-standard.
|
// If |domain| is empty the scheme will be registered as non-standard.
|
||||||
void RegisterTestScheme(const std::string& scheme, const std::string& domain) {
|
void RegisterTestScheme(const std::string& scheme, const std::string& domain) {
|
||||||
g_TestResults.reset();
|
g_TestResults.reset();
|
||||||
static std::set<std::string> schemes;
|
|
||||||
|
|
||||||
if (schemes.empty()) {
|
|
||||||
// Never register built-in schemes.
|
|
||||||
schemes.insert("http");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only register custom schemes one time.
|
|
||||||
if (schemes.find(scheme) == schemes.end()) {
|
|
||||||
EXPECT_TRUE(CefRegisterCustomScheme(scheme, domain.empty()?false:true,
|
|
||||||
false, false));
|
|
||||||
WaitForUIThread();
|
|
||||||
schemes.insert(scheme);
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPECT_TRUE(CefRegisterSchemeHandlerFactory(scheme, domain,
|
EXPECT_TRUE(CefRegisterSchemeHandlerFactory(scheme, domain,
|
||||||
new ClientSchemeHandlerFactory(&g_TestResults)));
|
new ClientSchemeHandlerFactory(&g_TestResults)));
|
||||||
@ -961,3 +947,12 @@ TEST(SchemeHandlerTest, HttpXSSDifferentOriginWithDomain) {
|
|||||||
|
|
||||||
ClearTestSchemes();
|
ClearTestSchemes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called to register custom schemes.
|
||||||
|
void RegisterSchemeHandlerCustomSchemes(
|
||||||
|
CefRefPtr<CefSchemeRegistrar> registrar) {
|
||||||
|
// Add a custom standard scheme.
|
||||||
|
registrar->AddCustomScheme("customstd", true, false, false);
|
||||||
|
// Ad a custom non-standard scheme.
|
||||||
|
registrar->AddCustomScheme("customnonstd", false, false, false);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user