mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- cefclient: Add background-color
command-line argument (issue #1161).
- Rename cef_url.h to cef_parser.h. - Add new CefParseCSSColor function.
This commit is contained in:
4
cef.gyp
4
cef.gyp
@ -422,6 +422,7 @@
|
|||||||
'tests/unittests/message_router_unittest.cc',
|
'tests/unittests/message_router_unittest.cc',
|
||||||
'tests/unittests/navigation_unittest.cc',
|
'tests/unittests/navigation_unittest.cc',
|
||||||
'tests/unittests/os_rendering_unittest.cc',
|
'tests/unittests/os_rendering_unittest.cc',
|
||||||
|
'tests/unittests/parser_unittest.cc',
|
||||||
'tests/unittests/print_unittest.cc',
|
'tests/unittests/print_unittest.cc',
|
||||||
'tests/unittests/process_message_unittest.cc',
|
'tests/unittests/process_message_unittest.cc',
|
||||||
'tests/unittests/request_context_unittest.cc',
|
'tests/unittests/request_context_unittest.cc',
|
||||||
@ -443,7 +444,6 @@
|
|||||||
'tests/unittests/test_util.cc',
|
'tests/unittests/test_util.cc',
|
||||||
'tests/unittests/test_util.h',
|
'tests/unittests/test_util.h',
|
||||||
'tests/unittests/tracing_unittest.cc',
|
'tests/unittests/tracing_unittest.cc',
|
||||||
'tests/unittests/url_unittest.cc',
|
|
||||||
'tests/unittests/urlrequest_unittest.cc',
|
'tests/unittests/urlrequest_unittest.cc',
|
||||||
'tests/unittests/v8_unittest.cc',
|
'tests/unittests/v8_unittest.cc',
|
||||||
'tests/unittests/values_unittest.cc',
|
'tests/unittests/values_unittest.cc',
|
||||||
@ -1060,6 +1060,7 @@
|
|||||||
'libcef/common/main_delegate.h',
|
'libcef/common/main_delegate.h',
|
||||||
'libcef/common/net_resource_provider.cc',
|
'libcef/common/net_resource_provider.cc',
|
||||||
'libcef/common/net_resource_provider.h',
|
'libcef/common/net_resource_provider.h',
|
||||||
|
'libcef/common/parser_impl.cc',
|
||||||
'libcef/common/process_message_impl.cc',
|
'libcef/common/process_message_impl.cc',
|
||||||
'libcef/common/process_message_impl.h',
|
'libcef/common/process_message_impl.h',
|
||||||
'libcef/common/request_impl.cc',
|
'libcef/common/request_impl.cc',
|
||||||
@ -1083,7 +1084,6 @@
|
|||||||
'libcef/common/time_util.h',
|
'libcef/common/time_util.h',
|
||||||
'libcef/common/tracker.cc',
|
'libcef/common/tracker.cc',
|
||||||
'libcef/common/tracker.h',
|
'libcef/common/tracker.h',
|
||||||
'libcef/common/url_impl.cc',
|
|
||||||
'libcef/common/urlrequest_impl.cc',
|
'libcef/common/urlrequest_impl.cc',
|
||||||
'libcef/common/value_base.cc',
|
'libcef/common/value_base.cc',
|
||||||
'libcef/common/value_base.h',
|
'libcef/common/value_base.h',
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
'include/cef_menu_model.h',
|
'include/cef_menu_model.h',
|
||||||
'include/cef_navigation_entry.h',
|
'include/cef_navigation_entry.h',
|
||||||
'include/cef_origin_whitelist.h',
|
'include/cef_origin_whitelist.h',
|
||||||
|
'include/cef_parser.h',
|
||||||
'include/cef_path_util.h',
|
'include/cef_path_util.h',
|
||||||
'include/cef_print_handler.h',
|
'include/cef_print_handler.h',
|
||||||
'include/cef_print_settings.h',
|
'include/cef_print_settings.h',
|
||||||
@ -60,7 +61,6 @@
|
|||||||
'include/cef_string_visitor.h',
|
'include/cef_string_visitor.h',
|
||||||
'include/cef_task.h',
|
'include/cef_task.h',
|
||||||
'include/cef_trace.h',
|
'include/cef_trace.h',
|
||||||
'include/cef_url.h',
|
|
||||||
'include/cef_urlrequest.h',
|
'include/cef_urlrequest.h',
|
||||||
'include/cef_v8.h',
|
'include/cef_v8.h',
|
||||||
'include/cef_values.h',
|
'include/cef_values.h',
|
||||||
@ -97,6 +97,7 @@
|
|||||||
'include/capi/cef_menu_model_capi.h',
|
'include/capi/cef_menu_model_capi.h',
|
||||||
'include/capi/cef_navigation_entry_capi.h',
|
'include/capi/cef_navigation_entry_capi.h',
|
||||||
'include/capi/cef_origin_whitelist_capi.h',
|
'include/capi/cef_origin_whitelist_capi.h',
|
||||||
|
'include/capi/cef_parser_capi.h',
|
||||||
'include/capi/cef_path_util_capi.h',
|
'include/capi/cef_path_util_capi.h',
|
||||||
'include/capi/cef_print_handler_capi.h',
|
'include/capi/cef_print_handler_capi.h',
|
||||||
'include/capi/cef_print_settings_capi.h',
|
'include/capi/cef_print_settings_capi.h',
|
||||||
@ -117,7 +118,6 @@
|
|||||||
'include/capi/cef_string_visitor_capi.h',
|
'include/capi/cef_string_visitor_capi.h',
|
||||||
'include/capi/cef_task_capi.h',
|
'include/capi/cef_task_capi.h',
|
||||||
'include/capi/cef_trace_capi.h',
|
'include/capi/cef_trace_capi.h',
|
||||||
'include/capi/cef_url_capi.h',
|
|
||||||
'include/capi/cef_urlrequest_capi.h',
|
'include/capi/cef_urlrequest_capi.h',
|
||||||
'include/capi/cef_v8_capi.h',
|
'include/capi/cef_v8_capi.h',
|
||||||
'include/capi/cef_values_capi.h',
|
'include/capi/cef_values_capi.h',
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_URL_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_PARSER_CAPI_H_
|
||||||
#define CEF_INCLUDE_CAPI_CEF_URL_CAPI_H_
|
#define CEF_INCLUDE_CAPI_CEF_PARSER_CAPI_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/capi/cef_base_capi.h"
|
#include "include/capi/cef_base_capi.h"
|
||||||
@ -113,8 +113,17 @@ CEF_EXPORT cef_string_userfree_t cef_uriencode(const cef_string_t* text,
|
|||||||
CEF_EXPORT cef_string_userfree_t cef_uridecode(const cef_string_t* text,
|
CEF_EXPORT cef_string_userfree_t cef_uridecode(const cef_string_t* text,
|
||||||
int convert_to_utf8, cef_uri_unescape_rule_t unescape_rule);
|
int convert_to_utf8, cef_uri_unescape_rule_t unescape_rule);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Parses |string| which represents a CSS color value. If |strict| is true (1)
|
||||||
|
// strict parsing rules will be applied. Returns true (1) on success or false
|
||||||
|
// (0) on error. If parsing succeeds |color| will be set to the color value
|
||||||
|
// otherwise |color| will remain unchanged.
|
||||||
|
///
|
||||||
|
CEF_EXPORT int cef_parse_csscolor(const cef_string_t* string, int strict,
|
||||||
|
cef_color_t* color);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_CAPI_CEF_URL_CAPI_H_
|
#endif // CEF_INCLUDE_CAPI_CEF_PARSER_CAPI_H_
|
@ -34,8 +34,8 @@
|
|||||||
// tools directory for more information.
|
// tools directory for more information.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CEF_URL_H_
|
#ifndef CEF_INCLUDE_CEF_PARSER_H_
|
||||||
#define CEF_INCLUDE_CEF_URL_H_
|
#define CEF_INCLUDE_CEF_PARSER_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -112,4 +112,15 @@ CefString CefURIDecode(const CefString& text,
|
|||||||
bool convert_to_utf8,
|
bool convert_to_utf8,
|
||||||
cef_uri_unescape_rule_t unescape_rule);
|
cef_uri_unescape_rule_t unescape_rule);
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_CEF_URL_H_
|
///
|
||||||
|
// Parses |string| which represents a CSS color value. If |strict| is true
|
||||||
|
// strict parsing rules will be applied. Returns true on success or false on
|
||||||
|
// error. If parsing succeeds |color| will be set to the color value otherwise
|
||||||
|
// |color| will remain unchanged.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
bool CefParseCSSColor(const CefString& string,
|
||||||
|
bool strict,
|
||||||
|
cef_color_t& color);
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_CEF_PARSER_H_
|
@ -3,11 +3,14 @@
|
|||||||
// be found in the LICENSE file.
|
// be found in the LICENSE file.
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "include/cef_url.h"
|
|
||||||
|
#include "include/cef_parser.h"
|
||||||
|
#include "libcef/renderer/webkit_glue.h"
|
||||||
|
|
||||||
#include "base/base64.h"
|
#include "base/base64.h"
|
||||||
#include "net/base/escape.h"
|
#include "net/base/escape.h"
|
||||||
#include "net/base/mime_util.h"
|
#include "net/base/mime_util.h"
|
||||||
|
#include "third_party/WebKit/public/platform/WebString.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
bool CefParseURL(const CefString& url,
|
bool CefParseURL(const CefString& url,
|
||||||
@ -124,3 +127,10 @@ CefString CefURIDecode(const CefString& text,
|
|||||||
else
|
else
|
||||||
return net::UnescapeURLComponent(text.ToString(), type);
|
return net::UnescapeURLComponent(text.ToString(), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CefParseCSSColor(const CefString& string,
|
||||||
|
bool strict,
|
||||||
|
cef_color_t& color) {
|
||||||
|
return webkit_glue::ParseCSSColor(
|
||||||
|
blink::WebString::fromUTF8(string.ToString().data()), strict, color);
|
||||||
|
}
|
@ -25,6 +25,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
|
|||||||
#include "third_party/WebKit/public/web/WebNode.h"
|
#include "third_party/WebKit/public/web/WebNode.h"
|
||||||
#include "third_party/WebKit/public/web/WebViewClient.h"
|
#include "third_party/WebKit/public/web/WebViewClient.h"
|
||||||
|
|
||||||
|
#include "third_party/WebKit/Source/core/css/parser/CSSParser.h"
|
||||||
#include "third_party/WebKit/Source/core/dom/Node.h"
|
#include "third_party/WebKit/Source/core/dom/Node.h"
|
||||||
#include "third_party/WebKit/Source/web/WebLocalFrameImpl.h"
|
#include "third_party/WebKit/Source/web/WebLocalFrameImpl.h"
|
||||||
#include "third_party/WebKit/Source/web/WebViewImpl.h"
|
#include "third_party/WebKit/Source/web/WebViewImpl.h"
|
||||||
@ -121,4 +122,18 @@ blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ParseCSSColor(const blink::WebString& string, bool strict, SkColor& color) {
|
||||||
|
blink::RGBA32 rgba_color =
|
||||||
|
blink::makeRGBA(SkColorGetR(color), SkColorGetG(color),
|
||||||
|
SkColorGetB(color), SkColorGetA(color));
|
||||||
|
if (!blink::CSSParser::parseColor(rgba_color, string, strict))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
color = SkColorSetARGB(blink::alphaChannel(rgba_color),
|
||||||
|
blink::redChannel(rgba_color),
|
||||||
|
blink::greenChannel(rgba_color),
|
||||||
|
blink::blueChannel(rgba_color));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // webkit_glue
|
} // webkit_glue
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
|
#include "third_party/skia/include/core/SkColor.h"
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
class Context;
|
class Context;
|
||||||
@ -43,6 +44,8 @@ int64 GetIdentifier(blink::WebFrame* frame);
|
|||||||
blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name,
|
blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name,
|
||||||
blink::WebFrame* relative_to_frame);
|
blink::WebFrame* relative_to_frame);
|
||||||
|
|
||||||
|
bool ParseCSSColor(const blink::WebString& string, bool strict, SkColor& color);
|
||||||
|
|
||||||
} // webkit_glue
|
} // webkit_glue
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_RENDERER_WEBKIT_GLUE_H_
|
#endif // CEF_LIBCEF_RENDERER_WEBKIT_GLUE_H_
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
#include "include/capi/cef_geolocation_capi.h"
|
#include "include/capi/cef_geolocation_capi.h"
|
||||||
#include "include/cef_origin_whitelist.h"
|
#include "include/cef_origin_whitelist.h"
|
||||||
#include "include/capi/cef_origin_whitelist_capi.h"
|
#include "include/capi/cef_origin_whitelist_capi.h"
|
||||||
|
#include "include/cef_parser.h"
|
||||||
|
#include "include/capi/cef_parser_capi.h"
|
||||||
#include "include/cef_path_util.h"
|
#include "include/cef_path_util.h"
|
||||||
#include "include/capi/cef_path_util_capi.h"
|
#include "include/capi/cef_path_util_capi.h"
|
||||||
#include "include/cef_process_util.h"
|
#include "include/cef_process_util.h"
|
||||||
@ -26,8 +28,6 @@
|
|||||||
#include "include/capi/cef_task_capi.h"
|
#include "include/capi/cef_task_capi.h"
|
||||||
#include "include/cef_trace.h"
|
#include "include/cef_trace.h"
|
||||||
#include "include/capi/cef_trace_capi.h"
|
#include "include/capi/cef_trace_capi.h"
|
||||||
#include "include/cef_url.h"
|
|
||||||
#include "include/capi/cef_url_capi.h"
|
|
||||||
#include "include/cef_v8.h"
|
#include "include/cef_v8.h"
|
||||||
#include "include/capi/cef_v8_capi.h"
|
#include "include/capi/cef_v8_capi.h"
|
||||||
#include "include/cef_web_plugin.h"
|
#include "include/cef_web_plugin.h"
|
||||||
@ -386,161 +386,6 @@ CEF_EXPORT int cef_clear_cross_origin_whitelist() {
|
|||||||
return _retval;
|
return _retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
CEF_EXPORT int cef_get_path(cef_path_key_t key, cef_string_t* path) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Verify param: path; type: string_byref
|
|
||||||
DCHECK(path);
|
|
||||||
if (!path)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Translate param: path; type: string_byref
|
|
||||||
CefString pathStr(path);
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
bool _retval = CefGetPath(
|
|
||||||
key,
|
|
||||||
pathStr);
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT int cef_launch_process(struct _cef_command_line_t* command_line) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Verify param: command_line; type: refptr_same
|
|
||||||
DCHECK(command_line);
|
|
||||||
if (!command_line)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
bool _retval = CefLaunchProcess(
|
|
||||||
CefCommandLineCppToC::Unwrap(command_line));
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT int cef_register_scheme_handler_factory(
|
|
||||||
const cef_string_t* scheme_name, const cef_string_t* domain_name,
|
|
||||||
struct _cef_scheme_handler_factory_t* factory) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Verify param: scheme_name; type: string_byref_const
|
|
||||||
DCHECK(scheme_name);
|
|
||||||
if (!scheme_name)
|
|
||||||
return 0;
|
|
||||||
// Unverified params: domain_name, factory
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
bool _retval = CefRegisterSchemeHandlerFactory(
|
|
||||||
CefString(scheme_name),
|
|
||||||
CefString(domain_name),
|
|
||||||
CefSchemeHandlerFactoryCToCpp::Wrap(factory));
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT int cef_clear_scheme_handler_factories() {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
bool _retval = CefClearSchemeHandlerFactories();
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT int cef_currently_on(cef_thread_id_t threadId) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
bool _retval = CefCurrentlyOn(
|
|
||||||
threadId);
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT int cef_post_task(cef_thread_id_t threadId,
|
|
||||||
struct _cef_task_t* task) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Verify param: task; type: refptr_diff
|
|
||||||
DCHECK(task);
|
|
||||||
if (!task)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
bool _retval = CefPostTask(
|
|
||||||
threadId,
|
|
||||||
CefTaskCToCpp::Wrap(task));
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT int cef_post_delayed_task(cef_thread_id_t threadId,
|
|
||||||
struct _cef_task_t* task, int64 delay_ms) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Verify param: task; type: refptr_diff
|
|
||||||
DCHECK(task);
|
|
||||||
if (!task)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
bool _retval = CefPostDelayedTask(
|
|
||||||
threadId,
|
|
||||||
CefTaskCToCpp::Wrap(task),
|
|
||||||
delay_ms);
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT int cef_begin_tracing(const cef_string_t* categories,
|
|
||||||
struct _cef_completion_callback_t* callback) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Unverified params: categories, callback
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
bool _retval = CefBeginTracing(
|
|
||||||
CefString(categories),
|
|
||||||
CefCompletionCallbackCToCpp::Wrap(callback));
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT int cef_end_tracing(const cef_string_t* tracing_file,
|
|
||||||
struct _cef_end_tracing_callback_t* callback) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Unverified params: tracing_file, callback
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
bool _retval = CefEndTracing(
|
|
||||||
CefString(tracing_file),
|
|
||||||
CefEndTracingCallbackCToCpp::Wrap(callback));
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT int64 cef_now_from_system_trace_time() {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int64 _retval = CefNowFromSystemTraceTime();
|
|
||||||
|
|
||||||
// Return type: simple
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_EXPORT int cef_parse_url(const cef_string_t* url,
|
CEF_EXPORT int cef_parse_url(const cef_string_t* url,
|
||||||
struct _cef_urlparts_t* parts) {
|
struct _cef_urlparts_t* parts) {
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
@ -717,6 +562,191 @@ CEF_EXPORT cef_string_userfree_t cef_uridecode(const cef_string_t* text,
|
|||||||
return _retval.DetachToUserFree();
|
return _retval.DetachToUserFree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_parse_csscolor(const cef_string_t* string, int strict,
|
||||||
|
cef_color_t* color) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: string; type: string_byref_const
|
||||||
|
DCHECK(string);
|
||||||
|
if (!string)
|
||||||
|
return 0;
|
||||||
|
// Verify param: color; type: simple_byref
|
||||||
|
DCHECK(color);
|
||||||
|
if (!color)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Translate param: color; type: simple_byref
|
||||||
|
cef_color_t colorVal = color?*color:0;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefParseCSSColor(
|
||||||
|
CefString(string),
|
||||||
|
strict?true:false,
|
||||||
|
colorVal);
|
||||||
|
|
||||||
|
// Restore param: color; type: simple_byref
|
||||||
|
if (color)
|
||||||
|
*color = colorVal;
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_get_path(cef_path_key_t key, cef_string_t* path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: path; type: string_byref
|
||||||
|
DCHECK(path);
|
||||||
|
if (!path)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Translate param: path; type: string_byref
|
||||||
|
CefString pathStr(path);
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefGetPath(
|
||||||
|
key,
|
||||||
|
pathStr);
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_launch_process(struct _cef_command_line_t* command_line) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: command_line; type: refptr_same
|
||||||
|
DCHECK(command_line);
|
||||||
|
if (!command_line)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefLaunchProcess(
|
||||||
|
CefCommandLineCppToC::Unwrap(command_line));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_register_scheme_handler_factory(
|
||||||
|
const cef_string_t* scheme_name, const cef_string_t* domain_name,
|
||||||
|
struct _cef_scheme_handler_factory_t* factory) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: scheme_name; type: string_byref_const
|
||||||
|
DCHECK(scheme_name);
|
||||||
|
if (!scheme_name)
|
||||||
|
return 0;
|
||||||
|
// Unverified params: domain_name, factory
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefRegisterSchemeHandlerFactory(
|
||||||
|
CefString(scheme_name),
|
||||||
|
CefString(domain_name),
|
||||||
|
CefSchemeHandlerFactoryCToCpp::Wrap(factory));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_clear_scheme_handler_factories() {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefClearSchemeHandlerFactories();
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_currently_on(cef_thread_id_t threadId) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefCurrentlyOn(
|
||||||
|
threadId);
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_post_task(cef_thread_id_t threadId,
|
||||||
|
struct _cef_task_t* task) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: task; type: refptr_diff
|
||||||
|
DCHECK(task);
|
||||||
|
if (!task)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefPostTask(
|
||||||
|
threadId,
|
||||||
|
CefTaskCToCpp::Wrap(task));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_post_delayed_task(cef_thread_id_t threadId,
|
||||||
|
struct _cef_task_t* task, int64 delay_ms) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: task; type: refptr_diff
|
||||||
|
DCHECK(task);
|
||||||
|
if (!task)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefPostDelayedTask(
|
||||||
|
threadId,
|
||||||
|
CefTaskCToCpp::Wrap(task),
|
||||||
|
delay_ms);
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_begin_tracing(const cef_string_t* categories,
|
||||||
|
struct _cef_completion_callback_t* callback) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Unverified params: categories, callback
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefBeginTracing(
|
||||||
|
CefString(categories),
|
||||||
|
CefCompletionCallbackCToCpp::Wrap(callback));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int cef_end_tracing(const cef_string_t* tracing_file,
|
||||||
|
struct _cef_end_tracing_callback_t* callback) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Unverified params: tracing_file, callback
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
bool _retval = CefEndTracing(
|
||||||
|
CefString(tracing_file),
|
||||||
|
CefEndTracingCallbackCToCpp::Wrap(callback));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_EXPORT int64 cef_now_from_system_trace_time() {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int64 _retval = CefNowFromSystemTraceTime();
|
||||||
|
|
||||||
|
// Return type: simple
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
CEF_EXPORT int cef_register_extension(const cef_string_t* extension_name,
|
CEF_EXPORT int cef_register_extension(const cef_string_t* extension_name,
|
||||||
const cef_string_t* javascript_code, struct _cef_v8handler_t* handler) {
|
const cef_string_t* javascript_code, struct _cef_v8handler_t* handler) {
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
#include "include/capi/cef_geolocation_capi.h"
|
#include "include/capi/cef_geolocation_capi.h"
|
||||||
#include "include/cef_origin_whitelist.h"
|
#include "include/cef_origin_whitelist.h"
|
||||||
#include "include/capi/cef_origin_whitelist_capi.h"
|
#include "include/capi/cef_origin_whitelist_capi.h"
|
||||||
|
#include "include/cef_parser.h"
|
||||||
|
#include "include/capi/cef_parser_capi.h"
|
||||||
#include "include/cef_path_util.h"
|
#include "include/cef_path_util.h"
|
||||||
#include "include/capi/cef_path_util_capi.h"
|
#include "include/capi/cef_path_util_capi.h"
|
||||||
#include "include/cef_process_util.h"
|
#include "include/cef_process_util.h"
|
||||||
@ -26,8 +28,6 @@
|
|||||||
#include "include/capi/cef_task_capi.h"
|
#include "include/capi/cef_task_capi.h"
|
||||||
#include "include/cef_trace.h"
|
#include "include/cef_trace.h"
|
||||||
#include "include/capi/cef_trace_capi.h"
|
#include "include/capi/cef_trace_capi.h"
|
||||||
#include "include/cef_url.h"
|
|
||||||
#include "include/capi/cef_url_capi.h"
|
|
||||||
#include "include/cef_v8.h"
|
#include "include/cef_v8.h"
|
||||||
#include "include/capi/cef_v8_capi.h"
|
#include "include/capi/cef_v8_capi.h"
|
||||||
#include "include/cef_web_plugin.h"
|
#include "include/cef_web_plugin.h"
|
||||||
@ -378,152 +378,6 @@ CEF_GLOBAL bool CefClearCrossOriginWhitelist() {
|
|||||||
return _retval?true:false;
|
return _retval?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CEF_GLOBAL bool CefGetPath(PathKey key, CefString& path) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int _retval = cef_get_path(
|
|
||||||
key,
|
|
||||||
path.GetWritableStruct());
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_GLOBAL bool CefLaunchProcess(CefRefPtr<CefCommandLine> command_line) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Verify param: command_line; type: refptr_same
|
|
||||||
DCHECK(command_line.get());
|
|
||||||
if (!command_line.get())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int _retval = cef_launch_process(
|
|
||||||
CefCommandLineCToCpp::Unwrap(command_line));
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_GLOBAL bool CefRegisterSchemeHandlerFactory(const CefString& scheme_name,
|
|
||||||
const CefString& domain_name,
|
|
||||||
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
|
||||||
// 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;
|
|
||||||
// Unverified params: domain_name, factory
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int _retval = cef_register_scheme_handler_factory(
|
|
||||||
scheme_name.GetStruct(),
|
|
||||||
domain_name.GetStruct(),
|
|
||||||
CefSchemeHandlerFactoryCppToC::Wrap(factory));
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_GLOBAL bool CefClearSchemeHandlerFactories() {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int _retval = cef_clear_scheme_handler_factories();
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_GLOBAL bool CefCurrentlyOn(CefThreadId threadId) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int _retval = cef_currently_on(
|
|
||||||
threadId);
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_GLOBAL bool CefPostTask(CefThreadId threadId, CefRefPtr<CefTask> task) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Verify param: task; type: refptr_diff
|
|
||||||
DCHECK(task.get());
|
|
||||||
if (!task.get())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int _retval = cef_post_task(
|
|
||||||
threadId,
|
|
||||||
CefTaskCppToC::Wrap(task));
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_GLOBAL bool CefPostDelayedTask(CefThreadId threadId,
|
|
||||||
CefRefPtr<CefTask> task, int64 delay_ms) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Verify param: task; type: refptr_diff
|
|
||||||
DCHECK(task.get());
|
|
||||||
if (!task.get())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int _retval = cef_post_delayed_task(
|
|
||||||
threadId,
|
|
||||||
CefTaskCppToC::Wrap(task),
|
|
||||||
delay_ms);
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_GLOBAL bool CefBeginTracing(const CefString& categories,
|
|
||||||
CefRefPtr<CefCompletionCallback> callback) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Unverified params: categories, callback
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int _retval = cef_begin_tracing(
|
|
||||||
categories.GetStruct(),
|
|
||||||
CefCompletionCallbackCppToC::Wrap(callback));
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_GLOBAL bool CefEndTracing(const CefString& tracing_file,
|
|
||||||
CefRefPtr<CefEndTracingCallback> callback) {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Unverified params: tracing_file, callback
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int _retval = cef_end_tracing(
|
|
||||||
tracing_file.GetStruct(),
|
|
||||||
CefEndTracingCallbackCppToC::Wrap(callback));
|
|
||||||
|
|
||||||
// Return type: bool
|
|
||||||
return _retval?true:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_GLOBAL int64 CefNowFromSystemTraceTime() {
|
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
||||||
|
|
||||||
// Execute
|
|
||||||
int64 _retval = cef_now_from_system_trace_time();
|
|
||||||
|
|
||||||
// Return type: simple
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEF_GLOBAL bool CefParseURL(const CefString& url, CefURLParts& parts) {
|
CEF_GLOBAL bool CefParseURL(const CefString& url, CefURLParts& parts) {
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
@ -674,6 +528,171 @@ CEF_GLOBAL CefString CefURIDecode(const CefString& text, bool convert_to_utf8,
|
|||||||
return _retvalStr;
|
return _retvalStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL bool CefParseCSSColor(const CefString& string, bool strict,
|
||||||
|
cef_color_t& color) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: string; type: string_byref_const
|
||||||
|
DCHECK(!string.empty());
|
||||||
|
if (string.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = cef_parse_csscolor(
|
||||||
|
string.GetStruct(),
|
||||||
|
strict,
|
||||||
|
&color);
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL bool CefGetPath(PathKey key, CefString& path) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = cef_get_path(
|
||||||
|
key,
|
||||||
|
path.GetWritableStruct());
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL bool CefLaunchProcess(CefRefPtr<CefCommandLine> command_line) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: command_line; type: refptr_same
|
||||||
|
DCHECK(command_line.get());
|
||||||
|
if (!command_line.get())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = cef_launch_process(
|
||||||
|
CefCommandLineCToCpp::Unwrap(command_line));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL bool CefRegisterSchemeHandlerFactory(const CefString& scheme_name,
|
||||||
|
const CefString& domain_name,
|
||||||
|
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
||||||
|
// 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;
|
||||||
|
// Unverified params: domain_name, factory
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = cef_register_scheme_handler_factory(
|
||||||
|
scheme_name.GetStruct(),
|
||||||
|
domain_name.GetStruct(),
|
||||||
|
CefSchemeHandlerFactoryCppToC::Wrap(factory));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL bool CefClearSchemeHandlerFactories() {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = cef_clear_scheme_handler_factories();
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL bool CefCurrentlyOn(CefThreadId threadId) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = cef_currently_on(
|
||||||
|
threadId);
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL bool CefPostTask(CefThreadId threadId, CefRefPtr<CefTask> task) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: task; type: refptr_diff
|
||||||
|
DCHECK(task.get());
|
||||||
|
if (!task.get())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = cef_post_task(
|
||||||
|
threadId,
|
||||||
|
CefTaskCppToC::Wrap(task));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL bool CefPostDelayedTask(CefThreadId threadId,
|
||||||
|
CefRefPtr<CefTask> task, int64 delay_ms) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: task; type: refptr_diff
|
||||||
|
DCHECK(task.get());
|
||||||
|
if (!task.get())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = cef_post_delayed_task(
|
||||||
|
threadId,
|
||||||
|
CefTaskCppToC::Wrap(task),
|
||||||
|
delay_ms);
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL bool CefBeginTracing(const CefString& categories,
|
||||||
|
CefRefPtr<CefCompletionCallback> callback) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Unverified params: categories, callback
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = cef_begin_tracing(
|
||||||
|
categories.GetStruct(),
|
||||||
|
CefCompletionCallbackCppToC::Wrap(callback));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL bool CefEndTracing(const CefString& tracing_file,
|
||||||
|
CefRefPtr<CefEndTracingCallback> callback) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Unverified params: tracing_file, callback
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int _retval = cef_end_tracing(
|
||||||
|
tracing_file.GetStruct(),
|
||||||
|
CefEndTracingCallbackCppToC::Wrap(callback));
|
||||||
|
|
||||||
|
// Return type: bool
|
||||||
|
return _retval?true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEF_GLOBAL int64 CefNowFromSystemTraceTime() {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
int64 _retval = cef_now_from_system_trace_time();
|
||||||
|
|
||||||
|
// Return type: simple
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
|
||||||
CEF_GLOBAL bool CefRegisterExtension(const CefString& extension_name,
|
CEF_GLOBAL bool CefRegisterExtension(const CefString& extension_name,
|
||||||
const CefString& javascript_code, CefRefPtr<CefV8Handler> handler) {
|
const CefString& javascript_code, CefRefPtr<CefV8Handler> handler) {
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
@ -913,10 +913,9 @@ class ScopedGLContext {
|
|||||||
|
|
||||||
BrowserWindowOsrGtk::BrowserWindowOsrGtk(BrowserWindow::Delegate* delegate,
|
BrowserWindowOsrGtk::BrowserWindowOsrGtk(BrowserWindow::Delegate* delegate,
|
||||||
const std::string& startup_url,
|
const std::string& startup_url,
|
||||||
bool transparent,
|
const OsrRenderer::Settings& settings)
|
||||||
bool show_update_rect)
|
|
||||||
: BrowserWindow(delegate),
|
: BrowserWindow(delegate),
|
||||||
renderer_(transparent, show_update_rect),
|
renderer_(settings),
|
||||||
glarea_(NULL),
|
glarea_(NULL),
|
||||||
hidden_(false),
|
hidden_(false),
|
||||||
gl_enabled_(false),
|
gl_enabled_(false),
|
||||||
|
@ -22,8 +22,7 @@ class BrowserWindowOsrGtk : public BrowserWindow,
|
|||||||
// |delegate| must outlive this object.
|
// |delegate| must outlive this object.
|
||||||
BrowserWindowOsrGtk(BrowserWindow::Delegate* delegate,
|
BrowserWindowOsrGtk(BrowserWindow::Delegate* delegate,
|
||||||
const std::string& startup_url,
|
const std::string& startup_url,
|
||||||
bool transparent,
|
const OsrRenderer::Settings& settings);
|
||||||
bool show_update_rect);
|
|
||||||
|
|
||||||
// BrowserWindow methods.
|
// BrowserWindow methods.
|
||||||
void CreateBrowser(ClientWindowHandle parent_handle,
|
void CreateBrowser(ClientWindowHandle parent_handle,
|
||||||
|
@ -22,8 +22,7 @@ class BrowserWindowOsrMac : public BrowserWindow,
|
|||||||
// |delegate| must outlive this object.
|
// |delegate| must outlive this object.
|
||||||
BrowserWindowOsrMac(BrowserWindow::Delegate* delegate,
|
BrowserWindowOsrMac(BrowserWindow::Delegate* delegate,
|
||||||
const std::string& startup_url,
|
const std::string& startup_url,
|
||||||
bool transparent,
|
const OsrRenderer::Settings& settings);
|
||||||
bool show_update_rect);
|
|
||||||
~BrowserWindowOsrMac();
|
~BrowserWindowOsrMac();
|
||||||
|
|
||||||
// BrowserWindow methods.
|
// BrowserWindow methods.
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <OpenGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
|
|
||||||
#include "include/base/cef_logging.h"
|
#include "include/base/cef_logging.h"
|
||||||
#include "include/cef_url.h"
|
#include "include/cef_parser.h"
|
||||||
#include "include/wrapper/cef_closure_task.h"
|
#include "include/wrapper/cef_closure_task.h"
|
||||||
#include "cefclient/browser/bytes_write_handler.h"
|
#include "cefclient/browser/bytes_write_handler.h"
|
||||||
#include "cefclient/browser/main_message_loop.h"
|
#include "cefclient/browser/main_message_loop.h"
|
||||||
@ -662,12 +662,22 @@ BrowserOpenGLView* GLView(NSView* view) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawRect: (NSRect) dirtyRect {
|
- (void)drawRect: (NSRect) dirtyRect {
|
||||||
// The Invalidate below fixes flicker when resizing
|
|
||||||
if ([self inLiveResize]) {
|
|
||||||
CefRefPtr<CefBrowser> browser = [self getBrowser];
|
CefRefPtr<CefBrowser> browser = [self getBrowser];
|
||||||
if (browser.get())
|
if ([self inLiveResize] || !browser.get()) {
|
||||||
browser->GetHost()->Invalidate(PET_VIEW);
|
// Fill with the background color.
|
||||||
|
const cef_color_t background_color = renderer_->GetBackgroundColor();
|
||||||
|
NSColor* color =
|
||||||
|
[NSColor colorWithRed:float(CefColorGetR(background_color)) / 255.0f
|
||||||
|
green:float(CefColorGetG(background_color)) / 255.0f
|
||||||
|
blue:float(CefColorGetB(background_color)) / 255.0f
|
||||||
|
alpha:1.f];
|
||||||
|
[color setFill];
|
||||||
|
NSRectFill(dirtyRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The Invalidate below fixes flicker when resizing.
|
||||||
|
if ([self inLiveResize] && browser.get())
|
||||||
|
browser->GetHost()->Invalidate(PET_VIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drag and drop
|
// Drag and drop
|
||||||
@ -1083,10 +1093,9 @@ namespace client {
|
|||||||
|
|
||||||
BrowserWindowOsrMac::BrowserWindowOsrMac(BrowserWindow::Delegate* delegate,
|
BrowserWindowOsrMac::BrowserWindowOsrMac(BrowserWindow::Delegate* delegate,
|
||||||
const std::string& startup_url,
|
const std::string& startup_url,
|
||||||
bool transparent,
|
const OsrRenderer::Settings& settings)
|
||||||
bool show_update_rect)
|
|
||||||
: BrowserWindow(delegate),
|
: BrowserWindow(delegate),
|
||||||
renderer_(transparent, show_update_rect),
|
renderer_(settings),
|
||||||
nsview_(NULL),
|
nsview_(NULL),
|
||||||
hidden_(false),
|
hidden_(false),
|
||||||
painting_popup_(false) {
|
painting_popup_(false) {
|
||||||
|
@ -10,12 +10,11 @@ namespace client {
|
|||||||
|
|
||||||
BrowserWindowOsrWin::BrowserWindowOsrWin(BrowserWindow::Delegate* delegate,
|
BrowserWindowOsrWin::BrowserWindowOsrWin(BrowserWindow::Delegate* delegate,
|
||||||
const std::string& startup_url,
|
const std::string& startup_url,
|
||||||
bool transparent,
|
const OsrRenderer::Settings& settings)
|
||||||
bool show_update_rect)
|
|
||||||
: BrowserWindow(delegate),
|
: BrowserWindow(delegate),
|
||||||
transparent_(transparent),
|
transparent_(settings.transparent),
|
||||||
osr_hwnd_(NULL) {
|
osr_hwnd_(NULL) {
|
||||||
osr_window_ = new OsrWindowWin(this, transparent, show_update_rect);
|
osr_window_ = new OsrWindowWin(this, settings);
|
||||||
client_handler_ = new ClientHandlerOsr(this, osr_window_.get(), startup_url);
|
client_handler_ = new ClientHandlerOsr(this, osr_window_.get(), startup_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,7 @@ class BrowserWindowOsrWin : public BrowserWindow,
|
|||||||
// |delegate| must outlive this object.
|
// |delegate| must outlive this object.
|
||||||
BrowserWindowOsrWin(BrowserWindow::Delegate* delegate,
|
BrowserWindowOsrWin(BrowserWindow::Delegate* delegate,
|
||||||
const std::string& startup_url,
|
const std::string& startup_url,
|
||||||
bool transparent,
|
const OsrRenderer::Settings& settings);
|
||||||
bool show_update_rect);
|
|
||||||
|
|
||||||
// BrowserWindow methods.
|
// BrowserWindow methods.
|
||||||
void CreateBrowser(ClientWindowHandle parent_handle,
|
void CreateBrowser(ClientWindowHandle parent_handle,
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "include/base/cef_bind.h"
|
#include "include/base/cef_bind.h"
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
#include "include/cef_url.h"
|
#include "include/cef_parser.h"
|
||||||
#include "include/wrapper/cef_closure_task.h"
|
#include "include/wrapper/cef_closure_task.h"
|
||||||
#include "cefclient/browser/main_context.h"
|
#include "cefclient/browser/main_context.h"
|
||||||
#include "cefclient/browser/resource_util.h"
|
#include "cefclient/browser/resource_util.h"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_url.h"
|
#include "include/cef_parser.h"
|
||||||
#include "include/wrapper/cef_helpers.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "cefclient/browser/root_window.h"
|
#include "cefclient/browser/root_window.h"
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "include/base/cef_ref_counted.h"
|
#include "include/base/cef_ref_counted.h"
|
||||||
#include "include/internal/cef_types_wrappers.h"
|
#include "include/internal/cef_types_wrappers.h"
|
||||||
|
#include "cefclient/browser/osr_renderer.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client {
|
||||||
|
|
||||||
@ -34,9 +35,13 @@ class MainContext {
|
|||||||
// Returns the main application URL.
|
// Returns the main application URL.
|
||||||
virtual std::string GetMainURL() = 0;
|
virtual std::string GetMainURL() = 0;
|
||||||
|
|
||||||
|
// Returns the background color.
|
||||||
|
virtual cef_color_t GetBackgroundColor() = 0;
|
||||||
|
|
||||||
// Populate |settings| based on command-line arguments.
|
// Populate |settings| based on command-line arguments.
|
||||||
virtual void PopulateSettings(CefSettings* settings) = 0;
|
virtual void PopulateSettings(CefSettings* settings) = 0;
|
||||||
virtual void PopulateBrowserSettings(CefBrowserSettings* settings) = 0;
|
virtual void PopulateBrowserSettings(CefBrowserSettings* settings) = 0;
|
||||||
|
virtual void PopulateOsrSettings(OsrRenderer::Settings* settings) = 0;
|
||||||
|
|
||||||
// Returns the object used to create/manage RootWindow instances.
|
// Returns the object used to create/manage RootWindow instances.
|
||||||
virtual RootWindowManager* GetRootWindowManager() = 0;
|
virtual RootWindowManager* GetRootWindowManager() = 0;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "cefclient/browser/main_context_impl.h"
|
#include "cefclient/browser/main_context_impl.h"
|
||||||
|
|
||||||
|
#include "include/cef_parser.h"
|
||||||
#include "cefclient/common/client_switches.h"
|
#include "cefclient/common/client_switches.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client {
|
||||||
@ -20,7 +21,8 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line,
|
|||||||
: command_line_(command_line),
|
: command_line_(command_line),
|
||||||
terminate_when_all_windows_closed_(terminate_when_all_windows_closed),
|
terminate_when_all_windows_closed_(terminate_when_all_windows_closed),
|
||||||
initialized_(false),
|
initialized_(false),
|
||||||
shutdown_(false) {
|
shutdown_(false),
|
||||||
|
background_color_(CefColorSetARGB(255, 255, 255, 255)) {
|
||||||
DCHECK(command_line_.get());
|
DCHECK(command_line_.get());
|
||||||
|
|
||||||
// Set the main URL.
|
// Set the main URL.
|
||||||
@ -28,6 +30,12 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line,
|
|||||||
main_url_ = command_line_->GetSwitchValue(switches::kUrl);
|
main_url_ = command_line_->GetSwitchValue(switches::kUrl);
|
||||||
if (main_url_.empty())
|
if (main_url_.empty())
|
||||||
main_url_ = kDefaultUrl;
|
main_url_ = kDefaultUrl;
|
||||||
|
|
||||||
|
if (command_line_->HasSwitch(switches::kBackgroundColor)) {
|
||||||
|
// Parse the background color value.
|
||||||
|
CefParseCSSColor(command_line_->GetSwitchValue(switches::kBackgroundColor),
|
||||||
|
false, background_color_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainContextImpl::~MainContextImpl() {
|
MainContextImpl::~MainContextImpl() {
|
||||||
@ -44,6 +52,10 @@ std::string MainContextImpl::GetMainURL() {
|
|||||||
return main_url_;
|
return main_url_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cef_color_t MainContextImpl::GetBackgroundColor() {
|
||||||
|
return background_color_;
|
||||||
|
}
|
||||||
|
|
||||||
void MainContextImpl::PopulateSettings(CefSettings* settings) {
|
void MainContextImpl::PopulateSettings(CefSettings* settings) {
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
settings->multi_threaded_message_loop =
|
settings->multi_threaded_message_loop =
|
||||||
@ -55,6 +67,8 @@ void MainContextImpl::PopulateSettings(CefSettings* settings) {
|
|||||||
|
|
||||||
if (command_line_->HasSwitch(switches::kOffScreenRenderingEnabled))
|
if (command_line_->HasSwitch(switches::kOffScreenRenderingEnabled))
|
||||||
settings->windowless_rendering_enabled = true;
|
settings->windowless_rendering_enabled = true;
|
||||||
|
|
||||||
|
settings->background_color = background_color_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainContextImpl::PopulateBrowserSettings(CefBrowserSettings* settings) {
|
void MainContextImpl::PopulateBrowserSettings(CefBrowserSettings* settings) {
|
||||||
@ -64,6 +78,14 @@ void MainContextImpl::PopulateBrowserSettings(CefBrowserSettings* settings) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainContextImpl::PopulateOsrSettings(OsrRenderer::Settings* settings) {
|
||||||
|
settings->transparent =
|
||||||
|
command_line_->HasSwitch(switches::kTransparentPaintingEnabled);
|
||||||
|
settings->show_update_rect =
|
||||||
|
command_line_->HasSwitch(switches::kShowUpdateRect);
|
||||||
|
settings->background_color = background_color_;
|
||||||
|
}
|
||||||
|
|
||||||
RootWindowManager* MainContextImpl::GetRootWindowManager() {
|
RootWindowManager* MainContextImpl::GetRootWindowManager() {
|
||||||
DCHECK(InValidState());
|
DCHECK(InValidState());
|
||||||
return root_window_manager_.get();
|
return root_window_manager_.get();
|
||||||
|
@ -26,8 +26,10 @@ class MainContextImpl : public MainContext {
|
|||||||
std::string GetDownloadPath(const std::string& file_name) OVERRIDE;
|
std::string GetDownloadPath(const std::string& file_name) OVERRIDE;
|
||||||
std::string GetAppWorkingDirectory() OVERRIDE;
|
std::string GetAppWorkingDirectory() OVERRIDE;
|
||||||
std::string GetMainURL() OVERRIDE;
|
std::string GetMainURL() OVERRIDE;
|
||||||
|
cef_color_t GetBackgroundColor() OVERRIDE;
|
||||||
void PopulateSettings(CefSettings* settings) OVERRIDE;
|
void PopulateSettings(CefSettings* settings) OVERRIDE;
|
||||||
void PopulateBrowserSettings(CefBrowserSettings* settings) OVERRIDE;
|
void PopulateBrowserSettings(CefBrowserSettings* settings) OVERRIDE;
|
||||||
|
void PopulateOsrSettings(OsrRenderer::Settings* settings) OVERRIDE;
|
||||||
RootWindowManager* GetRootWindowManager() OVERRIDE;
|
RootWindowManager* GetRootWindowManager() OVERRIDE;
|
||||||
|
|
||||||
// Initialize CEF and associated main context state. This method must be
|
// Initialize CEF and associated main context state. This method must be
|
||||||
@ -63,6 +65,7 @@ class MainContextImpl : public MainContext {
|
|||||||
bool shutdown_;
|
bool shutdown_;
|
||||||
|
|
||||||
std::string main_url_;
|
std::string main_url_;
|
||||||
|
cef_color_t background_color_;
|
||||||
|
|
||||||
scoped_ptr<RootWindowManager> root_window_manager_;
|
scoped_ptr<RootWindowManager> root_window_manager_;
|
||||||
|
|
||||||
|
@ -41,10 +41,14 @@
|
|||||||
|
|
||||||
namespace client {
|
namespace client {
|
||||||
|
|
||||||
OsrRenderer::OsrRenderer(bool transparent,
|
OsrRenderer::Settings::Settings()
|
||||||
bool show_update_rect)
|
: transparent(false),
|
||||||
: transparent_(transparent),
|
show_update_rect(false),
|
||||||
show_update_rect_(show_update_rect),
|
background_color(CefColorSetARGB(255, 255, 255, 255)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
OsrRenderer::OsrRenderer(const Settings& settings)
|
||||||
|
: settings_(settings),
|
||||||
initialized_(false),
|
initialized_(false),
|
||||||
texture_id_(0),
|
texture_id_(0),
|
||||||
view_width_(0),
|
view_width_(0),
|
||||||
@ -63,7 +67,10 @@ void OsrRenderer::Initialize() {
|
|||||||
|
|
||||||
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); VERIFY_NO_ERROR;
|
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); VERIFY_NO_ERROR;
|
||||||
|
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); VERIFY_NO_ERROR;
|
glClearColor(float(CefColorGetR(settings_.background_color)) / 255.0f,
|
||||||
|
float(CefColorGetG(settings_.background_color)) / 255.0f,
|
||||||
|
float(CefColorGetB(settings_.background_color)) / 255.0f,
|
||||||
|
1.0f); VERIFY_NO_ERROR;
|
||||||
|
|
||||||
// Necessary for non-power-of-2 textures to render correctly.
|
// Necessary for non-power-of-2 textures to render correctly.
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); VERIFY_NO_ERROR;
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); VERIFY_NO_ERROR;
|
||||||
@ -134,7 +141,7 @@ void OsrRenderer::Render() {
|
|||||||
glRotatef(-spin_y_, 0.0f, 1.0f, 0.0f); VERIFY_NO_ERROR;
|
glRotatef(-spin_y_, 0.0f, 1.0f, 0.0f); VERIFY_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transparent_) {
|
if (settings_.transparent) {
|
||||||
// Alpha blending style. Texture values have premultiplied alpha.
|
// Alpha blending style. Texture values have premultiplied alpha.
|
||||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); VERIFY_NO_ERROR;
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); VERIFY_NO_ERROR;
|
||||||
|
|
||||||
@ -154,13 +161,13 @@ void OsrRenderer::Render() {
|
|||||||
// Disable 2D textures.
|
// Disable 2D textures.
|
||||||
glDisable(GL_TEXTURE_2D); VERIFY_NO_ERROR;
|
glDisable(GL_TEXTURE_2D); VERIFY_NO_ERROR;
|
||||||
|
|
||||||
if (transparent_) {
|
if (settings_.transparent) {
|
||||||
// Disable alpha blending.
|
// Disable alpha blending.
|
||||||
glDisable(GL_BLEND); VERIFY_NO_ERROR;
|
glDisable(GL_BLEND); VERIFY_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a rectangle around the update region.
|
// Draw a rectangle around the update region.
|
||||||
if (show_update_rect_ && !update_rect_.IsEmpty()) {
|
if (settings_.show_update_rect && !update_rect_.IsEmpty()) {
|
||||||
int left = update_rect_.x;
|
int left = update_rect_.x;
|
||||||
int right = update_rect_.x + update_rect_.width;
|
int right = update_rect_.x + update_rect_.width;
|
||||||
int top = update_rect_.y;
|
int top = update_rect_.y;
|
||||||
@ -246,7 +253,7 @@ void OsrRenderer::OnPaint(CefRefPtr<CefBrowser> browser,
|
|||||||
if (!initialized_)
|
if (!initialized_)
|
||||||
Initialize();
|
Initialize();
|
||||||
|
|
||||||
if (transparent_) {
|
if (settings_.transparent) {
|
||||||
// Enable alpha blending.
|
// Enable alpha blending.
|
||||||
glEnable(GL_BLEND); VERIFY_NO_ERROR;
|
glEnable(GL_BLEND); VERIFY_NO_ERROR;
|
||||||
}
|
}
|
||||||
@ -264,7 +271,7 @@ void OsrRenderer::OnPaint(CefRefPtr<CefBrowser> browser,
|
|||||||
view_width_ = width;
|
view_width_ = width;
|
||||||
view_height_ = height;
|
view_height_ = height;
|
||||||
|
|
||||||
if (show_update_rect_)
|
if (settings_.show_update_rect)
|
||||||
update_rect_ = dirtyRects[0];
|
update_rect_ = dirtyRects[0];
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, view_width_); VERIFY_NO_ERROR;
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, view_width_); VERIFY_NO_ERROR;
|
||||||
@ -324,7 +331,7 @@ void OsrRenderer::OnPaint(CefRefPtr<CefBrowser> browser,
|
|||||||
// Disable 2D textures.
|
// Disable 2D textures.
|
||||||
glDisable(GL_TEXTURE_2D); VERIFY_NO_ERROR;
|
glDisable(GL_TEXTURE_2D); VERIFY_NO_ERROR;
|
||||||
|
|
||||||
if (transparent_) {
|
if (settings_.transparent) {
|
||||||
// Disable alpha blending.
|
// Disable alpha blending.
|
||||||
glDisable(GL_BLEND); VERIFY_NO_ERROR;
|
glDisable(GL_BLEND); VERIFY_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,20 @@ namespace client {
|
|||||||
|
|
||||||
class OsrRenderer {
|
class OsrRenderer {
|
||||||
public:
|
public:
|
||||||
OsrRenderer(bool transparent,
|
struct Settings {
|
||||||
bool show_update_rect);
|
Settings();
|
||||||
|
|
||||||
|
// If true use transparent rendering.
|
||||||
|
bool transparent;
|
||||||
|
|
||||||
|
// If true draw a border around update rectangles.
|
||||||
|
bool show_update_rect;
|
||||||
|
|
||||||
|
// Background color.
|
||||||
|
cef_color_t background_color;
|
||||||
|
};
|
||||||
|
|
||||||
|
explicit OsrRenderer(const Settings& settings);
|
||||||
~OsrRenderer();
|
~OsrRenderer();
|
||||||
|
|
||||||
// Initialize the OpenGL environment.
|
// Initialize the OpenGL environment.
|
||||||
@ -41,10 +53,11 @@ class OsrRenderer {
|
|||||||
void SetSpin(float spinX, float spinY);
|
void SetSpin(float spinX, float spinY);
|
||||||
void IncrementSpin(float spinDX, float spinDY);
|
void IncrementSpin(float spinDX, float spinDY);
|
||||||
|
|
||||||
bool IsTransparent() { return transparent_; }
|
bool IsTransparent() const { return settings_.transparent; }
|
||||||
|
cef_color_t GetBackgroundColor() const { return settings_.background_color; }
|
||||||
|
|
||||||
int GetViewWidth() { return view_width_; }
|
int GetViewWidth() const { return view_width_; }
|
||||||
int GetViewHeight() { return view_height_; }
|
int GetViewHeight() const { return view_height_; }
|
||||||
|
|
||||||
const CefRect& popup_rect() const { return popup_rect_; }
|
const CefRect& popup_rect() const { return popup_rect_; }
|
||||||
const CefRect& original_popup_rect() const { return original_popup_rect_; }
|
const CefRect& original_popup_rect() const { return original_popup_rect_; }
|
||||||
@ -53,8 +66,7 @@ class OsrRenderer {
|
|||||||
void ClearPopupRects();
|
void ClearPopupRects();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const bool transparent_;
|
const Settings settings_;
|
||||||
const bool show_update_rect_;
|
|
||||||
bool initialized_;
|
bool initialized_;
|
||||||
unsigned int texture_id_;
|
unsigned int texture_id_;
|
||||||
int view_width_;
|
int view_width_;
|
||||||
|
@ -48,10 +48,9 @@ class ScopedGLContext {
|
|||||||
|
|
||||||
|
|
||||||
OsrWindowWin::OsrWindowWin(Delegate* delegate,
|
OsrWindowWin::OsrWindowWin(Delegate* delegate,
|
||||||
bool transparent,
|
const OsrRenderer::Settings& settings)
|
||||||
bool show_update_rect)
|
|
||||||
: delegate_(delegate),
|
: delegate_(delegate),
|
||||||
renderer_(transparent, show_update_rect),
|
renderer_(settings),
|
||||||
hwnd_(NULL),
|
hwnd_(NULL),
|
||||||
hdc_(NULL),
|
hdc_(NULL),
|
||||||
hrc_(NULL),
|
hrc_(NULL),
|
||||||
@ -208,7 +207,13 @@ void OsrWindowWin::Create(HWND parent_hwnd, const RECT& rect) {
|
|||||||
|
|
||||||
HINSTANCE hInst = ::GetModuleHandle(NULL);
|
HINSTANCE hInst = ::GetModuleHandle(NULL);
|
||||||
|
|
||||||
RegisterOsrClass(hInst);
|
const cef_color_t background_color = renderer_.GetBackgroundColor();
|
||||||
|
const HBRUSH background_brush = CreateSolidBrush(
|
||||||
|
RGB(CefColorGetR(background_color),
|
||||||
|
CefColorGetG(background_color),
|
||||||
|
CefColorGetB(background_color)));
|
||||||
|
|
||||||
|
RegisterOsrClass(hInst, background_brush);
|
||||||
|
|
||||||
// Create the native window with a border so it's easier to visually identify
|
// Create the native window with a border so it's easier to visually identify
|
||||||
// OSR windows.
|
// OSR windows.
|
||||||
@ -339,7 +344,8 @@ void OsrWindowWin::NotifyNativeWindowCreated(HWND hwnd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void OsrWindowWin::RegisterOsrClass(HINSTANCE hInstance) {
|
void OsrWindowWin::RegisterOsrClass(HINSTANCE hInstance,
|
||||||
|
HBRUSH background_brush) {
|
||||||
// Only register the class one time.
|
// Only register the class one time.
|
||||||
static bool class_registered = false;
|
static bool class_registered = false;
|
||||||
if (class_registered)
|
if (class_registered)
|
||||||
@ -356,7 +362,7 @@ void OsrWindowWin::RegisterOsrClass(HINSTANCE hInstance) {
|
|||||||
wcex.hInstance = hInstance;
|
wcex.hInstance = hInstance;
|
||||||
wcex.hIcon = NULL;
|
wcex.hIcon = NULL;
|
||||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
wcex.hbrBackground = background_brush;
|
||||||
wcex.lpszMenuName = NULL;
|
wcex.lpszMenuName = NULL;
|
||||||
wcex.lpszClassName = kWndClass;
|
wcex.lpszClassName = kWndClass;
|
||||||
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
|
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
|
||||||
@ -383,24 +389,20 @@ LRESULT CALLBACK OsrWindowWin::OsrWndProc(HWND hWnd, UINT message,
|
|||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
case WM_MOUSELEAVE:
|
case WM_MOUSELEAVE:
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
if (self)
|
|
||||||
self->OnMouseEvent(message, wParam, lParam);
|
self->OnMouseEvent(message, wParam, lParam);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
if (self)
|
|
||||||
self->OnSize();
|
self->OnSize();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SETFOCUS:
|
case WM_SETFOCUS:
|
||||||
case WM_KILLFOCUS:
|
case WM_KILLFOCUS:
|
||||||
if (self)
|
|
||||||
self->OnFocus(message == WM_SETFOCUS);
|
self->OnFocus(message == WM_SETFOCUS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_CAPTURECHANGED:
|
case WM_CAPTURECHANGED:
|
||||||
case WM_CANCELMODE:
|
case WM_CANCELMODE:
|
||||||
if (self)
|
|
||||||
self->OnCaptureLost();
|
self->OnCaptureLost();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -410,17 +412,17 @@ LRESULT CALLBACK OsrWindowWin::OsrWndProc(HWND hWnd, UINT message,
|
|||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
case WM_CHAR:
|
case WM_CHAR:
|
||||||
if (self)
|
|
||||||
self->OnKeyEvent(message, wParam, lParam);
|
self->OnKeyEvent(message, wParam, lParam);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
if (self)
|
|
||||||
self->OnPaint();
|
self->OnPaint();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
// Never erase the background.
|
if (self->OnEraseBkgnd())
|
||||||
|
break;
|
||||||
|
// Don't erase the background.
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_NCDESTROY:
|
case WM_NCDESTROY:
|
||||||
@ -674,6 +676,11 @@ void OsrWindowWin::OnPaint() {
|
|||||||
browser_->GetHost()->Invalidate(PET_VIEW);
|
browser_->GetHost()->Invalidate(PET_VIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OsrWindowWin::OnEraseBkgnd() {
|
||||||
|
// Erase the background when the browser does not exist.
|
||||||
|
return (browser_ == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
bool OsrWindowWin::IsOverPopupWidget(int x, int y) const {
|
bool OsrWindowWin::IsOverPopupWidget(int x, int y) const {
|
||||||
CEF_REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
const CefRect& rc = renderer_.popup_rect();
|
const CefRect& rc = renderer_.popup_rect();
|
||||||
|
@ -40,8 +40,7 @@ class OsrWindowWin :
|
|||||||
|
|
||||||
// |delegate| must outlive this object.
|
// |delegate| must outlive this object.
|
||||||
OsrWindowWin(Delegate* delegate,
|
OsrWindowWin(Delegate* delegate,
|
||||||
bool transparent,
|
const OsrRenderer::Settings& settings);
|
||||||
bool show_update_rect);
|
|
||||||
|
|
||||||
// Create a new browser and native window.
|
// Create a new browser and native window.
|
||||||
void CreateBrowser(HWND parent_hwnd,
|
void CreateBrowser(HWND parent_hwnd,
|
||||||
@ -80,7 +79,8 @@ class OsrWindowWin :
|
|||||||
|
|
||||||
void NotifyNativeWindowCreated(HWND hwnd);
|
void NotifyNativeWindowCreated(HWND hwnd);
|
||||||
|
|
||||||
static void RegisterOsrClass(HINSTANCE hInstance);
|
static void RegisterOsrClass(HINSTANCE hInstance,
|
||||||
|
HBRUSH background_brush);
|
||||||
static LRESULT CALLBACK OsrWndProc(HWND hWnd, UINT message, WPARAM wParam,
|
static LRESULT CALLBACK OsrWndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||||
LPARAM lParam);
|
LPARAM lParam);
|
||||||
|
|
||||||
@ -91,6 +91,7 @@ class OsrWindowWin :
|
|||||||
void OnCaptureLost();
|
void OnCaptureLost();
|
||||||
void OnKeyEvent(UINT message, WPARAM wParam, LPARAM lParam);
|
void OnKeyEvent(UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
void OnPaint();
|
void OnPaint();
|
||||||
|
bool OnEraseBkgnd();
|
||||||
|
|
||||||
// Manage popup bounds.
|
// Manage popup bounds.
|
||||||
bool IsOverPopupWidget(int x, int y) const;
|
bool IsOverPopupWidget(int x, int y) const;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "include/cef_app.h"
|
#include "include/cef_app.h"
|
||||||
#include "cefclient/browser/browser_window_osr_gtk.h"
|
#include "cefclient/browser/browser_window_osr_gtk.h"
|
||||||
#include "cefclient/browser/browser_window_std_gtk.h"
|
#include "cefclient/browser/browser_window_std_gtk.h"
|
||||||
|
#include "cefclient/browser/main_context.h"
|
||||||
#include "cefclient/browser/main_message_loop.h"
|
#include "cefclient/browser/main_message_loop.h"
|
||||||
#include "cefclient/browser/resource.h"
|
#include "cefclient/browser/resource.h"
|
||||||
#include "cefclient/browser/temp_window.h"
|
#include "cefclient/browser/temp_window.h"
|
||||||
@ -205,15 +206,9 @@ ClientWindowHandle RootWindowGtk::GetWindowHandle() const {
|
|||||||
|
|
||||||
void RootWindowGtk::CreateBrowserWindow(const std::string& startup_url) {
|
void RootWindowGtk::CreateBrowserWindow(const std::string& startup_url) {
|
||||||
if (with_osr_) {
|
if (with_osr_) {
|
||||||
CefRefPtr<CefCommandLine> command_line =
|
OsrRenderer::Settings settings;
|
||||||
CefCommandLine::GetGlobalCommandLine();
|
MainContext::Get()->PopulateOsrSettings(&settings);
|
||||||
const bool transparent =
|
browser_window_.reset(new BrowserWindowOsrGtk(this, startup_url, settings));
|
||||||
command_line->HasSwitch(switches::kTransparentPaintingEnabled);
|
|
||||||
const bool show_update_rect =
|
|
||||||
command_line->HasSwitch(switches::kShowUpdateRect);
|
|
||||||
browser_window_.reset(new BrowserWindowOsrGtk(this, startup_url,
|
|
||||||
transparent,
|
|
||||||
show_update_rect));
|
|
||||||
} else {
|
} else {
|
||||||
browser_window_.reset(new BrowserWindowStdGtk(this, startup_url));
|
browser_window_.reset(new BrowserWindowStdGtk(this, startup_url));
|
||||||
}
|
}
|
||||||
@ -250,6 +245,13 @@ void RootWindowGtk::CreateRootWindow(const CefBrowserSettings& settings) {
|
|||||||
g_signal_connect(G_OBJECT(window_), "delete_event",
|
g_signal_connect(G_OBJECT(window_), "delete_event",
|
||||||
G_CALLBACK(&RootWindowGtk::WindowDelete), this);
|
G_CALLBACK(&RootWindowGtk::WindowDelete), this);
|
||||||
|
|
||||||
|
const cef_color_t background_color = MainContext::Get()->GetBackgroundColor();
|
||||||
|
GdkColor color = {0};
|
||||||
|
color.red = CefColorGetR(background_color) * 65535 / 255;
|
||||||
|
color.green = CefColorGetG(background_color) * 65535 / 255;
|
||||||
|
color.blue = CefColorGetB(background_color) * 65535 / 255;
|
||||||
|
gtk_widget_modify_bg(window_, GTK_STATE_NORMAL, &color);
|
||||||
|
|
||||||
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
|
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
|
||||||
g_signal_connect(vbox, "size-allocate",
|
g_signal_connect(vbox, "size-allocate",
|
||||||
G_CALLBACK(&RootWindowGtk::VboxSizeAllocated), this);
|
G_CALLBACK(&RootWindowGtk::VboxSizeAllocated), this);
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "include/cef_application_mac.h"
|
#include "include/cef_application_mac.h"
|
||||||
#include "cefclient/browser/browser_window_osr_mac.h"
|
#include "cefclient/browser/browser_window_osr_mac.h"
|
||||||
#include "cefclient/browser/browser_window_std_mac.h"
|
#include "cefclient/browser/browser_window_std_mac.h"
|
||||||
|
#include "cefclient/browser/main_context.h"
|
||||||
#include "cefclient/browser/main_message_loop.h"
|
#include "cefclient/browser/main_message_loop.h"
|
||||||
#include "cefclient/browser/temp_window.h"
|
#include "cefclient/browser/temp_window.h"
|
||||||
#include "cefclient/common/client_switches.h"
|
#include "cefclient/common/client_switches.h"
|
||||||
@ -414,15 +415,9 @@ void RootWindowMac::WindowDestroyed() {
|
|||||||
|
|
||||||
void RootWindowMac::CreateBrowserWindow(const std::string& startup_url) {
|
void RootWindowMac::CreateBrowserWindow(const std::string& startup_url) {
|
||||||
if (with_osr_) {
|
if (with_osr_) {
|
||||||
CefRefPtr<CefCommandLine> command_line =
|
OsrRenderer::Settings settings;
|
||||||
CefCommandLine::GetGlobalCommandLine();
|
MainContext::Get()->PopulateOsrSettings(&settings);
|
||||||
const bool transparent =
|
browser_window_.reset(new BrowserWindowOsrMac(this, startup_url, settings));
|
||||||
command_line->HasSwitch(switches::kTransparentPaintingEnabled);
|
|
||||||
const bool show_update_rect =
|
|
||||||
command_line->HasSwitch(switches::kShowUpdateRect);
|
|
||||||
browser_window_.reset(new BrowserWindowOsrMac(this, startup_url,
|
|
||||||
transparent,
|
|
||||||
show_update_rect));
|
|
||||||
} else {
|
} else {
|
||||||
browser_window_.reset(new BrowserWindowStdMac(this, startup_url));
|
browser_window_.reset(new BrowserWindowStdMac(this, startup_url));
|
||||||
}
|
}
|
||||||
@ -470,6 +465,13 @@ void RootWindowMac::CreateRootWindow(const CefBrowserSettings& settings) {
|
|||||||
// during cleanup (ie, a window close from javascript).
|
// during cleanup (ie, a window close from javascript).
|
||||||
[window_ setReleasedWhenClosed:NO];
|
[window_ setReleasedWhenClosed:NO];
|
||||||
|
|
||||||
|
const cef_color_t background_color = MainContext::Get()->GetBackgroundColor();
|
||||||
|
[window_ setBackgroundColor:
|
||||||
|
[NSColor colorWithRed:float(CefColorGetR(background_color)) / 255.0f
|
||||||
|
green:float(CefColorGetG(background_color)) / 255.0f
|
||||||
|
blue:float(CefColorGetB(background_color)) / 255.0f
|
||||||
|
alpha:1.f]];
|
||||||
|
|
||||||
NSView* contentView = [window_ contentView];
|
NSView* contentView = [window_ contentView];
|
||||||
NSRect contentBounds = [contentView bounds];
|
NSRect contentBounds = [contentView bounds];
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "include/cef_app.h"
|
#include "include/cef_app.h"
|
||||||
#include "cefclient/browser/browser_window_osr_win.h"
|
#include "cefclient/browser/browser_window_osr_win.h"
|
||||||
#include "cefclient/browser/browser_window_std_win.h"
|
#include "cefclient/browser/browser_window_std_win.h"
|
||||||
|
#include "cefclient/browser/main_context.h"
|
||||||
#include "cefclient/browser/main_message_loop.h"
|
#include "cefclient/browser/main_message_loop.h"
|
||||||
#include "cefclient/browser/resource.h"
|
#include "cefclient/browser/resource.h"
|
||||||
#include "cefclient/browser/temp_window.h"
|
#include "cefclient/browser/temp_window.h"
|
||||||
@ -201,15 +202,9 @@ ClientWindowHandle RootWindowWin::GetWindowHandle() const {
|
|||||||
void RootWindowWin::CreateBrowserWindow(bool with_osr,
|
void RootWindowWin::CreateBrowserWindow(bool with_osr,
|
||||||
const std::string& startup_url) {
|
const std::string& startup_url) {
|
||||||
if (with_osr) {
|
if (with_osr) {
|
||||||
CefRefPtr<CefCommandLine> command_line =
|
OsrRenderer::Settings settings;
|
||||||
CefCommandLine::GetGlobalCommandLine();
|
MainContext::Get()->PopulateOsrSettings(&settings);
|
||||||
const bool transparent =
|
browser_window_.reset(new BrowserWindowOsrWin(this, startup_url, settings));
|
||||||
command_line->HasSwitch(switches::kTransparentPaintingEnabled);
|
|
||||||
const bool show_update_rect =
|
|
||||||
command_line->HasSwitch(switches::kShowUpdateRect);
|
|
||||||
browser_window_.reset(new BrowserWindowOsrWin(this, startup_url,
|
|
||||||
transparent,
|
|
||||||
show_update_rect));
|
|
||||||
} else {
|
} else {
|
||||||
browser_window_.reset(new BrowserWindowStdWin(this, startup_url));
|
browser_window_.reset(new BrowserWindowStdWin(this, startup_url));
|
||||||
}
|
}
|
||||||
@ -225,8 +220,14 @@ void RootWindowWin::CreateRootWindow(const CefBrowserSettings& settings) {
|
|||||||
const std::wstring& window_title = GetResourceString(IDS_APP_TITLE);
|
const std::wstring& window_title = GetResourceString(IDS_APP_TITLE);
|
||||||
const std::wstring& window_class = GetResourceString(IDC_CEFCLIENT);
|
const std::wstring& window_class = GetResourceString(IDC_CEFCLIENT);
|
||||||
|
|
||||||
|
const cef_color_t background_color = MainContext::Get()->GetBackgroundColor();
|
||||||
|
const HBRUSH background_brush = CreateSolidBrush(
|
||||||
|
RGB(CefColorGetR(background_color),
|
||||||
|
CefColorGetG(background_color),
|
||||||
|
CefColorGetB(background_color)));
|
||||||
|
|
||||||
// Register the window class.
|
// Register the window class.
|
||||||
RegisterRootClass(hInstance, window_class);
|
RegisterRootClass(hInstance, window_class, background_brush);
|
||||||
|
|
||||||
// Register the message used with the find dialog.
|
// Register the message used with the find dialog.
|
||||||
find_message_id_ = RegisterWindowMessage(FINDMSGSTRING);
|
find_message_id_ = RegisterWindowMessage(FINDMSGSTRING);
|
||||||
@ -342,7 +343,8 @@ void RootWindowWin::CreateRootWindow(const CefBrowserSettings& settings) {
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
void RootWindowWin::RegisterRootClass(HINSTANCE hInstance,
|
void RootWindowWin::RegisterRootClass(HINSTANCE hInstance,
|
||||||
const std::wstring& window_class) {
|
const std::wstring& window_class,
|
||||||
|
HBRUSH background_brush) {
|
||||||
// Only register the class one time.
|
// Only register the class one time.
|
||||||
static bool class_registered = false;
|
static bool class_registered = false;
|
||||||
if (class_registered)
|
if (class_registered)
|
||||||
@ -360,7 +362,7 @@ void RootWindowWin::RegisterRootClass(HINSTANCE hInstance,
|
|||||||
wcex.hInstance = hInstance;
|
wcex.hInstance = hInstance;
|
||||||
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CEFCLIENT));
|
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CEFCLIENT));
|
||||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
wcex.hbrBackground = background_brush;
|
||||||
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_CEFCLIENT);
|
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_CEFCLIENT);
|
||||||
wcex.lpszClassName = window_class.c_str();
|
wcex.lpszClassName = window_class.c_str();
|
||||||
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
|
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
|
||||||
@ -472,7 +474,9 @@ LRESULT CALLBACK RootWindowWin::RootWndProc(HWND hWnd, UINT message,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
// Never erase the background.
|
if (self->OnEraseBkgnd())
|
||||||
|
break;
|
||||||
|
// Don't erase the background.
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_ENTERMENULOOP:
|
case WM_ENTERMENULOOP:
|
||||||
@ -563,6 +567,11 @@ void RootWindowWin::OnMove() {
|
|||||||
browser->GetHost()->NotifyMoveOrResizeStarted();
|
browser->GetHost()->NotifyMoveOrResizeStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RootWindowWin::OnEraseBkgnd() {
|
||||||
|
// Erase the background when the browser does not exist.
|
||||||
|
return (GetBrowser() == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
bool RootWindowWin::OnCommand(UINT id) {
|
bool RootWindowWin::OnCommand(UINT id) {
|
||||||
if (id >= ID_TESTS_FIRST && id <= ID_TESTS_LAST) {
|
if (id >= ID_TESTS_FIRST && id <= ID_TESTS_LAST) {
|
||||||
delegate_->OnTest(this, id);
|
delegate_->OnTest(this, id);
|
||||||
|
@ -54,7 +54,8 @@ class RootWindowWin : public RootWindow,
|
|||||||
|
|
||||||
// Register the root window class.
|
// Register the root window class.
|
||||||
static void RegisterRootClass(HINSTANCE hInstance,
|
static void RegisterRootClass(HINSTANCE hInstance,
|
||||||
const std::wstring& window_class);
|
const std::wstring& window_class,
|
||||||
|
HBRUSH background_brush);
|
||||||
|
|
||||||
// Window procedure for the edit field.
|
// Window procedure for the edit field.
|
||||||
static LRESULT CALLBACK EditWndProc(HWND hWnd, UINT message, WPARAM wParam,
|
static LRESULT CALLBACK EditWndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||||
@ -73,6 +74,7 @@ class RootWindowWin : public RootWindow,
|
|||||||
void OnFocus();
|
void OnFocus();
|
||||||
void OnSize(bool minimized);
|
void OnSize(bool minimized);
|
||||||
void OnMove();
|
void OnMove();
|
||||||
|
bool OnEraseBkgnd();
|
||||||
bool OnCommand(UINT id);
|
bool OnCommand(UINT id);
|
||||||
void OnFind();
|
void OnFind();
|
||||||
void OnFindEvent();
|
void OnFindEvent();
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "include/base/cef_bind.h"
|
#include "include/base/cef_bind.h"
|
||||||
|
#include "include/cef_parser.h"
|
||||||
#include "include/cef_task.h"
|
#include "include/cef_task.h"
|
||||||
#include "include/cef_trace.h"
|
#include "include/cef_trace.h"
|
||||||
#include "include/cef_url.h"
|
|
||||||
#include "include/cef_web_plugin.h"
|
#include "include/cef_web_plugin.h"
|
||||||
#include "include/wrapper/cef_closure_task.h"
|
#include "include/wrapper/cef_closure_task.h"
|
||||||
#include "include/wrapper/cef_stream_resource_handler.h"
|
#include "include/wrapper/cef_stream_resource_handler.h"
|
||||||
|
@ -26,6 +26,7 @@ const char kTransparentPaintingEnabled[] = "transparent-painting-enabled";
|
|||||||
const char kShowUpdateRect[] = "show-update-rect";
|
const char kShowUpdateRect[] = "show-update-rect";
|
||||||
const char kMouseCursorChangeDisabled[] = "mouse-cursor-change-disabled";
|
const char kMouseCursorChangeDisabled[] = "mouse-cursor-change-disabled";
|
||||||
const char kRequestContextPerBrowser[] = "request-context-per-browser";
|
const char kRequestContextPerBrowser[] = "request-context-per-browser";
|
||||||
|
const char kBackgroundColor[] = "background-color";
|
||||||
|
|
||||||
} // namespace switches
|
} // namespace switches
|
||||||
} // namespace client
|
} // namespace client
|
||||||
|
@ -20,6 +20,7 @@ extern const char kTransparentPaintingEnabled[];
|
|||||||
extern const char kShowUpdateRect[];
|
extern const char kShowUpdateRect[];
|
||||||
extern const char kMouseCursorChangeDisabled[];
|
extern const char kMouseCursorChangeDisabled[];
|
||||||
extern const char kRequestContextPerBrowser[];
|
extern const char kRequestContextPerBrowser[];
|
||||||
|
extern const char kBackgroundColor[];
|
||||||
|
|
||||||
} // namespace switches
|
} // namespace switches
|
||||||
} // namespace client
|
} // namespace client
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
// Include this first to avoid type conflicts with CEF headers.
|
// Include this first to avoid type conflicts with CEF headers.
|
||||||
#include "tests/unittests/chromium_includes.h"
|
#include "tests/unittests/chromium_includes.h"
|
||||||
|
|
||||||
#include "include/cef_url.h"
|
#include "include/cef_parser.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
|
||||||
// Create the URL using the spec.
|
// Create the URL using the spec.
|
||||||
TEST(URLTest, CreateURLSpec) {
|
TEST(ParserTest, CreateURLSpec) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
CefString(&parts.spec).FromASCII(
|
CefString(&parts.spec).FromASCII(
|
||||||
@ -21,7 +21,7 @@ TEST(URLTest, CreateURLSpec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test that host is required.
|
// Test that host is required.
|
||||||
TEST(URLTest, CreateURLHostRequired) {
|
TEST(ParserTest, CreateURLHostRequired) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
CefString(&parts.scheme).FromASCII("http");
|
CefString(&parts.scheme).FromASCII("http");
|
||||||
@ -29,7 +29,7 @@ TEST(URLTest, CreateURLHostRequired) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test that scheme is required.
|
// Test that scheme is required.
|
||||||
TEST(URLTest, CreateURLSchemeRequired) {
|
TEST(ParserTest, CreateURLSchemeRequired) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
CefString(&parts.host).FromASCII("www.example.com");
|
CefString(&parts.host).FromASCII("www.example.com");
|
||||||
@ -37,7 +37,7 @@ TEST(URLTest, CreateURLSchemeRequired) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the URL using scheme and host.
|
// Create the URL using scheme and host.
|
||||||
TEST(URLTest, CreateURLSchemeHost) {
|
TEST(ParserTest, CreateURLSchemeHost) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
CefString(&parts.scheme).FromASCII("http");
|
CefString(&parts.scheme).FromASCII("http");
|
||||||
@ -47,7 +47,7 @@ TEST(URLTest, CreateURLSchemeHost) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the URL using scheme, host and path.
|
// Create the URL using scheme, host and path.
|
||||||
TEST(URLTest, CreateURLSchemeHostPath) {
|
TEST(ParserTest, CreateURLSchemeHostPath) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
CefString(&parts.scheme).FromASCII("http");
|
CefString(&parts.scheme).FromASCII("http");
|
||||||
@ -58,7 +58,7 @@ TEST(URLTest, CreateURLSchemeHostPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the URL using scheme, host, path and query.
|
// Create the URL using scheme, host, path and query.
|
||||||
TEST(URLTest, CreateURLSchemeHostPathQuery) {
|
TEST(ParserTest, CreateURLSchemeHostPathQuery) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
CefString(&parts.scheme).FromASCII("http");
|
CefString(&parts.scheme).FromASCII("http");
|
||||||
@ -71,7 +71,7 @@ TEST(URLTest, CreateURLSchemeHostPathQuery) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the URL using all the various components.
|
// Create the URL using all the various components.
|
||||||
TEST(URLTest, CreateURLAll) {
|
TEST(ParserTest, CreateURLAll) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
CefString(&parts.scheme).FromASCII("http");
|
CefString(&parts.scheme).FromASCII("http");
|
||||||
@ -88,7 +88,7 @@ TEST(URLTest, CreateURLAll) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse the URL using scheme and host.
|
// Parse the URL using scheme and host.
|
||||||
TEST(URLTest, ParseURLSchemeHost) {
|
TEST(ParserTest, ParseURLSchemeHost) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
url.FromASCII("http://www.example.com");
|
url.FromASCII("http://www.example.com");
|
||||||
@ -111,7 +111,7 @@ TEST(URLTest, ParseURLSchemeHost) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse the URL using scheme, host and path.
|
// Parse the URL using scheme, host and path.
|
||||||
TEST(URLTest, ParseURLSchemeHostPath) {
|
TEST(ParserTest, ParseURLSchemeHostPath) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
url.FromASCII("http://www.example.com/path/to.html");
|
url.FromASCII("http://www.example.com/path/to.html");
|
||||||
@ -135,7 +135,7 @@ TEST(URLTest, ParseURLSchemeHostPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse the URL using scheme, host, path and query.
|
// Parse the URL using scheme, host, path and query.
|
||||||
TEST(URLTest, ParseURLSchemeHostPathQuery) {
|
TEST(ParserTest, ParseURLSchemeHostPathQuery) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
url.FromASCII("http://www.example.com/path/to.html?foo=test&bar=test2");
|
url.FromASCII("http://www.example.com/path/to.html?foo=test&bar=test2");
|
||||||
@ -160,7 +160,7 @@ TEST(URLTest, ParseURLSchemeHostPathQuery) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse the URL using all the various components.
|
// Parse the URL using all the various components.
|
||||||
TEST(URLTest, ParseURLAll) {
|
TEST(ParserTest, ParseURLAll) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
url.FromASCII(
|
url.FromASCII(
|
||||||
@ -190,7 +190,7 @@ TEST(URLTest, ParseURLAll) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse an invalid URL.
|
// Parse an invalid URL.
|
||||||
TEST(URLTest, ParseURLInvalid) {
|
TEST(ParserTest, ParseURLInvalid) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
url.FromASCII("www.example.com");
|
url.FromASCII("www.example.com");
|
||||||
@ -198,7 +198,7 @@ TEST(URLTest, ParseURLInvalid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse a non-standard scheme.
|
// Parse a non-standard scheme.
|
||||||
TEST(URLTest, ParseURLNonStandard) {
|
TEST(ParserTest, ParseURLNonStandard) {
|
||||||
CefURLParts parts;
|
CefURLParts parts;
|
||||||
CefString url;
|
CefString url;
|
||||||
url.FromASCII("custom:something%20else?foo");
|
url.FromASCII("custom:something%20else?foo");
|
||||||
@ -219,7 +219,7 @@ TEST(URLTest, ParseURLNonStandard) {
|
|||||||
EXPECT_STREQ("foo", query.ToString().c_str());
|
EXPECT_STREQ("foo", query.ToString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(URLTest, GetMimeType) {
|
TEST(ParserTest, GetMimeType) {
|
||||||
CefString mime_type;
|
CefString mime_type;
|
||||||
|
|
||||||
mime_type = CefGetMimeType("html");
|
mime_type = CefGetMimeType("html");
|
||||||
@ -232,7 +232,7 @@ TEST(URLTest, GetMimeType) {
|
|||||||
EXPECT_STREQ("image/gif", mime_type.ToString().c_str());
|
EXPECT_STREQ("image/gif", mime_type.ToString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(URLTest, Base64Encode) {
|
TEST(ParserTest, Base64Encode) {
|
||||||
const std::string& test_str_decoded = "A test string";
|
const std::string& test_str_decoded = "A test string";
|
||||||
const std::string& test_str_encoded = "QSB0ZXN0IHN0cmluZw==";
|
const std::string& test_str_encoded = "QSB0ZXN0IHN0cmluZw==";
|
||||||
const CefString& encoded_value =
|
const CefString& encoded_value =
|
||||||
@ -240,7 +240,7 @@ TEST(URLTest, Base64Encode) {
|
|||||||
EXPECT_STREQ(test_str_encoded.c_str(), encoded_value.ToString().c_str());
|
EXPECT_STREQ(test_str_encoded.c_str(), encoded_value.ToString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(URLTest, Base64Decode) {
|
TEST(ParserTest, Base64Decode) {
|
||||||
const std::string& test_str_decoded = "A test string";
|
const std::string& test_str_decoded = "A test string";
|
||||||
const std::string& test_str_encoded = "QSB0ZXN0IHN0cmluZw==";
|
const std::string& test_str_encoded = "QSB0ZXN0IHN0cmluZw==";
|
||||||
CefRefPtr<CefBinaryValue> decoded_value = CefBase64Decode(test_str_encoded);
|
CefRefPtr<CefBinaryValue> decoded_value = CefBase64Decode(test_str_encoded);
|
||||||
@ -258,14 +258,14 @@ TEST(URLTest, Base64Decode) {
|
|||||||
EXPECT_STREQ(test_str_decoded.c_str(), decoded_str.c_str());
|
EXPECT_STREQ(test_str_decoded.c_str(), decoded_str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(URLTest, URIEncode) {
|
TEST(ParserTest, URIEncode) {
|
||||||
const std::string& test_str_decoded = "A test string=";
|
const std::string& test_str_decoded = "A test string=";
|
||||||
const std::string& test_str_encoded = "A%20test%20string%3D";
|
const std::string& test_str_encoded = "A%20test%20string%3D";
|
||||||
const CefString& encoded_value = CefURIEncode(test_str_decoded, false);
|
const CefString& encoded_value = CefURIEncode(test_str_decoded, false);
|
||||||
EXPECT_STREQ(test_str_encoded.c_str(), encoded_value.ToString().c_str());
|
EXPECT_STREQ(test_str_encoded.c_str(), encoded_value.ToString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(URLTest, URIDecode) {
|
TEST(ParserTest, URIDecode) {
|
||||||
const std::string& test_str_decoded = "A test string=";
|
const std::string& test_str_decoded = "A test string=";
|
||||||
const std::string& test_str_encoded = "A%20test%20string%3D";
|
const std::string& test_str_encoded = "A%20test%20string%3D";
|
||||||
const CefString& decoded_value =
|
const CefString& decoded_value =
|
||||||
@ -274,3 +274,38 @@ TEST(URLTest, URIDecode) {
|
|||||||
UU_SPACES | UU_URL_SPECIAL_CHARS));
|
UU_SPACES | UU_URL_SPECIAL_CHARS));
|
||||||
EXPECT_STREQ(test_str_decoded.c_str(), decoded_value.ToString().c_str());
|
EXPECT_STREQ(test_str_decoded.c_str(), decoded_value.ToString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(ParserTest, ParseCSSColor) {
|
||||||
|
std::string value;
|
||||||
|
cef_color_t color;
|
||||||
|
|
||||||
|
// Color by name.
|
||||||
|
value = "red";
|
||||||
|
color = 0;
|
||||||
|
EXPECT_TRUE(CefParseCSSColor(value, false, color));
|
||||||
|
EXPECT_EQ(CefColorSetARGB(255, 255, 0, 0), color);
|
||||||
|
|
||||||
|
// Color by RGB.
|
||||||
|
value = "rgb(1,2,3)";
|
||||||
|
color = 0;
|
||||||
|
EXPECT_TRUE(CefParseCSSColor(value, false, color));
|
||||||
|
EXPECT_EQ(CefColorSetARGB(255, 1, 2, 3), color);
|
||||||
|
|
||||||
|
// Color by RGBA.
|
||||||
|
value = "rgba(1,2,3,0.0)";
|
||||||
|
color = 0;
|
||||||
|
EXPECT_TRUE(CefParseCSSColor(value, false, color));
|
||||||
|
EXPECT_EQ(CefColorSetARGB(0, 1, 2, 3), color);
|
||||||
|
|
||||||
|
// Color by hex code.
|
||||||
|
value = "#FFAACC";
|
||||||
|
color = 0;
|
||||||
|
EXPECT_TRUE(CefParseCSSColor(value, false, color));
|
||||||
|
EXPECT_EQ(CefColorSetARGB(255, 0xFF, 0xAA, 0xCC), color);
|
||||||
|
|
||||||
|
// Invalid color.
|
||||||
|
value = "not_a_color";
|
||||||
|
color = 0;
|
||||||
|
EXPECT_FALSE(CefParseCSSColor(value, false, color));
|
||||||
|
EXPECT_EQ(0U, color);
|
||||||
|
}
|
@ -377,6 +377,7 @@ _simpletypes = {
|
|||||||
'bool' : ['int', '0'],
|
'bool' : ['int', '0'],
|
||||||
'char': ['char', '0'],
|
'char': ['char', '0'],
|
||||||
'char* const': ['char* const', 'NULL'],
|
'char* const': ['char* const', 'NULL'],
|
||||||
|
'cef_color_t': ['cef_color_t', '0'],
|
||||||
'CefCursorHandle' : ['cef_cursor_handle_t', 'kNullCursorHandle'],
|
'CefCursorHandle' : ['cef_cursor_handle_t', 'kNullCursorHandle'],
|
||||||
'CefEventHandle' : ['cef_event_handle_t', 'kNullEventHandle'],
|
'CefEventHandle' : ['cef_event_handle_t', 'kNullEventHandle'],
|
||||||
'CefWindowHandle' : ['cef_window_handle_t', 'kNullWindowHandle'],
|
'CefWindowHandle' : ['cef_window_handle_t', 'kNullWindowHandle'],
|
||||||
|
Reference in New Issue
Block a user