Compare commits

...

20 Commits
4951 ... 2623

Author SHA1 Message Date
Marshall Greenblatt
b90a3be186 Call RenderProcessHost::Send from correct thread (issue #1881) 2016-05-11 12:31:39 -04:00
Marshall Greenblatt
5b27df39b2 Fix incorrect initialization of WebCursor object (issue #1894) 2016-05-11 11:01:21 -04:00
Marshall Greenblatt
64e2fe1d2b Fix assertion when only video or audio capture is selected (issue #1802) 2016-05-09 16:20:43 -04:00
Marshall Greenblatt
93f810339f Enable unified text checker to match Chrome spellcheck behavior (issue #1891) 2016-05-09 14:14:53 -04:00
Marshall Greenblatt
af139d7761 make_distrib.py: Look for libcef instead of cefclient when running with --allow-partial (issue #1804) 2016-03-31 15:32:15 +02:00
Marshall Greenblatt
0451528779 Update to Chromium version 49.0.2623.110 2016-03-29 13:16:02 +02:00
Marshall Greenblatt
3034273cb9 Linux: Don't try to resolve missing package dependencies when use_sysroot==1 (issue #1804) 2016-03-10 09:33:21 -08:00
Marshall Greenblatt
2a6491bf8d Update to Chromium version 49.0.2623.87 2016-03-09 18:34:24 -05:00
Marshall Greenblatt
9e0fda80bd Add patch file for overlay scroll bar color fix 2016-03-04 12:44:03 -05:00
Marshall Greenblatt
c59d47ad9e Fix duplicate entries in CefRequest header map (issue #1840) 2016-03-01 19:12:21 -05:00
Marshall Greenblatt
fc96ca576f Fix documentation errors (issue #1834) 2016-03-01 17:26:52 -05:00
Marshall Greenblatt
44fcb48baa Fix thread safety issue with CefBrowserHostImpl::IsWindowless 2016-02-29 15:25:45 -05:00
Marshall Greenblatt
483cb2ea69 Update to Chromium version 49.0.2623.54 2016-02-24 14:19:19 -08:00
Marshall Greenblatt
969ebf0ca9 Windows: cmake: Add ws2_32.lib to CEF_STANDARD_LIBS (issue #1842) 2016-02-24 12:55:43 -05:00
Marshall Greenblatt
820e629774 Windows: cmake: Disable VS2010 override warning (issue #1642) 2016-02-24 12:55:34 -05:00
Marshall Greenblatt
3c1f28b051 Add missing values to cef_resource_type_t 2016-02-24 12:43:30 -05:00
Marshall Greenblatt
ce1e9e65fd Add DNS resolution methods to CefRequestContext (issue #1841) 2016-02-23 18:38:24 -05:00
Marshall Greenblatt
cd7e8a0558 Allow clients to clear certificate exceptions and close connections (issue #1793) 2016-02-23 15:08:39 -05:00
Marshall Greenblatt
912e94bf61 Continue OnDownloadUpdated notifications after navigation (issue #1833) 2016-02-16 13:51:48 -05:00
Marshall Greenblatt
d300dc43d9 Update to Chromium version 49.0.2623.28 2016-02-03 15:35:01 -05:00
65 changed files with 1948 additions and 268 deletions

View File

@@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': '92d77538a86529ca35f9220bd3cd512cbea1f086',
'chromium_checkout': 'refs/tags/49.0.2623.110',
}

View File

@@ -333,7 +333,7 @@ if(OS_MACOSX)
# -O3 = Optimize for maximum speed plus a few extras
set(CEF_COMPILER_FLAGS_RELEASE "-O3")
# -Wl,-search_paths_first = Search for static or shared library versions in the same pass
# -Wl,-ObjC = Support creation of creation of ObjC static libraries
# -Wl,-ObjC = Support creation of creation of ObjC static libraries
# -Wl,-pie = Generate position-independent code suitable for executables only
set(CEF_LINKER_FLAGS "-Wl,-search_paths_first -Wl,-ObjC -Wl,-pie")
# -Wl,-dead_strip = Strip dead code
@@ -392,11 +392,12 @@ if(OS_WINDOWS)
# /wd"4100" = Ignore "unreferenced formal parameter" warning
# /wd"4127" = Ignore "conditional expression is constant" warning
# /wd"4244" = Ignore "conversion possible loss of data" warning
# /wd"4481" = Ignore "nonstandard extension used: override" warning
# /wd"4512" = Ignore "assignment operator could not be generated" warning
# /wd"4701" = Ignore "potentially uninitialized local variable" warning
# /wd"4702" = Ignore "unreachable code" warning
# /wd"4996" = Ignore "function or variable may be unsafe" warning
set(CEF_COMPILER_FLAGS "/MP /Gy /GR- /W4 /WX /wd\"4100\" /wd\"4127\" /wd\"4244\" /wd\"4512\" /wd\"4701\" /wd\"4702\" /wd\"4996\" ${CEF_DEBUG_INFO_FLAG}")
set(CEF_COMPILER_FLAGS "/MP /Gy /GR- /W4 /WX /wd\"4100\" /wd\"4127\" /wd\"4244\" /wd\"4481\" /wd\"4512\" /wd\"4701\" /wd\"4702\" /wd\"4996\" ${CEF_DEBUG_INFO_FLAG}")
# /MTd = Multithreaded debug runtime
# /Od = Disable optimizations
# /RTC1 = Enable basic run-time checks
@@ -423,7 +424,7 @@ if(OS_WINDOWS)
-D_WIN32_WINNT=0x602 -DNOMINMAX -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0)
# Standard libraries.
set(CEF_STANDARD_LIBS "comctl32.lib" "rpcrt4.lib" "shlwapi.lib")
set(CEF_STANDARD_LIBS "comctl32.lib" "rpcrt4.lib" "shlwapi.lib" "ws2_32.lib")
# CEF directory paths.
set(CEF_RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Resources")

15
cef.gyp
View File

@@ -12,6 +12,9 @@
# Need to be creative to match dylib version formatting requirements.
'version_mac_dylib':
'<!(python ../build/util/version.py -f VERSION -f ../chrome/VERSION -t "@CEF_MAJOR@<(commit_number).@BUILD_HI@.@BUILD_LO@" -e "BUILD_HI=int(BUILD)/256" -e "BUILD_LO=int(BUILD)%256")',
# For some reason we don't get the 'use_sysroot' default from common.gypi so
# set it here as well.
'use_sysroot%': 0,
},
'includes': [
# Bring in the source file lists.
@@ -163,7 +166,10 @@
'<@(cefclient_sources_mac)',
],
}],
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
[ '(OS=="linux" or OS=="freebsd" or OS=="openbsd") and use_sysroot==0', {
# Required packages are not available when using the default sysroot
# environment. Consequently the cefclient target cannot be built with
# use_sysroot==1.
'dependencies': [
'gtk',
'gtkglext',
@@ -1939,7 +1945,10 @@
],
}],
}], # OS!="mac"
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
[ '(OS=="linux" or OS=="freebsd" or OS=="openbsd") and use_sysroot==0', {
# Required packages are not available when using the default sysroot
# environment. Consequently the cefclient target cannot be built with
# use_sysroot==1.
'targets': [
{
'target_name': 'gtk',
@@ -1985,7 +1994,7 @@
},
},
],
}], # OS=="linux" or OS=="freebsd" or OS=="openbsd"
}], # (OS=="linux" or OS=="freebsd" or OS=="openbsd") and use_sysroot==0
[ 'OS=="win"', {
'targets': [
{

View File

@@ -252,6 +252,8 @@
'libcef_dll/ctocpp/request_context_handler_ctocpp.h',
'libcef_dll/ctocpp/request_handler_ctocpp.cc',
'libcef_dll/ctocpp/request_handler_ctocpp.h',
'libcef_dll/ctocpp/resolve_callback_ctocpp.cc',
'libcef_dll/ctocpp/resolve_callback_ctocpp.h',
'libcef_dll/cpptoc/resource_bundle_cpptoc.cc',
'libcef_dll/cpptoc/resource_bundle_cpptoc.h',
'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.cc',
@@ -452,6 +454,8 @@
'libcef_dll/cpptoc/request_context_handler_cpptoc.h',
'libcef_dll/cpptoc/request_handler_cpptoc.cc',
'libcef_dll/cpptoc/request_handler_cpptoc.h',
'libcef_dll/cpptoc/resolve_callback_cpptoc.cc',
'libcef_dll/cpptoc/resolve_callback_cpptoc.h',
'libcef_dll/ctocpp/resource_bundle_ctocpp.cc',
'libcef_dll/ctocpp/resource_bundle_ctocpp.h',
'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.cc',

View File

@@ -174,7 +174,7 @@ typedef struct _cef_browser_t {
void (CEF_CALLBACK *get_frame_names)(struct _cef_browser_t* self,
cef_string_list_t names);
//
///
// Send a message to the specified |target_process|. Returns true (1) if the
// message was sent successfully.
///
@@ -418,7 +418,6 @@ typedef struct _cef_browser_host_t {
// navigation entry will be sent, otherwise all navigation entries will be
// sent.
///
///
void (CEF_CALLBACK *get_navigation_entries)(struct _cef_browser_host_t* self,
struct _cef_navigation_entry_visitor_t* visitor, int current_only);

View File

@@ -56,11 +56,13 @@ typedef struct _cef_keyboard_handler_t {
///
cef_base_t base;
///
// Called before a keyboard event is sent to the renderer. |event| contains
// information about the keyboard event. |os_event| is the operating system
// event message, if any. Return true (1) if the event was handled or false
// (0) otherwise. If the event will be handled in on_key_event() as a keyboard
// shortcut set |is_keyboard_shortcut| to true (1) and return false (0).
///
int (CEF_CALLBACK *on_pre_key_event)(struct _cef_keyboard_handler_t* self,
struct _cef_browser_t* browser, const struct _cef_key_event_t* event,
cef_event_handle_t os_event, int* is_keyboard_shortcut);

View File

@@ -75,6 +75,7 @@ typedef struct _cef_life_span_handler_t {
// default to the source browser's values. If the |no_javascript_access| value
// is set to false (0) the new browser will not be scriptable and may not be
// hosted in the same renderer process as the source browser.
///
int (CEF_CALLBACK *on_before_popup)(struct _cef_life_span_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
const cef_string_t* target_url, const cef_string_t* target_frame_name,

View File

@@ -67,59 +67,59 @@ typedef struct _cef_menu_model_t {
///
int (CEF_CALLBACK *get_count)(struct _cef_menu_model_t* self);
//
///
// Add a separator to the menu. Returns true (1) on success.
///
int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self);
//
///
// Add an item to the menu. Returns true (1) on success.
///
int (CEF_CALLBACK *add_item)(struct _cef_menu_model_t* self, int command_id,
const cef_string_t* label);
//
///
// Add a check item to the menu. Returns true (1) on success.
///
int (CEF_CALLBACK *add_check_item)(struct _cef_menu_model_t* self,
int command_id, const cef_string_t* label);
//
///
// Add a radio item to the menu. Only a single item with the specified
// |group_id| can be checked at a time. Returns true (1) on success.
///
int (CEF_CALLBACK *add_radio_item)(struct _cef_menu_model_t* self,
int command_id, const cef_string_t* label, int group_id);
//
///
// Add a sub-menu to the menu. The new sub-menu is returned.
///
struct _cef_menu_model_t* (CEF_CALLBACK *add_sub_menu)(
struct _cef_menu_model_t* self, int command_id,
const cef_string_t* label);
//
///
// Insert a separator in the menu at the specified |index|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *insert_separator_at)(struct _cef_menu_model_t* self,
int index);
//
///
// Insert an item in the menu at the specified |index|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *insert_item_at)(struct _cef_menu_model_t* self, int index,
int command_id, const cef_string_t* label);
//
///
// Insert a check item in the menu at the specified |index|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *insert_check_item_at)(struct _cef_menu_model_t* self,
int index, int command_id, const cef_string_t* label);
//
///
// Insert a radio item in the menu at the specified |index|. Only a single
// item with the specified |group_id| can be checked at a time. Returns true
// (1) on success.
@@ -127,7 +127,7 @@ typedef struct _cef_menu_model_t {
int (CEF_CALLBACK *insert_radio_item_at)(struct _cef_menu_model_t* self,
int index, int command_id, const cef_string_t* label, int group_id);
//
///
// Insert a sub-menu in the menu at the specified |index|. The new sub-menu is
// returned.
///
@@ -242,98 +242,98 @@ typedef struct _cef_menu_model_t {
struct _cef_menu_model_t* (CEF_CALLBACK *get_sub_menu_at)(
struct _cef_menu_model_t* self, int index);
//
///
// Returns true (1) if the specified |command_id| is visible.
///
int (CEF_CALLBACK *is_visible)(struct _cef_menu_model_t* self,
int command_id);
//
///
// Returns true (1) if the specified |index| is visible.
///
int (CEF_CALLBACK *is_visible_at)(struct _cef_menu_model_t* self, int index);
//
///
// Change the visibility of the specified |command_id|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *set_visible)(struct _cef_menu_model_t* self,
int command_id, int visible);
//
///
// Change the visibility at the specified |index|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *set_visible_at)(struct _cef_menu_model_t* self, int index,
int visible);
//
///
// Returns true (1) if the specified |command_id| is enabled.
///
int (CEF_CALLBACK *is_enabled)(struct _cef_menu_model_t* self,
int command_id);
//
///
// Returns true (1) if the specified |index| is enabled.
///
int (CEF_CALLBACK *is_enabled_at)(struct _cef_menu_model_t* self, int index);
//
///
// Change the enabled status of the specified |command_id|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *set_enabled)(struct _cef_menu_model_t* self,
int command_id, int enabled);
//
///
// Change the enabled status at the specified |index|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *set_enabled_at)(struct _cef_menu_model_t* self, int index,
int enabled);
//
///
// Returns true (1) if the specified |command_id| is checked. Only applies to
// check and radio items.
///
int (CEF_CALLBACK *is_checked)(struct _cef_menu_model_t* self,
int command_id);
//
///
// Returns true (1) if the specified |index| is checked. Only applies to check
// and radio items.
///
int (CEF_CALLBACK *is_checked_at)(struct _cef_menu_model_t* self, int index);
//
///
// Check the specified |command_id|. Only applies to check and radio items.
// Returns true (1) on success.
///
int (CEF_CALLBACK *set_checked)(struct _cef_menu_model_t* self,
int command_id, int checked);
//
///
// Check the specified |index|. Only applies to check and radio items. Returns
// true (1) on success.
///
int (CEF_CALLBACK *set_checked_at)(struct _cef_menu_model_t* self, int index,
int checked);
//
///
// Returns true (1) if the specified |command_id| has a keyboard accelerator
// assigned.
///
int (CEF_CALLBACK *has_accelerator)(struct _cef_menu_model_t* self,
int command_id);
//
///
// Returns true (1) if the specified |index| has a keyboard accelerator
// assigned.
///
int (CEF_CALLBACK *has_accelerator_at)(struct _cef_menu_model_t* self,
int index);
//
///
// Set the keyboard accelerator for the specified |command_id|. |key_code| can
// be any virtual key or character value. Returns true (1) on success.
///
@@ -341,7 +341,7 @@ typedef struct _cef_menu_model_t {
int command_id, int key_code, int shift_pressed, int ctrl_pressed,
int alt_pressed);
//
///
// Set the keyboard accelerator at the specified |index|. |key_code| can be
// any virtual key or character value. Returns true (1) on success.
///
@@ -349,21 +349,21 @@ typedef struct _cef_menu_model_t {
int index, int key_code, int shift_pressed, int ctrl_pressed,
int alt_pressed);
//
///
// Remove the keyboard accelerator for the specified |command_id|. Returns
// true (1) on success.
///
int (CEF_CALLBACK *remove_accelerator)(struct _cef_menu_model_t* self,
int command_id);
//
///
// Remove the keyboard accelerator at the specified |index|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *remove_accelerator_at)(struct _cef_menu_model_t* self,
int index);
//
///
// Retrieves the keyboard accelerator for the specified |command_id|. Returns
// true (1) on success.
///
@@ -371,7 +371,7 @@ typedef struct _cef_menu_model_t {
int command_id, int* key_code, int* shift_pressed, int* ctrl_pressed,
int* alt_pressed);
//
///
// Retrieves the keyboard accelerator for the specified |index|. Returns true
// (1) on success.
///

View File

@@ -82,10 +82,12 @@ CEF_EXPORT cef_string_userfree_t cef_format_url_for_security_display(
CEF_EXPORT cef_string_userfree_t cef_get_mime_type(
const cef_string_t* extension);
///
// Get the extensions associated with the given mime type. This should be passed
// in lower case. There could be multiple extensions for a given mime type, like
// "html,htm" for "text/html", or "txt,text,html,..." for "text/*". Any existing
// elements in the provided vector will not be erased.
///
CEF_EXPORT void cef_get_extensions_for_mime_type(const cef_string_t* mime_type,
cef_string_list_t extensions);
@@ -136,22 +138,28 @@ CEF_EXPORT cef_string_userfree_t cef_uridecode(const cef_string_t* text,
CEF_EXPORT int cef_parse_csscolor(const cef_string_t* string, int strict,
cef_color_t* color);
///
// Parses the specified |json_string| and returns a dictionary or list
// representation. If JSON parsing fails this function returns NULL.
///
CEF_EXPORT struct _cef_value_t* cef_parse_json(const cef_string_t* json_string,
cef_json_parser_options_t options);
///
// Parses the specified |json_string| and returns a dictionary or list
// representation. If JSON parsing fails this function returns NULL and
// populates |error_code_out| and |error_msg_out| with an error code and a
// formatted error message respectively.
///
CEF_EXPORT struct _cef_value_t* cef_parse_jsonand_return_error(
const cef_string_t* json_string, cef_json_parser_options_t options,
cef_json_parser_error_t* error_code_out, cef_string_t* error_msg_out);
///
// Generates a JSON string from the specified root |node| which should be a
// dictionary or list value. Returns an NULL string on failure. This function
// requires exclusive access to |node| including any underlying data.
///
// The resulting string must be freed by calling cef_string_userfree_free().
CEF_EXPORT cef_string_userfree_t cef_write_json(struct _cef_value_t* node,
cef_json_writer_options_t options);

View File

@@ -38,6 +38,7 @@
#define CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
#pragma once
#include "include/capi/cef_callback_capi.h"
#include "include/capi/cef_cookie_capi.h"
#include "include/capi/cef_request_context_handler_capi.h"
#include "include/capi/cef_values_capi.h"
@@ -48,6 +49,26 @@ extern "C" {
struct _cef_scheme_handler_factory_t;
///
// Callback structure for cef_request_tContext::ResolveHost.
///
typedef struct _cef_resolve_callback_t {
///
// Base structure.
///
cef_base_t base;
///
// Called after the ResolveHost request has completed. |result| will be the
// result code. |resolved_ips| will be the list of resolved IP addresses or
// NULL if the resolution failed.
///
void (CEF_CALLBACK *on_resolve_completed)(
struct _cef_resolve_callback_t* self, cef_errorcode_t result,
cef_string_list_t resolved_ips);
} cef_resolve_callback_t;
///
// A request context provides request handling for a set of related browser or
// URL request objects. A request context can be specified when creating a new
@@ -199,6 +220,45 @@ typedef struct _cef_request_context_t {
int (CEF_CALLBACK *set_preference)(struct _cef_request_context_t* self,
const cef_string_t* name, struct _cef_value_t* value,
cef_string_t* error);
///
// Clears all certificate exceptions that were added as part of handling
// cef_request_tHandler::on_certificate_error(). If you call this it is
// recommended that you also call close_all_connections() or you risk not
// being prompted again for server certificates if you reconnect quickly. If
// |callback| is non-NULL it will be executed on the UI thread after
// completion.
///
void (CEF_CALLBACK *clear_certificate_exceptions)(
struct _cef_request_context_t* self,
struct _cef_completion_callback_t* callback);
///
// Clears all active and idle connections that Chromium currently has. This is
// only recommended if you have released all other CEF objects but don't yet
// want to call cef_shutdown(). If |callback| is non-NULL it will be executed
// on the UI thread after completion.
///
void (CEF_CALLBACK *close_all_connections)(
struct _cef_request_context_t* self,
struct _cef_completion_callback_t* callback);
///
// Attempts to resolve |origin| to a list of associated IP addresses.
// |callback| will be executed on the UI thread after completion.
///
void (CEF_CALLBACK *resolve_host)(struct _cef_request_context_t* self,
const cef_string_t* origin, struct _cef_resolve_callback_t* callback);
///
// Attempts to resolve |origin| to a list of associated IP addresses using
// cached data. |resolved_ips| will be populated with the list of resolved IP
// addresses or NULL if no cached data is available. Returns ERR_NONE on
// success. This function must be called on the browser process IO thread.
///
cef_errorcode_t (CEF_CALLBACK *resolve_host_cached)(
struct _cef_request_context_t* self, const cef_string_t* origin,
cef_string_list_t resolved_ips);
} cef_request_context_t;

View File

@@ -61,6 +61,7 @@ typedef struct _cef_response_filter_t {
///
int (CEF_CALLBACK *init_filter)(struct _cef_response_filter_t* self);
///
// Called to filter a chunk of data. |data_in| is the input buffer containing
// |data_in_size| bytes of pre-filter data (|data_in| will be NULL if
// |data_in_size| is zero). |data_out| is the output buffer that can accept up
@@ -77,6 +78,7 @@ typedef struct _cef_response_filter_t {
// matches |data_in_size| (all available pre-filter bytes have been read), and
// the function returns RESPONSE_FILTER_DONE or RESPONSE_FILTER_ERROR. Do not
// keep a reference to the buffers passed to this function.
///
cef_response_filter_status_t (CEF_CALLBACK *filter)(
struct _cef_response_filter_t* self, void* data_in, size_t data_in_size,
size_t* data_in_read, void* data_out, size_t data_out_size,

View File

@@ -181,7 +181,7 @@ class CefBrowser : public virtual CefBase {
/*--cef()--*/
virtual void GetFrameNames(std::vector<CefString>& names) =0;
//
///
// Send a message to the specified |target_process|. Returns true if the
// message was sent successfully.
///
@@ -457,7 +457,6 @@ class CefBrowserHost : public virtual CefBase {
// specified visitor. If |current_only| is true only the current navigation
// entry will be sent, otherwise all navigation entries will be sent.
///
///
/*--cef()--*/
virtual void GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor,

View File

@@ -48,11 +48,13 @@
/*--cef(source=client)--*/
class CefKeyboardHandler : public virtual CefBase {
public:
///
// Called before a keyboard event is sent to the renderer. |event| contains
// information about the keyboard event. |os_event| is the operating system
// event message, if any. Return true if the event was handled or false
// otherwise. If the event will be handled in OnKeyEvent() as a keyboard
// shortcut set |is_keyboard_shortcut| to true and return false.
///
/*--cef()--*/
virtual bool OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
const CefKeyEvent& event,

View File

@@ -70,6 +70,7 @@ class CefLifeSpanHandler : public virtual CefBase {
// source browser's values. If the |no_javascript_access| value is set to
// false the new browser will not be scriptable and may not be hosted in the
// same renderer process as the source browser.
///
/*--cef(optional_param=target_url,optional_param=target_frame_name)--*/
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,

View File

@@ -63,26 +63,26 @@ class CefMenuModel : public virtual CefBase {
/*--cef()--*/
virtual int GetCount() =0;
//
///
// Add a separator to the menu. Returns true on success.
///
/*--cef()--*/
virtual bool AddSeparator() =0;
//
///
// Add an item to the menu. Returns true on success.
///
/*--cef()--*/
virtual bool AddItem(int command_id,
const CefString& label) =0;
//
///
// Add a check item to the menu. Returns true on success.
///
/*--cef()--*/
virtual bool AddCheckItem(int command_id,
const CefString& label) =0;
//
///
// Add a radio item to the menu. Only a single item with the specified
// |group_id| can be checked at a time. Returns true on success.
///
@@ -91,21 +91,21 @@ class CefMenuModel : public virtual CefBase {
const CefString& label,
int group_id) =0;
//
///
// Add a sub-menu to the menu. The new sub-menu is returned.
///
/*--cef()--*/
virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id,
const CefString& label) =0;
//
///
// Insert a separator in the menu at the specified |index|. Returns true on
// success.
///
/*--cef()--*/
virtual bool InsertSeparatorAt(int index) =0;
//
///
// Insert an item in the menu at the specified |index|. Returns true on
// success.
///
@@ -114,7 +114,7 @@ class CefMenuModel : public virtual CefBase {
int command_id,
const CefString& label) =0;
//
///
// Insert a check item in the menu at the specified |index|. Returns true on
// success.
///
@@ -123,7 +123,7 @@ class CefMenuModel : public virtual CefBase {
int command_id,
const CefString& label) =0;
//
///
// Insert a radio item in the menu at the specified |index|. Only a single
// item with the specified |group_id| can be checked at a time. Returns true
// on success.
@@ -134,7 +134,7 @@ class CefMenuModel : public virtual CefBase {
const CefString& label,
int group_id) =0;
//
///
// Insert a sub-menu in the menu at the specified |index|. The new sub-menu
// is returned.
///
@@ -248,99 +248,99 @@ class CefMenuModel : public virtual CefBase {
/*--cef()--*/
virtual CefRefPtr<CefMenuModel> GetSubMenuAt(int index) =0;
//
///
// Returns true if the specified |command_id| is visible.
///
/*--cef()--*/
virtual bool IsVisible(int command_id) =0;
//
///
// Returns true if the specified |index| is visible.
///
/*--cef()--*/
virtual bool IsVisibleAt(int index) =0;
//
///
// Change the visibility of the specified |command_id|. Returns true on
// success.
///
/*--cef()--*/
virtual bool SetVisible(int command_id, bool visible) =0;
//
///
// Change the visibility at the specified |index|. Returns true on success.
///
/*--cef()--*/
virtual bool SetVisibleAt(int index, bool visible) =0;
//
///
// Returns true if the specified |command_id| is enabled.
///
/*--cef()--*/
virtual bool IsEnabled(int command_id) =0;
//
///
// Returns true if the specified |index| is enabled.
///
/*--cef()--*/
virtual bool IsEnabledAt(int index) =0;
//
///
// Change the enabled status of the specified |command_id|. Returns true on
// success.
///
/*--cef()--*/
virtual bool SetEnabled(int command_id, bool enabled) =0;
//
///
// Change the enabled status at the specified |index|. Returns true on
// success.
///
/*--cef()--*/
virtual bool SetEnabledAt(int index, bool enabled) =0;
//
///
// Returns true if the specified |command_id| is checked. Only applies to
// check and radio items.
///
/*--cef()--*/
virtual bool IsChecked(int command_id) =0;
//
///
// Returns true if the specified |index| is checked. Only applies to check
// and radio items.
///
/*--cef()--*/
virtual bool IsCheckedAt(int index) =0;
//
///
// Check the specified |command_id|. Only applies to check and radio items.
// Returns true on success.
///
/*--cef()--*/
virtual bool SetChecked(int command_id, bool checked) =0;
//
///
// Check the specified |index|. Only applies to check and radio items. Returns
// true on success.
///
/*--cef()--*/
virtual bool SetCheckedAt(int index, bool checked) =0;
//
///
// Returns true if the specified |command_id| has a keyboard accelerator
// assigned.
///
/*--cef()--*/
virtual bool HasAccelerator(int command_id) =0;
//
///
// Returns true if the specified |index| has a keyboard accelerator assigned.
///
/*--cef()--*/
virtual bool HasAcceleratorAt(int index) =0;
//
///
// Set the keyboard accelerator for the specified |command_id|. |key_code| can
// be any virtual key or character value. Returns true on success.
///
@@ -351,7 +351,7 @@ class CefMenuModel : public virtual CefBase {
bool ctrl_pressed,
bool alt_pressed) =0;
//
///
// Set the keyboard accelerator at the specified |index|. |key_code| can be
// any virtual key or character value. Returns true on success.
///
@@ -362,21 +362,21 @@ class CefMenuModel : public virtual CefBase {
bool ctrl_pressed,
bool alt_pressed) =0;
//
///
// Remove the keyboard accelerator for the specified |command_id|. Returns
// true on success.
///
/*--cef()--*/
virtual bool RemoveAccelerator(int command_id) =0;
//
///
// Remove the keyboard accelerator at the specified |index|. Returns true on
// success.
///
/*--cef()--*/
virtual bool RemoveAcceleratorAt(int index) =0;
//
///
// Retrieves the keyboard accelerator for the specified |command_id|. Returns
// true on success.
///
@@ -387,7 +387,7 @@ class CefMenuModel : public virtual CefBase {
bool& ctrl_pressed,
bool& alt_pressed) =0;
//
///
// Retrieves the keyboard accelerator for the specified |index|. Returns true
// on success.
///

View File

@@ -81,10 +81,12 @@ CefString CefFormatUrlForSecurityDisplay(const CefString& origin_url,
/*--cef()--*/
CefString CefGetMimeType(const CefString& extension);
///
// Get the extensions associated with the given mime type. This should be passed
// in lower case. There could be multiple extensions for a given mime type, like
// "html,htm" for "text/html", or "txt,text,html,..." for "text/*". Any existing
// elements in the provided vector will not be erased.
///
/*--cef()--*/
void CefGetExtensionsForMimeType(const CefString& mime_type,
std::vector<CefString>& extensions);
@@ -137,16 +139,20 @@ bool CefParseCSSColor(const CefString& string,
bool strict,
cef_color_t& color);
///
// Parses the specified |json_string| and returns a dictionary or list
// representation. If JSON parsing fails this method returns NULL.
///
/*--cef()--*/
CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
cef_json_parser_options_t options);
///
// Parses the specified |json_string| and returns a dictionary or list
// representation. If JSON parsing fails this method returns NULL and populates
// |error_code_out| and |error_msg_out| with an error code and a formatted error
// message respectively.
///
/*--cef()--*/
CefRefPtr<CefValue> CefParseJSONAndReturnError(
const CefString& json_string,
@@ -154,9 +160,11 @@ CefRefPtr<CefValue> CefParseJSONAndReturnError(
cef_json_parser_error_t& error_code_out,
CefString& error_msg_out);
///
// Generates a JSON string from the specified root |node| which should be a
// dictionary or list value. Returns an empty string on failure. This method
// requires exclusive access to |node| including any underlying data.
///
/*--cef()--*/
CefString CefWriteJSON(CefRefPtr<CefValue> node,
cef_json_writer_options_t options);

View File

@@ -38,12 +38,34 @@
#define CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_
#pragma once
#include <vector>
#include "include/cef_callback.h"
#include "include/cef_cookie.h"
#include "include/cef_request_context_handler.h"
#include "include/cef_values.h"
class CefSchemeHandlerFactory;
///
// Callback interface for CefRequestContext::ResolveHost.
///
/*--cef(source=client)--*/
class CefResolveCallback : public virtual CefBase {
public:
///
// Called after the ResolveHost request has completed. |result| will be the
// result code. |resolved_ips| will be the list of resolved IP addresses or
// empty if the resolution failed.
///
/*--cef(optional_param=resolved_ips)--*/
virtual void OnResolveCompleted(
cef_errorcode_t result,
const std::vector<CefString>& resolved_ips) =0;
};
///
// A request context provides request handling for a set of related browser
// or URL request objects. A request context can be specified when creating a
@@ -217,6 +239,48 @@ class CefRequestContext : public virtual CefBase {
virtual bool SetPreference(const CefString& name,
CefRefPtr<CefValue> value,
CefString& error) =0;
///
// Clears all certificate exceptions that were added as part of handling
// CefRequestHandler::OnCertificateError(). If you call this it is
// recommended that you also call CloseAllConnections() or you risk not
// being prompted again for server certificates if you reconnect quickly.
// If |callback| is non-NULL it will be executed on the UI thread after
// completion.
///
/*--cef(optional_param=callback)--*/
virtual void ClearCertificateExceptions(
CefRefPtr<CefCompletionCallback> callback) =0;
///
// Clears all active and idle connections that Chromium currently has.
// This is only recommended if you have released all other CEF objects but
// don't yet want to call CefShutdown(). If |callback| is non-NULL it will be
// executed on the UI thread after completion.
///
/*--cef(optional_param=callback)--*/
virtual void CloseAllConnections(
CefRefPtr<CefCompletionCallback> callback) =0;
///
// Attempts to resolve |origin| to a list of associated IP addresses.
// |callback| will be executed on the UI thread after completion.
///
/*--cef()--*/
virtual void ResolveHost(
const CefString& origin,
CefRefPtr<CefResolveCallback> callback) =0;
///
// Attempts to resolve |origin| to a list of associated IP addresses using
// cached data. |resolved_ips| will be populated with the list of resolved IP
// addresses or empty if no cached data is available. Returns ERR_NONE on
// success. This method must be called on the browser process IO thread.
///
/*--cef(default_retval=ERR_FAILED)--*/
virtual cef_errorcode_t ResolveHostCached(
const CefString& origin,
std::vector<CefString>& resolved_ips) =0;
};
#endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_

View File

@@ -56,6 +56,7 @@ class CefResponseFilter : public virtual CefBase {
/*--cef()--*/
virtual bool InitFilter() =0;
///
// Called to filter a chunk of data. |data_in| is the input buffer containing
// |data_in_size| bytes of pre-filter data (|data_in| will be NULL if
// |data_in_size| is zero). |data_out| is the output buffer that can accept up
@@ -72,6 +73,7 @@ class CefResponseFilter : public virtual CefBase {
// matches |data_in_size| (all available pre-filter bytes have been read), and
// the method returns RESPONSE_FILTER_DONE or RESPONSE_FILTER_ERROR. Do not
// keep a reference to the buffers passed to this method.
///
/*--cef(optional_param=data_in,default_retval=RESPONSE_FILTER_ERROR)--*/
virtual FilterStatus Filter(void* data_in,
size_t data_in_size,

View File

@@ -1076,6 +1076,16 @@ typedef enum {
// Main resource of a service worker.
///
RT_SERVICE_WORKER,
///
// A report of Content Security Policy violations.
///
RT_CSP_REPORT,
///
// A resource that a plugin requested.
///
RT_PLUGIN_RESOURCE,
} cef_resource_type_t;
///

View File

@@ -1259,7 +1259,7 @@ bool CefBrowserHostImpl::SendProcessMessage(
// -----------------------------------------------------------------------------
bool CefBrowserHostImpl::IsWindowless() const {
return platform_delegate_->IsWindowless();
return is_windowless_;
}
void CefBrowserHostImpl::WindowDestroyed() {
@@ -1290,6 +1290,7 @@ void CefBrowserHostImpl::DestroyBrowser() {
if (menu_manager_.get())
menu_manager_->Destroy();
FOR_EACH_OBSERVER(Observer, observers_, OnBrowserDestroyed(this));
platform_delegate_->BrowserDestroyed(this);
while (!queued_messages_.empty()) {
@@ -1724,6 +1725,11 @@ void CefBrowserHostImpl::HandleKeyEventAfterTextInputClient(
void CefBrowserHostImpl::DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
const CefMouseEvent& event,
CefBrowserHost::DragOperationsMask allowed_ops) {
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
return;
}
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragTargetDragEnter, this, drag_data,
@@ -1736,11 +1742,6 @@ void CefBrowserHostImpl::DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
return;
}
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
return;
}
if (!web_contents())
return;
@@ -1749,6 +1750,11 @@ void CefBrowserHostImpl::DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
void CefBrowserHostImpl::DragTargetDragOver(const CefMouseEvent& event,
CefBrowserHost::DragOperationsMask allowed_ops) {
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
return;
}
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragTargetDragOver, this, event,
@@ -1756,11 +1762,6 @@ void CefBrowserHostImpl::DragTargetDragOver(const CefMouseEvent& event,
return;
}
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
return;
}
if (!web_contents())
return;
@@ -1768,14 +1769,14 @@ void CefBrowserHostImpl::DragTargetDragOver(const CefMouseEvent& event,
}
void CefBrowserHostImpl::DragTargetDragLeave() {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragTargetDragLeave, this));
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
return;
}
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragTargetDragLeave, this));
return;
}
@@ -1786,14 +1787,14 @@ void CefBrowserHostImpl::DragTargetDragLeave() {
}
void CefBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragTargetDrop, this, event));
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
return;
}
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragTargetDrop, this, event));
return;
}
@@ -1804,14 +1805,14 @@ void CefBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) {
}
void CefBrowserHostImpl::DragSourceSystemDragEnded() {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragSourceSystemDragEnded, this));
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
return;
}
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragSourceSystemDragEnded, this));
return;
}
@@ -1820,14 +1821,14 @@ void CefBrowserHostImpl::DragSourceSystemDragEnded() {
void CefBrowserHostImpl::DragSourceEndedAt(
int x, int y, CefBrowserHost::DragOperationsMask op) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragSourceEndedAt, this, x, y, op));
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
return;
}
if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled";
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragSourceEndedAt, this, x, y, op));
return;
}
@@ -2195,17 +2196,20 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
case content::MEDIA_ENUMERATE_DEVICES:
// Pick the desired device or fall back to the first available of the
// given type.
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request.requested_audio_device_id,
microphone_requested,
false,
&devices);
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request.requested_video_device_id,
false,
webcam_requested,
&devices);
if (microphone_requested) {
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request.requested_audio_device_id,
true,
false,
&devices);
}
if (webcam_requested) {
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request.requested_video_device_id,
false,
true,
&devices);
}
break;
}
}
@@ -2496,6 +2500,21 @@ bool CefBrowserHostImpl::Send(IPC::Message* message) {
}
}
void CefBrowserHostImpl::AddObserver(Observer* observer) {
CEF_REQUIRE_UIT();
observers_.AddObserver(observer);
}
void CefBrowserHostImpl::RemoveObserver(Observer* observer) {
CEF_REQUIRE_UIT();
observers_.RemoveObserver(observer);
}
bool CefBrowserHostImpl::HasObserver(Observer* observer) const {
CEF_REQUIRE_UIT();
return observers_.HasObserver(observer);
}
// content::WebContentsObserver::OnMessageReceived() message handlers.
// -----------------------------------------------------------------------------
@@ -2622,6 +2641,7 @@ CefBrowserHostImpl::CefBrowserHostImpl(
opener_(kNullWindowHandle),
request_context_(request_context),
platform_delegate_(std::move(platform_delegate)),
is_windowless_(platform_delegate_->IsWindowless()),
is_loading_(false),
can_go_back_(false),
can_go_forward_(false),

View File

@@ -24,6 +24,7 @@
#include "libcef/common/response_manager.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/notification_observer.h"
@@ -71,6 +72,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
virtual void OnResponse(const std::string& response) =0;
};
// Interface to implement for observers that wish to be informed of changes
// to the CefBrowserHostImpl. All methods will be called on the UI thread.
class Observer {
public:
// Called before |browser| is destroyed. Any references to |browser| should
// be cleared when this method is called.
virtual void OnBrowserDestroyed(CefBrowserHostImpl* browser) =0;
protected:
virtual ~Observer() {}
};
~CefBrowserHostImpl() override;
// Create a new CefBrowserHostImpl instance.
@@ -420,6 +433,13 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Override to provide a thread safe implementation.
bool Send(IPC::Message* message) override;
// Manage observer objects. The observer must either outlive this object or
// remove itself before destruction. These methods can only be called on the
// UI thread.
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
bool HasObserver(Observer* observer) const;
private:
class DevToolsWebContentsObserver;
@@ -500,6 +520,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefWindowHandle opener_;
CefRefPtr<CefRequestContext> request_context_;
scoped_ptr<CefBrowserPlatformDelegate> platform_delegate_;
const bool is_windowless_;
// Volatile state information. All access must be protected by the state lock.
base::Lock state_lock_;
@@ -570,6 +591,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
// destroyed.
CefDevToolsFrontend* devtools_frontend_;
// Observers that want to be notified of changes to this object.
base::ObserverList<Observer> observers_;
IMPLEMENT_REFCOUNTING(CefBrowserHostImpl);
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostImpl);
};

View File

@@ -18,6 +18,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/child_process_host.h"
#include "content/common/view_messages.h"
namespace {
@@ -102,16 +103,16 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
// that happens re-visit the implementation of this class.
DCHECK_EQ(host, main_frame_host->GetProcess());
const int render_process_routing_id = host->GetID();
const int render_process_id = host->GetID();
const int render_view_routing_id = view_host->GetRoutingID();
const int render_frame_routing_id = main_frame_host->GetRoutingID();
scoped_refptr<CefBrowserInfo> browser_info =
new CefBrowserInfo(++next_browser_id_, true);
browser_info->render_id_manager()->add_render_view_id(
render_process_routing_id, render_view_routing_id);
render_process_id, render_view_routing_id);
browser_info->render_id_manager()->add_render_frame_id(
render_process_routing_id, render_frame_routing_id);
render_process_id, render_frame_routing_id);
browser_info_list_.push_back(browser_info);
if (is_windowless)
@@ -122,11 +123,11 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
pending_new_browser_info_list_.begin();
for (; it != pending_new_browser_info_list_.end(); ++it) {
PendingNewBrowserInfo* info = *it;
if (info->host == host &&
if (info->render_process_id == render_process_id &&
info->render_view_routing_id == render_view_routing_id &&
info->render_frame_routing_id == render_frame_routing_id) {
SendNewBrowserInfoResponse(host, browser_info.get(), false,
info->reply_msg);
SendNewBrowserInfoResponse(render_process_id, browser_info.get(),
false, info->reply_msg);
pending_new_browser_info_list_.erase(it);
break;
@@ -137,15 +138,16 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
}
void CefBrowserInfoManager::OnCreateWindow(
content::RenderProcessHost* host,
int render_process_id,
const ViewHostMsg_CreateWindow_Params& params) {
DCHECK_NE(render_process_id, content::ChildProcessHost::kInvalidUniqueID);
DCHECK_GT(params.opener_id, 0);
DCHECK_GT(params.opener_render_frame_id, 0);
scoped_ptr<CefBrowserInfoManager::PendingPopup> pending_popup(
new CefBrowserInfoManager::PendingPopup);
pending_popup->step = CefBrowserInfoManager::PendingPopup::ON_CREATE_WINDOW;
pending_popup->opener_process_id = host->GetID();
pending_popup->opener_process_id = render_process_id;
pending_popup->opener_view_id = params.opener_id;
pending_popup->opener_frame_id = params.opener_render_frame_id;
pending_popup->target_url = params.target_url;
@@ -312,29 +314,28 @@ void CefBrowserInfoManager::WebContentsCreated(
}
void CefBrowserInfoManager::OnGetNewBrowserInfo(
content::RenderProcessHost* host,
int render_process_id,
int render_view_routing_id,
int render_frame_routing_id,
IPC::Message* reply_msg) {
DCHECK(host);
DCHECK_NE(render_process_id, content::ChildProcessHost::kInvalidUniqueID);
DCHECK_GT(render_view_routing_id, 0);
DCHECK_GT(render_frame_routing_id, 0);
DCHECK(reply_msg);
base::AutoLock lock_scope(browser_info_lock_);
const int render_process_routing_id = host->GetID();
bool is_guest_view = false;
scoped_refptr<CefBrowserInfo> browser_info = GetBrowserInfo(
render_process_routing_id, render_view_routing_id,
render_process_routing_id, render_frame_routing_id,
render_process_id, render_view_routing_id,
render_process_id, render_frame_routing_id,
&is_guest_view);
if (browser_info.get()) {
// Send the response immediately.
SendNewBrowserInfoResponse(host, browser_info.get(), is_guest_view,
reply_msg);
SendNewBrowserInfoResponse(render_process_id, browser_info.get(),
is_guest_view, reply_msg);
return;
}
@@ -345,7 +346,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
pending_new_browser_info_list_.begin();
for (; it != pending_new_browser_info_list_.end(); ++it) {
PendingNewBrowserInfo* info = *it;
if (info->host == host &&
if (info->render_process_id == render_process_id &&
info->render_view_routing_id == render_view_routing_id &&
info->render_frame_routing_id == render_frame_routing_id) {
NOTREACHED();
@@ -356,7 +357,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
// Queue the request.
scoped_ptr<PendingNewBrowserInfo> pending(new PendingNewBrowserInfo());
pending->host = host;
pending->render_process_id = render_process_id;
pending->render_view_routing_id = render_view_routing_id;
pending->render_frame_routing_id = render_frame_routing_id;
pending->reply_msg = reply_msg;
@@ -430,12 +431,14 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
content::RenderProcessHost* host) {
base::AutoLock lock_scope(browser_info_lock_);
const int render_process_id = host->GetID();
// Remove all pending requests that reference the destroyed host.
PendingNewBrowserInfoList::iterator it =
pending_new_browser_info_list_.begin();
while (it != pending_new_browser_info_list_.end()) {
PendingNewBrowserInfo* info = *it;
if (info->host == host)
if (info->render_process_id == render_process_id)
it = pending_new_browser_info_list_.erase(it);
else
++it;
@@ -445,10 +448,10 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
void CefBrowserInfoManager::FilterPendingPopupURL(
int render_process_id,
scoped_ptr<CefBrowserInfoManager::PendingPopup> pending_popup) {
content::RenderProcessHost* rph =
content::RenderProcessHost* host =
content::RenderProcessHost::FromID(render_process_id);
DCHECK(rph);
rph->FilterURL(false, &pending_popup->target_url);
DCHECK(host);
host->FilterURL(false, &pending_popup->target_url);
GetInstance()->PushPendingPopup(std::move(pending_popup));
}
@@ -541,10 +544,24 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
// static
void CefBrowserInfoManager::SendNewBrowserInfoResponse(
content::RenderProcessHost* host,
int render_process_id,
CefBrowserInfo* browser_info,
bool is_guest_view,
IPC::Message* reply_msg) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserInfoManager::SendNewBrowserInfoResponse,
render_process_id, browser_info, is_guest_view, reply_msg));
return;
}
content::RenderProcessHost* host =
content::RenderProcessHost::FromID(render_process_id);
if (!host) {
delete reply_msg;
return;
}
CefProcessHostMsg_GetNewBrowserInfo_Params params;
params.browser_id = browser_info->browser_id();
params.is_windowless = browser_info->is_windowless();

View File

@@ -60,7 +60,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Called from CefBrowserMessageFilter::OnCreateWindow. See comments on
// PendingPopup for more information.
void OnCreateWindow(content::RenderProcessHost* host,
void OnCreateWindow(int render_process_id,
const ViewHostMsg_CreateWindow_Params& params);
// Called from CefContentBrowserClient::CanCreateWindow. See comments on
@@ -103,7 +103,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// already exist for traditional popup browsers depending on timing. See
// comments on PendingPopup for more information.
void OnGetNewBrowserInfo(
content::RenderProcessHost* host,
int render_process_id,
int render_view_routing_id,
int render_frame_routing_id,
IPC::Message* reply_msg);
@@ -204,14 +204,14 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Send the response for a pending OnGetNewBrowserInfo request.
static void SendNewBrowserInfoResponse(
content::RenderProcessHost* host,
int render_process_id,
CefBrowserInfo* browser_info,
bool is_guest_view,
IPC::Message* reply_msg);
// Pending request for OnGetNewBrowserInfo.
struct PendingNewBrowserInfo {
content::RenderProcessHost* host;
int render_process_id;
int render_view_routing_id;
int render_frame_routing_id;
IPC::Message* reply_msg;

View File

@@ -1,4 +1,4 @@
/// Copyright (c) 2012 The Chromium Embedded Framework Authors.
// 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.
@@ -19,10 +19,10 @@
#include "content/common/frame_messages.h"
#include "content/common/view_messages.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/child_process_host.h"
CefBrowserMessageFilter::CefBrowserMessageFilter(
content::RenderProcessHost* host)
: host_(host),
CefBrowserMessageFilter::CefBrowserMessageFilter(int render_process_id)
: render_process_id_(render_process_id),
sender_(NULL) {
}
@@ -34,7 +34,7 @@ void CefBrowserMessageFilter::OnFilterAdded(IPC::Sender* sender) {
}
void CefBrowserMessageFilter::OnFilterRemoved() {
host_ = NULL;
render_process_id_ = content::ChildProcessHost::kInvalidUniqueID;
sender_ = NULL;
}
@@ -63,7 +63,21 @@ bool CefBrowserMessageFilter::OnMessageReceived(const IPC::Message& message) {
}
bool CefBrowserMessageFilter::Send(IPC::Message* message) {
return host_->Send(message);
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(base::IgnoreResult(&CefBrowserMessageFilter::Send), this,
message));
return true;
}
content::RenderProcessHost* host =
content::RenderProcessHost::FromID(render_process_id_);
if (!host) {
delete message;
return false;
}
return host->Send(message);
}
void CefBrowserMessageFilter::OnGetNewRenderThreadInfo(
@@ -87,17 +101,24 @@ void CefBrowserMessageFilter::OnGetNewBrowserInfo(
int render_view_routing_id,
int render_frame_routing_id,
IPC::Message* reply_msg) {
CefBrowserInfoManager::GetInstance()->OnGetNewBrowserInfo(
host_,
render_view_routing_id,
render_frame_routing_id,
reply_msg);
if (render_process_id_ != content::ChildProcessHost::kInvalidUniqueID) {
CefBrowserInfoManager::GetInstance()->OnGetNewBrowserInfo(
render_process_id_,
render_view_routing_id,
render_frame_routing_id,
reply_msg);
} else {
delete reply_msg;
}
}
void CefBrowserMessageFilter::OnCreateWindow(
const ViewHostMsg_CreateWindow_Params& params,
IPC::Message* reply_msg) {
CefBrowserInfoManager::GetInstance()->OnCreateWindow(host_, params);
if (render_process_id_ != content::ChildProcessHost::kInvalidUniqueID) {
CefBrowserInfoManager::GetInstance()->OnCreateWindow(render_process_id_,
params);
}
// Reply message is not used.
delete reply_msg;
@@ -111,11 +132,11 @@ void CefBrowserMessageFilter::OnFrameFocused(int32_t render_frame_routing_id) {
return;
}
if (!host_)
if (render_process_id_ == content::ChildProcessHost::kInvalidUniqueID)
return;
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForFrame(host_->GetID(),
CefBrowserHostImpl::GetBrowserForFrame(render_process_id_,
render_frame_routing_id);
if (browser.get())
browser->SetFocusedFrame(render_frame_routing_id);

View File

@@ -24,7 +24,7 @@ struct ViewHostMsg_CreateWindow_Params;
// This class sends and receives control messages on the browser process.
class CefBrowserMessageFilter : public IPC::MessageFilter {
public:
explicit CefBrowserMessageFilter(content::RenderProcessHost* host);
explicit CefBrowserMessageFilter(int render_process_id);
~CefBrowserMessageFilter() override;
// IPC::ChannelProxy::MessageFilter implementation.
@@ -46,7 +46,7 @@ class CefBrowserMessageFilter : public IPC::MessageFilter {
IPC::Message* reply_msg);
void OnFrameFocused(int32_t render_frame_routing_id);
content::RenderProcessHost* host_;
int render_process_id_;
IPC::Sender* sender_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserMessageFilter);

View File

@@ -434,7 +434,7 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
base::CommandLine::ForCurrentProcess();
const int id = host->GetID();
host->GetChannel()->AddFilter(new CefBrowserMessageFilter(host));
host->GetChannel()->AddFilter(new CefBrowserMessageFilter(id));
host->AddFilter(new printing::PrintingMessageFilter(id));
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {

View File

@@ -5,9 +5,6 @@
#include "libcef/browser/download_manager_delegate.h"
#include "include/cef_download_handler.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/context.h"
#include "libcef/browser/download_item_impl.h"
#include "libcef/browser/thread_util.h"
@@ -26,18 +23,8 @@ using content::DownloadItem;
using content::DownloadManager;
using content::WebContents;
namespace {
// Helper function to retrieve the CefBrowserHostImpl.
CefRefPtr<CefBrowserHostImpl> GetBrowser(DownloadItem* item) {
content::WebContents* contents = item->GetWebContents();
if (!contents)
return NULL;
return CefBrowserHostImpl::GetBrowserForContents(contents).get();
}
// Helper function to retrieve the CefDownloadHandler.
CefRefPtr<CefDownloadHandler> GetDownloadHandler(
CefRefPtr<CefBrowserHostImpl> browser) {
@@ -274,10 +261,8 @@ CefDownloadManagerDelegate::CefDownloadManagerDelegate(
DownloadManager::DownloadVector items;
manager->GetAllDownloads(&items);
DownloadManager::DownloadVector::const_iterator it = items.begin();
for (; it != items.end(); ++it) {
(*it)->AddObserver(this);
observing_.insert(*it);
}
for (; it != items.end(); ++it)
OnDownloadCreated(manager, *it);
}
CefDownloadManagerDelegate::~CefDownloadManagerDelegate() {
@@ -286,10 +271,8 @@ CefDownloadManagerDelegate::~CefDownloadManagerDelegate() {
manager_->RemoveObserver(this);
}
std::set<DownloadItem*>::const_iterator it = observing_.begin();
for (; it != observing_.end(); ++it)
(*it)->RemoveObserver(this);
observing_.clear();
while (!item_browser_map_.empty())
OnDownloadDestroyed(item_browser_map_.begin()->first);
}
void CefDownloadManagerDelegate::OnDownloadUpdated(
@@ -313,16 +296,52 @@ void CefDownloadManagerDelegate::OnDownloadUpdated(
}
void CefDownloadManagerDelegate::OnDownloadDestroyed(
DownloadItem* download) {
download->RemoveObserver(this);
observing_.erase(download);
DownloadItem* item) {
item->RemoveObserver(this);
CefBrowserHostImpl* browser = nullptr;
ItemBrowserMap::iterator it = item_browser_map_.find(item);
DCHECK(it != item_browser_map_.end());
if (it != item_browser_map_.end()) {
browser = it->second;
item_browser_map_.erase(it);
}
if (browser) {
// Determine if any remaining DownloadItems are associated with the same
// browser. If not, then unregister as an observer.
bool has_remaining = false;
ItemBrowserMap::const_iterator it2 = item_browser_map_.begin();
for (; it2 != item_browser_map_.end(); ++it2) {
if (it2->second == browser) {
has_remaining = true;
break;
}
}
if (!has_remaining)
browser->RemoveObserver(this);
}
}
void CefDownloadManagerDelegate::OnDownloadCreated(
DownloadManager* manager,
DownloadItem* item) {
item->AddObserver(this);
observing_.insert(item);
CefBrowserHostImpl* browser = nullptr;
content::WebContents* contents = item->GetWebContents();
if (contents)
browser = CefBrowserHostImpl::GetBrowserForContents(contents).get();
DCHECK(browser);
item_browser_map_.insert(std::make_pair(item, browser));
// Register as an observer so that we can cancel associated DownloadItems when
// the browser is destroyed.
if (!browser->HasObserver(this))
browser->AddObserver(this);
}
void CefDownloadManagerDelegate::ManagerGoingDown(
@@ -379,3 +398,26 @@ void CefDownloadManagerDelegate::GetNextId(
static uint32 next_id = DownloadItem::kInvalidId + 1;
callback.Run(next_id++);
}
void CefDownloadManagerDelegate::OnBrowserDestroyed(
CefBrowserHostImpl* browser) {
ItemBrowserMap::iterator it = item_browser_map_.begin();
for (; it != item_browser_map_.end(); ++it) {
if (it->second == browser) {
// Don't call back into browsers that have been destroyed. We're not
// canceling the download so it will continue silently until it completes
// or until the associated browser context is destroyed.
it->second = nullptr;
}
}
}
CefBrowserHostImpl* CefDownloadManagerDelegate::GetBrowser(DownloadItem* item) {
ItemBrowserMap::const_iterator it = item_browser_map_.find(item);
if (it != item_browser_map_.end())
return it->second;
// An entry should always exist for a DownloadItem.
NOTREACHED();
return nullptr;
}

View File

@@ -8,6 +8,8 @@
#include <set>
#include "libcef/browser/browser_host_impl.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/download_item.h"
@@ -17,15 +19,16 @@
class CefDownloadManagerDelegate
: public content::DownloadItem::Observer,
public content::DownloadManager::Observer,
public content::DownloadManagerDelegate {
public content::DownloadManagerDelegate,
public CefBrowserHostImpl::Observer {
public:
explicit CefDownloadManagerDelegate(content::DownloadManager* manager);
~CefDownloadManagerDelegate() override;
private:
// DownloadItem::Observer methods.
void OnDownloadUpdated(content::DownloadItem* download) override;
void OnDownloadDestroyed(content::DownloadItem* download) override;
void OnDownloadUpdated(content::DownloadItem* item) override;
void OnDownloadDestroyed(content::DownloadItem* item) override;
// DownloadManager::Observer methods.
void OnDownloadCreated(content::DownloadManager* manager,
@@ -38,9 +41,19 @@ class CefDownloadManagerDelegate
const content::DownloadTargetCallback& callback) override;
void GetNextId(const content::DownloadIdCallback& callback) override;
// CefBrowserHostImpl::Observer methods.
void OnBrowserDestroyed(CefBrowserHostImpl* browser) override;
CefBrowserHostImpl* GetBrowser(content::DownloadItem* item);
content::DownloadManager* manager_;
base::WeakPtrFactory<content::DownloadManager> manager_ptr_factory_;
std::set<content::DownloadItem*> observing_;
// Map of DownloadItem to originating CefBrowserHostImpl. Maintaining this
// map is necessary because DownloadItem::GetWebContents() may return NULL if
// the browser navigates while the download is in progress.
typedef std::map<content::DownloadItem*, CefBrowserHostImpl* > ItemBrowserMap;
ItemBrowserMap item_browser_map_;
DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate);
};

View File

@@ -126,6 +126,8 @@ void SetChromePrefs(CefBrowserContext* profile,
web.password_echo_enabled = browser_defaults::kPasswordEchoEnabled;
web.unified_textchecker_enabled = true;
web.uses_universal_detector =
prefs->GetBoolean(prefs::kWebKitUsesUniversalDetector);
web.text_areas_are_resizable =

View File

@@ -16,6 +16,9 @@
#include "base/prefs/pref_service.h"
#include "base/strings/stringprintf.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/browser/ssl_host_state_delegate.h"
#include "net/http/http_cache.h"
#include "net/http/http_transaction_factory.h"
using content::BrowserThread;
@@ -47,6 +50,30 @@ const char* GetTypeString(base::Value::Type type) {
return "UNKNOWN";
}
// Helper for HostResolver::Resolve.
struct ResolveHostHelper {
explicit ResolveHostHelper(CefRefPtr<CefResolveCallback> callback)
: callback_(callback) {
}
void OnResolveCompleted(int result) {
std::vector<CefString> resolved_ips;
net::AddressList::const_iterator iter = address_list_.begin();
for (; iter != address_list_.end(); ++iter)
resolved_ips.push_back(iter->ToStringWithoutPort());
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefResolveCallback::OnResolveCompleted, callback_.get(),
static_cast<cef_errorcode_t>(result), resolved_ips));
delete this;
}
CefRefPtr<CefResolveCallback> callback_;
net::AddressList address_list_;
};
} // namespace
@@ -444,6 +471,63 @@ bool CefRequestContextImpl::SetPreference(const CefString& name,
return true;
}
void CefRequestContextImpl::ClearCertificateExceptions(
CefRefPtr<CefCompletionCallback> callback) {
GetBrowserContext(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
base::Bind(&CefRequestContextImpl::ClearCertificateExceptionsInternal,
this, callback));
}
void CefRequestContextImpl::CloseAllConnections(
CefRefPtr<CefCompletionCallback> callback) {
GetRequestContextImpl(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
base::Bind(&CefRequestContextImpl::CloseAllConnectionsInternal, this,
callback));
}
void CefRequestContextImpl::ResolveHost(
const CefString& origin,
CefRefPtr<CefResolveCallback> callback) {
GetRequestContextImpl(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
base::Bind(&CefRequestContextImpl::ResolveHostInternal, this, origin,
callback));
}
cef_errorcode_t CefRequestContextImpl::ResolveHostCached(
const CefString& origin,
std::vector<CefString>& resolved_ips) {
resolved_ips.clear();
if (!CEF_CURRENTLY_ON_IOT()) {
NOTREACHED() << "called on invalid thread";
return ERR_FAILED;
}
if (!request_context_impl_)
return ERR_FAILED;
int retval = ERR_FAILED;
net::HostResolver* host_resolver = request_context_impl_->GetHostResolver();
if (host_resolver) {
net::HostResolver::RequestInfo request_info(
net::HostPortPair::FromURL(GURL(origin.ToString())));
net::AddressList address_list;
retval = host_resolver->ResolveFromCache(request_info, &address_list,
net::BoundNetLog());
if (retval == net::OK) {
net::AddressList::const_iterator iter = address_list.begin();
for (; iter != address_list.end(); ++iter)
resolved_ips.push_back(iter->ToString());
}
}
return static_cast<cef_errorcode_t>(retval);
}
CefRequestContextImpl::CefRequestContextImpl(
scoped_refptr<CefBrowserContext> browser_context)
: browser_context_(browser_context),
@@ -548,3 +632,71 @@ void CefRequestContextImpl::PurgePluginListCacheInternal(
content::PluginService::GetInstance()->PurgePluginListCache(
browser_context.get(), false);
}
void CefRequestContextImpl::ClearCertificateExceptionsInternal(
CefRefPtr<CefCompletionCallback> callback,
scoped_refptr<CefBrowserContext> browser_context) {
CEF_REQUIRE_UIT();
content::SSLHostStateDelegate* ssl_delegate =
browser_context->GetSSLHostStateDelegate();
if (ssl_delegate)
ssl_delegate->Clear();
if (callback) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefCompletionCallback::OnComplete, callback.get()));
}
}
void CefRequestContextImpl::CloseAllConnectionsInternal(
CefRefPtr<CefCompletionCallback> callback,
scoped_refptr<CefURLRequestContextGetterImpl> request_context) {
CEF_REQUIRE_IOT();
net::URLRequestContext* url_context = request_context->GetURLRequestContext();
if (url_context) {
net::HttpTransactionFactory* http_factory =
url_context->http_transaction_factory();
if (http_factory) {
net::HttpCache* cache = http_factory->GetCache();
if (cache)
cache->CloseAllConnections();
}
}
if (callback) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefCompletionCallback::OnComplete, callback.get()));
}
}
void CefRequestContextImpl::ResolveHostInternal(
const CefString& origin,
CefRefPtr<CefResolveCallback> callback,
scoped_refptr<CefURLRequestContextGetterImpl> request_context) {
CEF_REQUIRE_IOT();
int retval = ERR_FAILED;
// |helper| will be deleted in ResolveHostHelper::OnResolveCompleted().
ResolveHostHelper* helper = new ResolveHostHelper(callback);
net::HostResolver* host_resolver = request_context->GetHostResolver();
if (host_resolver) {
net::HostResolver::RequestInfo request_info(
net::HostPortPair::FromURL(GURL(origin.ToString())));
retval = host_resolver->Resolve(
request_info, net::DEFAULT_PRIORITY,
&helper->address_list_,
base::Bind(&ResolveHostHelper::OnResolveCompleted,
base::Unretained(helper)),
NULL, net::BoundNetLog());
if (retval == net::ERR_IO_PENDING) {
// The result will be delivered asynchronously via the callback.
return;
}
}
helper->OnResolveCompleted(retval);
}

View File

@@ -69,6 +69,15 @@ class CefRequestContextImpl : public CefRequestContext {
bool SetPreference(const CefString& name,
CefRefPtr<CefValue> value,
CefString& error) override;
void ClearCertificateExceptions(
CefRefPtr<CefCompletionCallback> callback) override;
void CloseAllConnections(CefRefPtr<CefCompletionCallback> callback) override;
void ResolveHost(
const CefString& origin,
CefRefPtr<CefResolveCallback> callback) override;
cef_errorcode_t ResolveHostCached(
const CefString& origin,
std::vector<CefString>& resolved_ips) override;
const CefRequestContextSettings& settings() const { return settings_; }
@@ -103,6 +112,16 @@ class CefRequestContextImpl : public CefRequestContext {
void PurgePluginListCacheInternal(
bool reload_pages,
scoped_refptr<CefBrowserContext> browser_context);
void ClearCertificateExceptionsInternal(
CefRefPtr<CefCompletionCallback> callback,
scoped_refptr<CefBrowserContext> browser_context);
void CloseAllConnectionsInternal(
CefRefPtr<CefCompletionCallback> callback,
scoped_refptr<CefURLRequestContextGetterImpl> request_context);
void ResolveHostInternal(
const CefString& origin,
CefRefPtr<CefResolveCallback> callback,
scoped_refptr<CefURLRequestContextGetterImpl> request_context);
scoped_refptr<CefBrowserContext> browser_context_;
CefRequestContextSettings settings_;

View File

@@ -147,25 +147,28 @@ blink::WebString FilePathStringToWebString(
// Read |headers| into |map|.
void GetHeaderMap(const net::HttpRequestHeaders& headers,
CefRequest::HeaderMap& map) {
map.clear();
if (headers.IsEmpty())
return;
net::HttpRequestHeaders::Iterator it(headers);
do {
while (it.GetNext()) {
const std::string& name = it.name();
// Do not include Referer in the header map.
if (!base::LowerCaseEqualsASCII(name, kReferrerLowerCase))
map.insert(std::make_pair(name, it.value()));
} while (it.GetNext());
};
}
// Read |request| into |map|. If a Referer value is specified populate
// |referrer|.
void GetHeaderMap(const blink::WebURLRequest& request,
CefRequest::HeaderMap& map,
CefString& referrer) {
map.clear();
class HeaderVisitor : public blink::WebHTTPHeaderVisitor {
public:
HeaderVisitor(CefRequest::HeaderMap* map, CefString* referrer)
@@ -195,6 +198,8 @@ void GetHeaderMap(const blink::WebURLRequest& request,
// Read |source| into |map|.
void GetHeaderMap(const CefRequest::HeaderMap& source,
CefRequest::HeaderMap& map) {
map.clear();
CefRequest::HeaderMap::const_iterator it = source.begin();
for (; it != source.end(); ++it) {
const CefString& name = it->first;

View File

@@ -16,7 +16,9 @@
#include "libcef_dll/cpptoc/value_cpptoc.h"
#include "libcef_dll/ctocpp/completion_callback_ctocpp.h"
#include "libcef_dll/ctocpp/request_context_handler_ctocpp.h"
#include "libcef_dll/ctocpp/resolve_callback_ctocpp.h"
#include "libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
@@ -350,6 +352,92 @@ int CEF_CALLBACK request_context_set_preference(
return _retval;
}
void CEF_CALLBACK request_context_clear_certificate_exceptions(
struct _cef_request_context_t* self, cef_completion_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Unverified params: callback
// Execute
CefRequestContextCppToC::Get(self)->ClearCertificateExceptions(
CefCompletionCallbackCToCpp::Wrap(callback));
}
void CEF_CALLBACK request_context_close_all_connections(
struct _cef_request_context_t* self, cef_completion_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Unverified params: callback
// Execute
CefRequestContextCppToC::Get(self)->CloseAllConnections(
CefCompletionCallbackCToCpp::Wrap(callback));
}
void CEF_CALLBACK request_context_resolve_host(
struct _cef_request_context_t* self, const cef_string_t* origin,
cef_resolve_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: origin; type: string_byref_const
DCHECK(origin);
if (!origin)
return;
// Verify param: callback; type: refptr_diff
DCHECK(callback);
if (!callback)
return;
// Execute
CefRequestContextCppToC::Get(self)->ResolveHost(
CefString(origin),
CefResolveCallbackCToCpp::Wrap(callback));
}
cef_errorcode_t CEF_CALLBACK request_context_resolve_host_cached(
struct _cef_request_context_t* self, const cef_string_t* origin,
cef_string_list_t resolved_ips) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return ERR_FAILED;
// Verify param: origin; type: string_byref_const
DCHECK(origin);
if (!origin)
return ERR_FAILED;
// Verify param: resolved_ips; type: string_vec_byref
DCHECK(resolved_ips);
if (!resolved_ips)
return ERR_FAILED;
// Translate param: resolved_ips; type: string_vec_byref
std::vector<CefString> resolved_ipsList;
transfer_string_list_contents(resolved_ips, resolved_ipsList);
// Execute
cef_errorcode_t _retval = CefRequestContextCppToC::Get(
self)->ResolveHostCached(
CefString(origin),
resolved_ipsList);
// Restore param: resolved_ips; type: string_vec_byref
cef_string_list_clear(resolved_ips);
transfer_string_list_contents(resolved_ipsList, resolved_ips);
// Return type: simple
return _retval;
}
} // namespace
@@ -374,6 +462,11 @@ CefRequestContextCppToC::CefRequestContextCppToC() {
GetStruct()->get_all_preferences = request_context_get_all_preferences;
GetStruct()->can_set_preference = request_context_can_set_preference;
GetStruct()->set_preference = request_context_set_preference;
GetStruct()->clear_certificate_exceptions =
request_context_clear_certificate_exceptions;
GetStruct()->close_all_connections = request_context_close_all_connections;
GetStruct()->resolve_host = request_context_resolve_host;
GetStruct()->resolve_host_cached = request_context_resolve_host_cached;
}
template<> CefRefPtr<CefRequestContext> CefCppToC<CefRequestContextCppToC,

View File

@@ -0,0 +1,64 @@
// Copyright (c) 2016 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/resolve_callback_cpptoc.h"
#include "libcef_dll/transfer_util.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK resolve_callback_on_resolve_completed(
struct _cef_resolve_callback_t* self, cef_errorcode_t result,
cef_string_list_t resolved_ips) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Unverified params: resolved_ips
// Translate param: resolved_ips; type: string_vec_byref_const
std::vector<CefString> resolved_ipsList;
transfer_string_list_contents(resolved_ips, resolved_ipsList);
// Execute
CefResolveCallbackCppToC::Get(self)->OnResolveCompleted(
result,
resolved_ipsList);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefResolveCallbackCppToC::CefResolveCallbackCppToC() {
GetStruct()->on_resolve_completed = resolve_callback_on_resolve_completed;
}
template<> CefRefPtr<CefResolveCallback> CefCppToC<CefResolveCallbackCppToC,
CefResolveCallback, cef_resolve_callback_t>::UnwrapDerived(
CefWrapperType type, cef_resolve_callback_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCppToC<CefResolveCallbackCppToC,
CefResolveCallback, cef_resolve_callback_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefResolveCallbackCppToC,
CefResolveCallback, cef_resolve_callback_t>::kWrapperType =
WT_RESOLVE_CALLBACK;

View File

@@ -0,0 +1,37 @@
// Copyright (c) 2016 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_RESOLVE_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_RESOLVE_CALLBACK_CPPTOC_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_request_context.h"
#include "include/capi/cef_request_context_capi.h"
#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 wrapper-side only.
class CefResolveCallbackCppToC
: public CefCppToC<CefResolveCallbackCppToC, CefResolveCallback,
cef_resolve_callback_t> {
public:
CefResolveCallbackCppToC();
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CPPTOC_RESOLVE_CALLBACK_CPPTOC_H_

View File

@@ -12,11 +12,13 @@
#include "libcef_dll/cpptoc/completion_callback_cpptoc.h"
#include "libcef_dll/cpptoc/request_context_handler_cpptoc.h"
#include "libcef_dll/cpptoc/resolve_callback_cpptoc.h"
#include "libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h"
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h"
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
#include "libcef_dll/ctocpp/value_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// STATIC METHODS - Body may be edited by hand.
@@ -325,6 +327,94 @@ bool CefRequestContextCToCpp::SetPreference(const CefString& name,
return _retval?true:false;
}
void CefRequestContextCToCpp::ClearCertificateExceptions(
CefRefPtr<CefCompletionCallback> callback) {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, clear_certificate_exceptions))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: callback
// Execute
_struct->clear_certificate_exceptions(_struct,
CefCompletionCallbackCppToC::Wrap(callback));
}
void CefRequestContextCToCpp::CloseAllConnections(
CefRefPtr<CefCompletionCallback> callback) {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, close_all_connections))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: callback
// Execute
_struct->close_all_connections(_struct,
CefCompletionCallbackCppToC::Wrap(callback));
}
void CefRequestContextCToCpp::ResolveHost(const CefString& origin,
CefRefPtr<CefResolveCallback> callback) {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, resolve_host))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: origin; type: string_byref_const
DCHECK(!origin.empty());
if (origin.empty())
return;
// Verify param: callback; type: refptr_diff
DCHECK(callback.get());
if (!callback.get())
return;
// Execute
_struct->resolve_host(_struct,
origin.GetStruct(),
CefResolveCallbackCppToC::Wrap(callback));
}
cef_errorcode_t CefRequestContextCToCpp::ResolveHostCached(
const CefString& origin, std::vector<CefString>& resolved_ips) {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, resolve_host_cached))
return ERR_FAILED;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: origin; type: string_byref_const
DCHECK(!origin.empty());
if (origin.empty())
return ERR_FAILED;
// Translate param: resolved_ips; type: string_vec_byref
cef_string_list_t resolved_ipsList = cef_string_list_alloc();
DCHECK(resolved_ipsList);
if (resolved_ipsList)
transfer_string_list_contents(resolved_ips, resolved_ipsList);
// Execute
cef_errorcode_t _retval = _struct->resolve_host_cached(_struct,
origin.GetStruct(),
resolved_ipsList);
// Restore param:resolved_ips; type: string_vec_byref
if (resolved_ipsList) {
resolved_ips.clear();
transfer_string_list_contents(resolved_ipsList, resolved_ips);
cef_string_list_free(resolved_ipsList);
}
// Return type: simple
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.

View File

@@ -18,6 +18,7 @@
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include <vector>
#include "include/cef_request_context.h"
#include "include/capi/cef_request_context_capi.h"
#include "include/cef_scheme.h"
@@ -52,6 +53,13 @@ class CefRequestContextCToCpp
bool CanSetPreference(const CefString& name) OVERRIDE;
bool SetPreference(const CefString& name, CefRefPtr<CefValue> value,
CefString& error) OVERRIDE;
void ClearCertificateExceptions(
CefRefPtr<CefCompletionCallback> callback) OVERRIDE;
void CloseAllConnections(CefRefPtr<CefCompletionCallback> callback) OVERRIDE;
void ResolveHost(const CefString& origin,
CefRefPtr<CefResolveCallback> callback) OVERRIDE;
cef_errorcode_t ResolveHostCached(const CefString& origin,
std::vector<CefString>& resolved_ips) OVERRIDE;
};
#endif // USING_CEF_SHARED

View File

@@ -0,0 +1,65 @@
// Copyright (c) 2016 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/resolve_callback_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefResolveCallbackCToCpp::OnResolveCompleted(cef_errorcode_t result,
const std::vector<CefString>& resolved_ips) {
cef_resolve_callback_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_resolve_completed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: resolved_ips
// Translate param: resolved_ips; type: string_vec_byref_const
cef_string_list_t resolved_ipsList = cef_string_list_alloc();
DCHECK(resolved_ipsList);
if (resolved_ipsList)
transfer_string_list_contents(resolved_ips, resolved_ipsList);
// Execute
_struct->on_resolve_completed(_struct,
result,
resolved_ipsList);
// Restore param:resolved_ips; type: string_vec_byref_const
if (resolved_ipsList)
cef_string_list_free(resolved_ipsList);
}
// CONSTRUCTOR - Do not edit by hand.
CefResolveCallbackCToCpp::CefResolveCallbackCToCpp() {
}
template<> cef_resolve_callback_t* CefCToCpp<CefResolveCallbackCToCpp,
CefResolveCallback, cef_resolve_callback_t>::UnwrapDerived(
CefWrapperType type, CefResolveCallback* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCToCpp<CefResolveCallbackCToCpp,
CefResolveCallback, cef_resolve_callback_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefResolveCallbackCToCpp,
CefResolveCallback, cef_resolve_callback_t>::kWrapperType =
WT_RESOLVE_CALLBACK;

View File

@@ -0,0 +1,42 @@
// Copyright (c) 2016 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_RESOLVE_CALLBACK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_RESOLVE_CALLBACK_CTOCPP_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include <vector>
#include "include/cef_request_context.h"
#include "include/capi/cef_request_context_capi.h"
#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 DLL-side only.
class CefResolveCallbackCToCpp
: public CefCToCpp<CefResolveCallbackCToCpp, CefResolveCallback,
cef_resolve_callback_t> {
public:
CefResolveCallbackCToCpp();
// CefResolveCallback methods.
void OnResolveCompleted(cef_errorcode_t result,
const std::vector<CefString>& resolved_ips) override;
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_RESOLVE_CALLBACK_CTOCPP_H_

View File

@@ -102,6 +102,7 @@
#include "libcef_dll/ctocpp/render_handler_ctocpp.h"
#include "libcef_dll/ctocpp/render_process_handler_ctocpp.h"
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
#include "libcef_dll/ctocpp/resolve_callback_ctocpp.h"
#include "libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h"
#include "libcef_dll/ctocpp/resource_handler_ctocpp.h"
#include "libcef_dll/ctocpp/response_filter_ctocpp.h"
@@ -247,6 +248,7 @@ CEF_EXPORT void cef_shutdown() {
&CefRenderProcessHandlerCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefRequestCallbackCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefRequestHandlerCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefResolveCallbackCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(
&CefResourceBundleHandlerCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefResourceHandlerCToCpp::DebugObjCt));

View File

@@ -60,6 +60,7 @@
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
#include "libcef_dll/cpptoc/render_process_handler_cpptoc.h"
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
#include "libcef_dll/cpptoc/resolve_callback_cpptoc.h"
#include "libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h"
#include "libcef_dll/cpptoc/resource_handler_cpptoc.h"
#include "libcef_dll/cpptoc/response_filter_cpptoc.h"
@@ -239,6 +240,7 @@ CEF_GLOBAL void CefShutdown() {
&CefRenderProcessHandlerCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefRequestCallbackCToCpp::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefRequestHandlerCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefResolveCallbackCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(
&CefResourceBundleHandlerCppToC::DebugObjCt));
DCHECK(base::AtomicRefCountIsZero(&CefResourceHandlerCppToC::DebugObjCt));

View File

@@ -76,6 +76,7 @@ enum CefWrapperType {
WT_REQUEST_CONTEXT,
WT_REQUEST_CONTEXT_HANDLER,
WT_REQUEST_HANDLER,
WT_RESOLVE_CALLBACK,
WT_RESOURCE_BUNDLE,
WT_RESOURCE_BUNDLE_HANDLER,
WT_RESOURCE_HANDLER,

View File

@@ -246,4 +246,28 @@ patches = [
'name': 'net_filter_515',
'path': '../net/',
},
{
# Fix Linux compile error due to EVENTS_X_EXPORT usage.
# https://bugs.chromium.org/p/chromium/issues/detail?id=589608
'name': 'events_x_utils',
'path': '../ui/events/x/',
},
{
# Fix overlay scroll bar color on dark backgrounds
# https://bugs.chromium.org/p/chromium/issues/detail?id=588709
'name': 'webkit_overlay_scrollbar_color_588709',
'path': '../third_party/WebKit/',
},
{
# Fix building with the Windows 8.1 SDK. Revert:
# https://codereview.chromium.org/1783123003
'name': 'win_util_1783123003',
'path': '../base/win/',
},
{
# Fix incorrect initialization of WebCursor object.
# https://bitbucket.org/chromiumembedded/cef/issues/1894
'name': 'webcursor_1894',
'path': '../content/common/cursors/',
},
]

View File

@@ -1,5 +1,5 @@
diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc
index 6d4a181..952a058 100644
index 9240afb..fb4734b 100644
--- render_widget_host_view_guest.cc
+++ render_widget_host_view_guest.cc
@@ -218,6 +218,9 @@ void RenderWidgetHostViewGuest::Destroy() {

View File

@@ -1,8 +1,8 @@
diff --git web_contents_impl.cc web_contents_impl.cc
index ccadfb2..b70b8e4 100644
index b5b0b78..2ee9174 100644
--- web_contents_impl.cc
+++ web_contents_impl.cc
@@ -1388,32 +1388,40 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
@@ -1373,32 +1373,40 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
main_frame_widget_routing_id);
frame_tree_.root()->SetFrameName(params.main_frame_name);
@@ -62,7 +62,7 @@ index ccadfb2..b70b8e4 100644
CHECK(render_view_host_delegate_view_);
CHECK(view_.get());
@@ -1835,11 +1843,14 @@ void WebContentsImpl::CreateNewWindow(
@@ -1820,11 +1828,14 @@ void WebContentsImpl::CreateNewWindow(
static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace);
CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context));
@@ -78,7 +78,7 @@ index ccadfb2..b70b8e4 100644
if (route_id != MSG_ROUTING_NONE &&
!RenderViewHost::FromID(render_process_id, route_id)) {
// If the embedder didn't create a WebContents for this route, we need to
@@ -1860,6 +1871,8 @@ void WebContentsImpl::CreateNewWindow(
@@ -1845,6 +1856,8 @@ void WebContentsImpl::CreateNewWindow(
create_params.opener_render_process_id = render_process_id;
create_params.opener_render_frame_id = params.opener_render_frame_id;
create_params.opener_suppressed = params.opener_suppressed;

View File

@@ -1,5 +1,5 @@
diff --git common.gypi common.gypi
index 514b129..036fe51 100644
index 2063a6c..282cd0d 100644
--- common.gypi
+++ common.gypi
@@ -9,6 +9,9 @@

View File

@@ -1,8 +1,8 @@
diff --git ui/browser.cc ui/browser.cc
index 717381d..35f791b 100644
index 45656f3..d5fb838 100644
--- ui/browser.cc
+++ ui/browser.cc
@@ -1707,7 +1707,9 @@ bool Browser::ShouldCreateWebContents(
@@ -1708,7 +1708,9 @@ bool Browser::ShouldCreateWebContents(
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,

View File

@@ -39,10 +39,10 @@ index 45686b5..18548a0 100644
// Returns true if we should fork a new process for the given navigation.
// If |send_referrer| is set to false (which is the default), no referrer
diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc
index 9b199d3..1a8b6fa 100644
index 7aeebd2..8c779db 100644
--- renderer/render_frame_impl.cc
+++ renderer/render_frame_impl.cc
@@ -4684,7 +4684,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
@@ -4687,7 +4687,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
(pending_navigation_params_ &&
!pending_navigation_params_->request_params.redirects.empty());
@@ -50,7 +50,7 @@ index 9b199d3..1a8b6fa 100644
// The handlenavigation API is deprecated and will be removed once
// crbug.com/325351 is resolved.
if (info.urlRequest.url() != GURL(kSwappedOutURL) &&
@@ -4694,7 +4693,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
@@ -4697,7 +4696,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
is_redirect)) {
return blink::WebNavigationPolicyIgnore;
}

View File

@@ -0,0 +1,13 @@
diff --git events_x_utils.h events_x_utils.h
index 15c4e38..592417ce 100644
--- events_x_utils.h
+++ events_x_utils.h
@@ -80,7 +80,7 @@ EVENTS_X_EXPORT bool GetFlingDataFromXEvent(const XEvent& xev,
float* vy_ordinal,
bool* is_cancel);
-EVENTS_X_EXPORT void ResetTimestampRolloverCountersForTesting();
+void ResetTimestampRolloverCountersForTesting();
} // namespace ui

View File

@@ -1,8 +1,8 @@
diff --git input_method_win.cc input_method_win.cc
index 56bbac1..3265c64 100644
index 6604c6d..70981dc 100644
--- input_method_win.cc
+++ input_method_win.cc
@@ -588,8 +588,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
@@ -586,8 +586,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
// receiving keyboard input as long as it is an active window. This works well
// even when the |attached_window_handle| becomes active but has not received
// WM_FOCUS yet.

View File

@@ -1,8 +1,8 @@
diff --git public/common/common_param_traits_macros.h public/common/common_param_traits_macros.h
index a9811c4..a43f9d1 100644
index a1917f5..765fe1c 100644
--- public/common/common_param_traits_macros.h
+++ public/common/common_param_traits_macros.h
@@ -193,6 +193,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
@@ -195,6 +195,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
IPC_STRUCT_TRAITS_MEMBER(main_frame_resizes_are_orientation_changes)
IPC_STRUCT_TRAITS_MEMBER(initialize_at_minimum_page_scale)
IPC_STRUCT_TRAITS_MEMBER(smart_insert_delete_enabled)
@@ -11,31 +11,31 @@ index a9811c4..a43f9d1 100644
IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop)
IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled)
diff --git public/common/web_preferences.cc public/common/web_preferences.cc
index 4a83a70..98781c0 100644
index 68ccbb4..8460874 100644
--- public/common/web_preferences.cc
+++ public/common/web_preferences.cc
@@ -171,6 +171,7 @@ WebPreferences::WebPreferences()
@@ -172,6 +172,7 @@ WebPreferences::WebPreferences()
pinch_overlay_scrollbar_thickness(0),
use_solid_color_scrollbars(false),
navigate_on_drag_drop(true),
+ base_background_color(0xFFFFFFFF), // Color::white
v8_cache_options(V8_CACHE_OPTIONS_DEFAULT),
inert_visual_viewport(false),
cookie_enabled(true),
pepper_accelerated_video_decode_enabled(false),
diff --git public/common/web_preferences.h public/common/web_preferences.h
index de5a3c5..afdf03f 100644
index b784443..b04d69f 100644
--- public/common/web_preferences.h
+++ public/common/web_preferences.h
@@ -172,6 +172,7 @@ struct CONTENT_EXPORT WebPreferences {
@@ -173,6 +173,7 @@ struct CONTENT_EXPORT WebPreferences {
int pinch_overlay_scrollbar_thickness;
bool use_solid_color_scrollbars;
bool navigate_on_drag_drop;
+ uint32_t base_background_color;
V8CacheOptions v8_cache_options;
bool inert_visual_viewport;
// This flags corresponds to a Page's Settings' setCookieEnabled state. It
diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc
index 8e6b887..77ef5ad 100644
index c2c266c..0a88250 100644
--- renderer/render_view_impl.cc
+++ renderer/render_view_impl.cc
@@ -938,6 +938,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,

View File

@@ -150,10 +150,10 @@ index ad82485..13e74b9 100644
// a reference.
corewm::TooltipWin* tooltip_;
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index f7495f0..3d9b9a2 100644
index e2fb724..c4bf33d 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -168,6 +168,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
@@ -167,6 +167,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
use_native_frame_(false),
should_maximize_after_map_(false),
use_argb_visual_(false),
@@ -161,17 +161,17 @@ index f7495f0..3d9b9a2 100644
drag_drop_client_(NULL),
native_widget_delegate_(native_widget_delegate),
desktop_native_widget_aura_(desktop_native_widget_aura),
@@ -177,7 +178,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
@@ -175,7 +176,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
custom_window_shape_(false),
urgency_hint_set_(false),
activatable_(true),
modal_dialog_xid_(0),
- close_widget_factory_(this) {
+ close_widget_factory_(this),
+ xwindow_destroyed_(false) {
}
DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() {
@@ -388,7 +390,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
@@ -386,7 +388,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
// Actually free our native resources.
if (ui::PlatformEventSource::GetInstance())
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
@@ -181,7 +181,7 @@ index f7495f0..3d9b9a2 100644
xwindow_ = None;
desktop_native_widget_aura_->OnHostClosed();
@@ -537,6 +540,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement(
@@ -535,6 +538,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement(
}
gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const {
@@ -190,7 +190,7 @@ index f7495f0..3d9b9a2 100644
return ToDIPRect(bounds_in_pixels_);
}
@@ -974,6 +979,8 @@ void DesktopWindowTreeHostX11::HideImpl() {
@@ -972,6 +977,8 @@ void DesktopWindowTreeHostX11::HideImpl() {
}
gfx::Rect DesktopWindowTreeHostX11::GetBounds() const {
@@ -199,7 +199,7 @@ index f7495f0..3d9b9a2 100644
return bounds_in_pixels_;
}
@@ -1031,6 +1038,8 @@ void DesktopWindowTreeHostX11::SetBounds(
@@ -1029,6 +1036,8 @@ void DesktopWindowTreeHostX11::SetBounds(
}
gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const {
@@ -208,7 +208,7 @@ index f7495f0..3d9b9a2 100644
return bounds_in_pixels_.origin();
}
@@ -1139,9 +1148,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
@@ -1137,9 +1146,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
use_argb_visual_ = true;
}
@@ -225,7 +225,7 @@ index f7495f0..3d9b9a2 100644
bounds_in_pixels_.y(), bounds_in_pixels_.width(),
bounds_in_pixels_.height(),
0, // border width
@@ -1770,6 +1785,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
@@ -1767,6 +1782,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
}
break;
}
@@ -237,12 +237,12 @@ index f7495f0..3d9b9a2 100644
if (xev->xfocus.mode != NotifyGrab) {
ReleaseCapture();
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
index 1036152..7b2b426 100644
index 759194f..13af979 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
@@ -98,6 +98,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
// there is no dialog on the host window.
XID GetModalDialog();
@@ -87,6 +87,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
// internal list of open windows.
static void CleanUpWindowList(void (*func)(aura::Window* window));
+ void set_screen_bounds(const gfx::Rect& bounds) { screen_bounds_ = bounds; }
+
@@ -253,7 +253,7 @@ index 1036152..7b2b426 100644
protected:
// Overridden from DesktopWindowTreeHost:
void Init(aura::Window* content_window,
@@ -274,6 +280,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
@@ -263,6 +269,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
// The bounds of |xwindow_|.
gfx::Rect bounds_in_pixels_;
@@ -263,7 +263,7 @@ index 1036152..7b2b426 100644
// Whenever the bounds are set, we keep the previous set of bounds around so
// we can have a better chance of getting the real
// |restored_bounds_in_pixels_|. Window managers tend to send a Configure
@@ -310,6 +319,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
@@ -299,6 +308,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
// Whether we used an ARGB visual for our window.
bool use_argb_visual_;
@@ -274,7 +274,7 @@ index 1036152..7b2b426 100644
DesktopDragDropClientAuraX11* drag_drop_client_;
scoped_ptr<ui::EventHandler> x11_non_client_event_filter_;
@@ -366,6 +379,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
@@ -351,6 +364,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_;
@@ -285,7 +285,7 @@ index 1036152..7b2b426 100644
};
diff --git ui/views/widget/desktop_aura/x11_desktop_handler.cc ui/views/widget/desktop_aura/x11_desktop_handler.cc
index 9b20295..20b1aec 100644
index 5ab84f9..c4095fa 100644
--- ui/views/widget/desktop_aura/x11_desktop_handler.cc
+++ ui/views/widget/desktop_aura/x11_desktop_handler.cc
@@ -31,6 +31,30 @@ views::X11DesktopHandler* g_handler = NULL;
@@ -346,7 +346,7 @@ index 9b20295..20b1aec 100644
x_active_window_ = None;
}
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
index 18aa4c6..147c5a7 100644
index 02a570db6..2225c88 100644
--- ui/views/widget/widget.cc
+++ ui/views/widget/widget.cc
@@ -126,6 +126,7 @@ Widget::InitParams::InitParams()

View File

@@ -0,0 +1,20 @@
diff --git webcursor_aurawin.cc webcursor_aurawin.cc
index b8b4c57..69fe05e 100644
--- webcursor_aurawin.cc
+++ webcursor_aurawin.cc
@@ -37,6 +37,7 @@ ui::PlatformCursor WebCursor::GetPlatformCursor() {
void WebCursor::InitPlatformData() {
custom_cursor_ = NULL;
+ device_scale_factor_ = 1.0f;
}
bool WebCursor::SerializePlatformData(base::Pickle* pickle) const {
@@ -59,6 +60,7 @@ void WebCursor::CleanupPlatformData() {
}
void WebCursor::CopyPlatformData(const WebCursor& other) {
+ device_scale_factor_ = other.device_scale_factor_;
}
} // namespace content

View File

@@ -0,0 +1,219 @@
diff --git Source/core/frame/FrameView.cpp Source/core/frame/FrameView.cpp
index dcfefc8..4e82cc7 100644
--- Source/core/frame/FrameView.cpp
+++ Source/core/frame/FrameView.cpp
@@ -357,24 +357,6 @@ void FrameView::invalidateAllCustomScrollbarsOnActiveChanged()
recalculateCustomScrollbarStyle();
}
-void FrameView::recalculateScrollbarOverlayStyle()
-{
- ScrollbarOverlayStyle oldOverlayStyle = scrollbarOverlayStyle();
- ScrollbarOverlayStyle overlayStyle = ScrollbarOverlayStyleDefault;
-
- Color backgroundColor = documentBackgroundColor();
- // Reduce the background color from RGB to a lightness value
- // and determine which scrollbar style to use based on a lightness
- // heuristic.
- double hue, saturation, lightness;
- backgroundColor.getHSL(hue, saturation, lightness);
- if (lightness <= .5)
- overlayStyle = ScrollbarOverlayStyleLight;
-
- if (oldOverlayStyle != overlayStyle)
- setScrollbarOverlayStyle(overlayStyle);
-}
-
void FrameView::clear()
{
reset();
@@ -1834,7 +1816,7 @@ void FrameView::setBaseBackgroundColor(const Color& backgroundColor)
if (compositedLayerMapping->mainGraphicsLayer())
compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay();
}
- recalculateScrollbarOverlayStyle();
+ recalculateScrollbarOverlayStyle(documentBackgroundColor());
}
void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool transparent)
diff --git Source/core/frame/FrameView.h Source/core/frame/FrameView.h
index 09d6cb6..113a7b9 100644
--- Source/core/frame/FrameView.h
+++ Source/core/frame/FrameView.h
@@ -152,7 +152,6 @@ public:
void detachScrollbars();
void recalculateCustomScrollbarStyle();
void invalidateAllCustomScrollbarsOnActiveChanged();
- virtual void recalculateScrollbarOverlayStyle();
void clear();
diff --git Source/core/layout/LayoutBox.cpp Source/core/layout/LayoutBox.cpp
index 596df85..1519d5c 100644
--- Source/core/layout/LayoutBox.cpp
+++ Source/core/layout/LayoutBox.cpp
@@ -248,7 +248,7 @@ void LayoutBox::styleDidChange(StyleDifference diff, const ComputedStyle* oldSty
}
if (isDocumentElement() || isBody()) {
- document().view()->recalculateScrollbarOverlayStyle();
+ document().view()->recalculateScrollbarOverlayStyle(document().view()->documentBackgroundColor());
document().view()->recalculateCustomScrollbarStyle();
if (LayoutView* layoutView = view()) {
if (PaintLayerScrollableArea* scrollableArea = layoutView->scrollableArea()) {
diff --git Source/core/paint/PaintLayerScrollableArea.cpp Source/core/paint/PaintLayerScrollableArea.cpp
index fbca377..74eddd1 100644
--- Source/core/paint/PaintLayerScrollableArea.cpp
+++ Source/core/paint/PaintLayerScrollableArea.cpp
@@ -827,6 +827,19 @@ void PaintLayerScrollableArea::updateAfterStyleChange(const ComputedStyle* oldSt
updateScrollCornerStyle();
updateResizerAreaSet();
updateResizerStyle();
+
+ // Whenever background changes on the scrollable element, the scroll bar
+ // overlay style might need to be changed to have contrast against the
+ // background.
+ Color oldBackground;
+ if (oldStyle) {
+ oldBackground = oldStyle->visitedDependentColor(CSSPropertyBackgroundColor);
+ }
+ Color newBackground = box().style()->visitedDependentColor(CSSPropertyBackgroundColor);
+
+ if (newBackground != oldBackground) {
+ recalculateScrollbarOverlayStyle(newBackground);
+ }
}
bool PaintLayerScrollableArea::updateAfterCompositingChange()
@@ -1463,9 +1476,14 @@ void PaintLayerScrollableArea::ScrollbarManager::setHasHorizontalScrollbar(bool
// This doesn't hit in any tests, but since the equivalent code in setHasVerticalScrollbar
// does, presumably this code does as well.
DisableCompositingQueryAsserts disabler;
- if (!m_hBar)
+ if (!m_hBar) {
m_hBar = createScrollbar(HorizontalScrollbar);
- m_hBarIsAttached = 1;
+ m_hBarIsAttached = 1;
+ if (!m_hBar->isCustomScrollbar())
+ m_scrollableArea->didAddScrollbar(*m_hBar, HorizontalScrollbar);
+ } else {
+ m_hBarIsAttached = 1;
+ }
} else {
m_hBarIsAttached = 0;
if (!m_canDetachScrollbars)
@@ -1477,9 +1495,14 @@ void PaintLayerScrollableArea::ScrollbarManager::setHasVerticalScrollbar(bool ha
{
if (hasScrollbar) {
DisableCompositingQueryAsserts disabler;
- if (!m_vBar)
+ if (!m_vBar) {
m_vBar = createScrollbar(VerticalScrollbar);
- m_vBarIsAttached = 1;
+ m_vBarIsAttached = 1;
+ if (!m_vBar->isCustomScrollbar())
+ m_scrollableArea->didAddScrollbar(*m_vBar, VerticalScrollbar);
+ } else {
+ m_vBarIsAttached = 1;
+ }
} else {
m_vBarIsAttached = 0;
if (!m_canDetachScrollbars)
@@ -1500,10 +1523,6 @@ PassRefPtrWillBeRawPtr<Scrollbar> PaintLayerScrollableArea::ScrollbarManager::cr
if (actualLayoutObject.styleRef().hasAppearance())
scrollbarSize = LayoutTheme::theme().scrollbarControlSizeForPart(actualLayoutObject.styleRef().appearance());
scrollbar = Scrollbar::create(m_scrollableArea.get(), orientation, scrollbarSize, &m_scrollableArea->box().frame()->page()->chromeClient());
- if (orientation == HorizontalScrollbar)
- m_scrollableArea->didAddScrollbar(*scrollbar, HorizontalScrollbar);
- else
- m_scrollableArea->didAddScrollbar(*scrollbar, VerticalScrollbar);
}
m_scrollableArea->box().document().view()->addChild(scrollbar.get());
return scrollbar.release();
diff --git Source/platform/scroll/ScrollableArea.cpp Source/platform/scroll/ScrollableArea.cpp
index 98cf0470..bacdd5d 100644
--- Source/platform/scroll/ScrollableArea.cpp
+++ Source/platform/scroll/ScrollableArea.cpp
@@ -396,15 +396,32 @@ void ScrollableArea::setScrollbarOverlayStyle(ScrollbarOverlayStyle overlayStyle
if (Scrollbar* scrollbar = horizontalScrollbar()) {
ScrollbarTheme::theme().updateScrollbarOverlayStyle(*scrollbar);
- setScrollbarNeedsPaintInvalidation(HorizontalScrollbar);
+ scrollbar->setNeedsPaintInvalidation(AllParts);
}
if (Scrollbar* scrollbar = verticalScrollbar()) {
ScrollbarTheme::theme().updateScrollbarOverlayStyle(*scrollbar);
- setScrollbarNeedsPaintInvalidation(VerticalScrollbar);
+ scrollbar->setNeedsPaintInvalidation(AllParts);
}
}
+void ScrollableArea::recalculateScrollbarOverlayStyle(Color backgroundColor)
+{
+ ScrollbarOverlayStyle oldOverlayStyle = scrollbarOverlayStyle();
+ ScrollbarOverlayStyle overlayStyle = ScrollbarOverlayStyleDefault;
+
+ // Reduce the background color from RGB to a lightness value
+ // and determine which scrollbar style to use based on a lightness
+ // heuristic.
+ double hue, saturation, lightness;
+ backgroundColor.getHSL(hue, saturation, lightness);
+ if (lightness <= .5)
+ overlayStyle = ScrollbarOverlayStyleLight;
+
+ if (oldOverlayStyle != overlayStyle)
+ setScrollbarOverlayStyle(overlayStyle);
+}
+
void ScrollableArea::setScrollbarNeedsPaintInvalidation(ScrollbarOrientation orientation)
{
if (orientation == HorizontalScrollbar) {
diff --git Source/platform/scroll/ScrollableArea.h Source/platform/scroll/ScrollableArea.h
index 49b5b39..9940924 100644
--- Source/platform/scroll/ScrollableArea.h
+++ Source/platform/scroll/ScrollableArea.h
@@ -29,6 +29,7 @@
#include "platform/PlatformExport.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/geometry/DoublePoint.h"
+#include "platform/graphics/Color.h"
#include "platform/heap/Handle.h"
#include "platform/scroll/ScrollAnimatorBase.h"
#include "platform/scroll/ScrollTypes.h"
@@ -122,6 +123,7 @@ public:
bool hasOverlayScrollbars() const;
void setScrollbarOverlayStyle(ScrollbarOverlayStyle);
+ void recalculateScrollbarOverlayStyle(Color);
ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<ScrollbarOverlayStyle>(m_scrollbarOverlayStyle); }
// This getter will create a ScrollAnimatorBase if it doesn't already exist.
diff --git Source/platform/scroll/ScrollableAreaTest.cpp Source/platform/scroll/ScrollableAreaTest.cpp
index 87f1f60..33b33fa 100644
--- Source/platform/scroll/ScrollableAreaTest.cpp
+++ Source/platform/scroll/ScrollableAreaTest.cpp
@@ -4,6 +4,7 @@
#include "platform/scroll/ScrollableArea.h"
+#include "platform/graphics/Color.h"
#include "platform/graphics/GraphicsLayer.h"
#include "platform/scroll/ScrollbarTheme.h"
#include "platform/scroll/ScrollbarThemeMock.h"
@@ -168,4 +169,15 @@ TEST_F(ScrollableAreaTest, ScrollbarGraphicsLayerInvalidation)
EXPECT_TRUE(graphicsLayer.hasTrackedPaintInvalidations());
}
+TEST_F(ScrollableAreaTest, RecalculatesScrollbarOverlayIfBackgroundChanges)
+{
+ OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::create(IntPoint(0, 100));
+
+ EXPECT_EQ(ScrollbarOverlayStyleDefault, scrollableArea->scrollbarOverlayStyle());
+ scrollableArea->recalculateScrollbarOverlayStyle(Color(34, 85, 51));
+ EXPECT_EQ(ScrollbarOverlayStyleLight, scrollableArea->scrollbarOverlayStyle());
+ scrollableArea->recalculateScrollbarOverlayStyle(Color(236, 143, 185));
+ EXPECT_EQ(ScrollbarOverlayStyleDefault, scrollableArea->scrollbarOverlayStyle());
+}
+
} // namespace blink

View File

@@ -12,7 +12,7 @@ index e728623..e0f051e 100644
ASSERT(RuntimeEnabledFeatures::pagePopupEnabled());
diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp
index 416f9d8..43934e3 100644
index 16dba7f..35d685b 100644
--- Source/web/WebViewImpl.cpp
+++ Source/web/WebViewImpl.cpp
@@ -476,6 +476,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
@@ -23,7 +23,7 @@ index 416f9d8..43934e3 100644
, m_doingDragAndDrop(false)
, m_ignoreInputEvents(false)
, m_compositorDeviceScaleFactorOverride(0)
@@ -4138,9 +4139,14 @@ void WebViewImpl::pageScaleFactorChanged()
@@ -4146,9 +4147,14 @@ void WebViewImpl::pageScaleFactorChanged()
m_client->pageScaleFactorChanged();
}

View File

@@ -0,0 +1,159 @@
diff --git win_util.cc win_util.cc
index 85612a2..57bee8a 100644
--- win_util.cc
+++ win_util.cc
@@ -12,20 +12,13 @@
#include <shlobj.h>
#include <shobjidl.h> // Must be before propkey.
#include <initguid.h>
-#include <inspectable.h>
#include <propkey.h>
#include <propvarutil.h>
-#include <psapi.h>
-#include <roapi.h>
#include <sddl.h>
#include <setupapi.h>
#include <signal.h>
#include <stddef.h>
#include <stdlib.h>
-#include <uiviewsettingsinterop.h>
-#include <windows.ui.viewmanagement.h>
-#include <winstring.h>
-#include <wrl/wrappers/corewrappers.h>
#include "base/base_switches.h"
#include "base/command_line.h"
@@ -39,7 +32,6 @@
#include "base/threading/thread_restrictions.h"
#include "base/win/registry.h"
#include "base/win/scoped_co_mem.h"
-#include "base/win/scoped_comptr.h"
#include "base/win/scoped_handle.h"
#include "base/win/scoped_propvariant.h"
#include "base/win/windows_version.h"
@@ -114,82 +106,6 @@ POWER_PLATFORM_ROLE GetPlatformRole() {
return PowerDeterminePlatformRoleEx(POWER_PLATFORM_ROLE_V2);
}
-// Uses the Windows 10 WRL API's to query the current system state. The API's
-// we are using in the function below are supported in Win32 apps as per msdn.
-// It looks like the API implementation is buggy at least on Surface 4 causing
-// it to always return UserInteractionMode_Touch which as per documentation
-// indicates tablet mode.
-bool IsWindows10TabletDevice() {
- if (GetVersion() < VERSION_WIN10)
- return false;
-
- using RoGetActivationFactoryFunction = decltype(&RoGetActivationFactory);
- using WindowsCreateStringFunction = decltype(&WindowsCreateString);
-
- static RoGetActivationFactoryFunction get_factory = nullptr;
- static WindowsCreateStringFunction create_string = nullptr;
-
- if (!get_factory) {
- DCHECK_EQ(create_string, static_cast<WindowsCreateStringFunction>(
- nullptr));
-
- HMODULE combase_dll = ::LoadLibrary(L"combase.dll");
- if (!combase_dll)
- return false;
-
- get_factory = reinterpret_cast<RoGetActivationFactoryFunction>(
- ::GetProcAddress(combase_dll, "RoGetActivationFactory"));
- if (!get_factory) {
- CHECK(false);
- return false;
- }
-
- create_string = reinterpret_cast<WindowsCreateStringFunction>(
- ::GetProcAddress(combase_dll, "WindowsCreateString"));
- if (!create_string) {
- CHECK(false);
- return false;
- }
- }
-
- HRESULT hr = E_FAIL;
- // This HSTRING is allocated on the heap and is leaked.
- static HSTRING view_settings_guid = NULL;
- if (!view_settings_guid) {
- hr = create_string(
- RuntimeClass_Windows_UI_ViewManagement_UIViewSettings,
- static_cast<UINT32>(
- wcslen(RuntimeClass_Windows_UI_ViewManagement_UIViewSettings)),
- &view_settings_guid);
- if (FAILED(hr))
- return false;
- }
-
- base::win::ScopedComPtr<IUIViewSettingsInterop> view_settings_interop;
- hr = get_factory(view_settings_guid,
- __uuidof(IUIViewSettingsInterop),
- view_settings_interop.ReceiveVoid());
- if (FAILED(hr))
- return false;
-
- base::win::ScopedComPtr<ABI::Windows::UI::ViewManagement::IUIViewSettings>
- view_settings;
- // TODO(ananta)
- // Avoid using GetForegroundWindow here and pass in the HWND of the window
- // intiating the request to display the keyboard.
- hr = view_settings_interop->GetForWindow(
- ::GetForegroundWindow(),
- __uuidof(ABI::Windows::UI::ViewManagement::IUIViewSettings),
- view_settings.ReceiveVoid());
- if (FAILED(hr))
- return false;
-
- ABI::Windows::UI::ViewManagement::UserInteractionMode mode =
- ABI::Windows::UI::ViewManagement::UserInteractionMode_Mouse;
- view_settings->get_UserInteractionMode(&mode);
- return mode == ABI::Windows::UI::ViewManagement::UserInteractionMode_Touch;
-}
-
} // namespace
// Returns true if a physical keyboard is detected on Windows 8 and up.
@@ -224,11 +140,10 @@ bool IsKeyboardPresentOnSlate(std::string* reason) {
}
}
- // If it is a tablet device we assume that there is no keyboard attached.
if (IsTabletDevice(reason)) {
if (reason)
*reason += "Tablet device.\n";
- return false;
+ return true;
} else {
if (reason) {
*reason += "Not a tablet device";
@@ -475,9 +390,6 @@ bool IsTabletDevice(std::string* reason) {
return false;
}
- if (IsWindows10TabletDevice())
- return true;
-
if (GetSystemMetrics(SM_MAXIMUMTOUCHES) == 0) {
if (reason) {
*reason += "Device does not support touch.\n";
@@ -501,9 +413,8 @@ bool IsTabletDevice(std::string* reason) {
bool slate_power_profile = (role == PlatformRoleSlate);
bool is_tablet = false;
- bool is_tablet_pc = false;
+
if (mobile_power_profile || slate_power_profile) {
- is_tablet_pc = !GetSystemMetrics(SM_TABLETPC);
is_tablet = !GetSystemMetrics(SM_CONVERTIBLESLATEMODE);
if (!is_tablet) {
if (reason) {
@@ -521,7 +432,7 @@ bool IsTabletDevice(std::string* reason) {
if (reason)
*reason += "Device role is not mobile or slate.\n";
}
- return is_tablet && is_tablet_pc;
+ return is_tablet;
}
bool DisplayVirtualKeyboard() {

View File

@@ -9,24 +9,31 @@
#include "base/files/scoped_temp_dir.h"
#include "include/cef_scheme.h"
#include "include/wrapper/cef_closure_task.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "tests/unittests/test_handler.h"
namespace {
const char kTestDomain[] = "test-download";
const char kTestEntryUrl[] = "http://test-download/test.html";
const char kTestDownloadUrl[] = "http://test-download/download.txt";
const char kTestDomain[] = "test-download.com";
const char kTestEntryUrl[] = "http://test-download.com/test.html";
const char kTestDownloadUrl[] = "http://test-download.com/download.txt";
const char kTestNavUrl[] = "http://test-download-nav.com/nav.html";
const char kTestFileName[] = "download_test.txt";
const char kTestContentDisposition[] =
"attachment; filename=\"download_test.txt\"";
const char kTestMimeType[] = "text/plain";
const char kTestContent[] = "Download test text";
typedef base::Callback<void(CefRefPtr<CefCallback>/*callback*/)> DelayCallback;
class DownloadSchemeHandler : public CefResourceHandler {
public:
explicit DownloadSchemeHandler(TrackCallback* got_download_request)
: got_download_request_(got_download_request),
DownloadSchemeHandler(const DelayCallback& delay_callback,
TrackCallback* got_download_request)
: delay_callback_(delay_callback),
got_download_request_(got_download_request),
should_delay_(false),
offset_(0) {}
bool ProcessRequest(CefRefPtr<CefRequest> request,
@@ -40,6 +47,7 @@ class DownloadSchemeHandler : public CefResourceHandler {
content_ = kTestContent;
mime_type_ = kTestMimeType;
content_disposition_ = kTestContentDisposition;
should_delay_ = true;
} else {
EXPECT_TRUE(false); // Not reached.
return false;
@@ -70,9 +78,16 @@ class DownloadSchemeHandler : public CefResourceHandler {
int bytes_to_read,
int& bytes_read,
CefRefPtr<CefCallback> callback) override {
bool has_data = false;
bytes_read = 0;
if (should_delay_ && !delay_callback_.is_null()) {
// Delay the download response a single time.
delay_callback_.Run(callback);
delay_callback_.Reset();
return true;
}
bool has_data = false;
size_t size = content_.size();
if (offset_ < size) {
int transfer_size =
@@ -91,7 +106,9 @@ class DownloadSchemeHandler : public CefResourceHandler {
}
private:
DelayCallback delay_callback_;
TrackCallback* got_download_request_;
bool should_delay_;
std::string content_;
std::string mime_type_;
std::string content_disposition_;
@@ -102,18 +119,21 @@ class DownloadSchemeHandler : public CefResourceHandler {
class DownloadSchemeHandlerFactory : public CefSchemeHandlerFactory {
public:
explicit DownloadSchemeHandlerFactory(TrackCallback* got_download_request)
: got_download_request_(got_download_request) {}
DownloadSchemeHandlerFactory(const DelayCallback& delay_callback,
TrackCallback* got_download_request)
: delay_callback_(delay_callback),
got_download_request_(got_download_request) {}
CefRefPtr<CefResourceHandler> Create(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& scheme_name,
CefRefPtr<CefRequest> request) override {
return new DownloadSchemeHandler(got_download_request_);
return new DownloadSchemeHandler(delay_callback_, got_download_request_);
}
private:
DelayCallback delay_callback_;
TrackCallback* got_download_request_;
IMPLEMENT_REFCOUNTING(DownloadSchemeHandlerFactory);
@@ -121,16 +141,34 @@ class DownloadSchemeHandlerFactory : public CefSchemeHandlerFactory {
class DownloadTestHandler : public TestHandler {
public:
DownloadTestHandler() {}
enum TestMode {
NORMAL,
NAVIGATED,
PENDING,
};
DownloadTestHandler(TestMode test_mode)
: test_mode_(test_mode) {}
void RunTest() override {
DelayCallback delay_callback;
if (test_mode_ == NAVIGATED || test_mode_ == PENDING)
delay_callback = base::Bind(&DownloadTestHandler::OnDelayCallback, this);
CefRegisterSchemeHandlerFactory("http", kTestDomain,
new DownloadSchemeHandlerFactory(&got_download_request_));
new DownloadSchemeHandlerFactory(delay_callback,
&got_download_request_));
// Create a new temporary directory.
EXPECT_TRUE(temp_dir_.CreateUniqueTempDir());
test_path_ = temp_dir_.path().AppendASCII(kTestFileName);
if (test_mode_ == NAVIGATED) {
// Add the resource that we'll navigate to.
AddResource(kTestNavUrl, "<html><body>Navigated</body></html>",
"text/html");
}
// Create the browser
CreateBrowser(kTestEntryUrl);
@@ -141,10 +179,51 @@ class DownloadTestHandler : public TestHandler {
void OnLoadEnd(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int httpStatusCode) override {
EXPECT_STREQ(kTestEntryUrl, frame->GetURL().ToString().c_str());
const std::string& url = frame->GetURL().ToString();
if (url == kTestEntryUrl) {
// Begin the download.
browser->GetHost()->StartDownload(kTestDownloadUrl);
} else if (url == kTestNavUrl) {
got_nav_load_.yes();
ContinueNavigatedIfReady();
}
}
// Begin the download.
browser->GetHost()->StartDownload(kTestDownloadUrl);
// Callback from the scheme handler when the download request is delayed.
void OnDelayCallback(CefRefPtr<CefCallback> callback) {
if (!CefCurrentlyOn(TID_UI)) {
CefPostTask(TID_UI,
base::Bind(&DownloadTestHandler::OnDelayCallback, this, callback));
return;
}
got_delay_callback_.yes();
if (test_mode_ == NAVIGATED) {
delay_callback_ = callback;
ContinueNavigatedIfReady();
} else if (test_mode_ == PENDING) {
ContinuePendingIfReady();
} else {
EXPECT_TRUE(false); // Not reached.
}
}
void ContinueNavigatedIfReady() {
DCHECK_EQ(test_mode_, NAVIGATED);
if (got_delay_callback_ && got_nav_load_) {
delay_callback_->Continue();
delay_callback_ = nullptr;
}
}
void ContinuePendingIfReady() {
DCHECK_EQ(test_mode_, PENDING);
if (got_delay_callback_ && got_on_before_download_ &&
got_on_download_updated_) {
// Destroy the test without waiting for the download to complete.
DestroyTest();
}
}
void OnBeforeDownload(
@@ -179,6 +258,11 @@ class DownloadTestHandler : public TestHandler {
EXPECT_STREQ(kTestMimeType, download_item->GetMimeType().ToString().c_str());
callback->Continue(test_path_.value(), false);
if (test_mode_ == NAVIGATED)
browser->GetMainFrame()->LoadURL(kTestNavUrl);
else if (test_mode_ == PENDING)
ContinuePendingIfReady();
}
void OnDownloadUpdated(
@@ -215,6 +299,8 @@ class DownloadTestHandler : public TestHandler {
}
if (download_item->IsComplete()) {
got_download_complete_.yes();
EXPECT_FALSE(download_item->IsInProgress());
EXPECT_EQ(100, download_item->GetPercentComplete());
EXPECT_EQ(static_cast<int64>(sizeof(kTestContent)-1),
@@ -227,6 +313,9 @@ class DownloadTestHandler : public TestHandler {
EXPECT_TRUE(download_item->IsInProgress());
EXPECT_LE(0LL, download_item->GetReceivedBytes());
}
if (test_mode_ == PENDING)
ContinuePendingIfReady();
}
void DestroyTest() override {
@@ -235,12 +324,24 @@ class DownloadTestHandler : public TestHandler {
EXPECT_TRUE(got_download_request_);
EXPECT_TRUE(got_on_before_download_);
EXPECT_TRUE(got_on_download_updated_);
EXPECT_TRUE(got_full_path_);
// Verify the file contents.
std::string contents;
EXPECT_TRUE(base::ReadFileToString(test_path_, &contents));
EXPECT_STREQ(kTestContent, contents.c_str());
if (test_mode_ == NAVIGATED)
EXPECT_TRUE(got_nav_load_);
else
EXPECT_FALSE(got_nav_load_);
if (test_mode_ == PENDING) {
EXPECT_FALSE(got_download_complete_);
EXPECT_FALSE(got_full_path_);
} else {
EXPECT_TRUE(got_download_complete_);
EXPECT_TRUE(got_full_path_);
// Verify the file contents.
std::string contents;
EXPECT_TRUE(base::ReadFileToString(test_path_, &contents));
EXPECT_STREQ(kTestContent, contents.c_str());
}
EXPECT_TRUE(temp_dir_.Delete());
@@ -248,6 +349,11 @@ class DownloadTestHandler : public TestHandler {
}
private:
const TestMode test_mode_;
// Used with NAVIGATED test mode.
CefRefPtr<CefCallback> delay_callback_;
base::ScopedTempDir temp_dir_;
base::FilePath test_path_;
uint32 download_id_;
@@ -256,15 +362,35 @@ class DownloadTestHandler : public TestHandler {
TrackCallback got_on_before_download_;
TrackCallback got_on_download_updated_;
TrackCallback got_full_path_;
TrackCallback got_download_complete_;
TrackCallback got_delay_callback_;
TrackCallback got_nav_load_;
IMPLEMENT_REFCOUNTING(DownloadTestHandler);
};
} // namespace
// Verify that downloads work.
// Test a basic download.
TEST(DownloadTest, Download) {
CefRefPtr<DownloadTestHandler> handler = new DownloadTestHandler();
CefRefPtr<DownloadTestHandler> handler =
new DownloadTestHandler(DownloadTestHandler::NORMAL);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}
// Test where the download completes after cross-origin navigation.
TEST(DownloadTest, DownloadNavigated) {
CefRefPtr<DownloadTestHandler> handler =
new DownloadTestHandler(DownloadTestHandler::NAVIGATED);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}
// Test where the download is still pending when the browser is destroyed.
TEST(DownloadTest, DownloadPending) {
CefRefPtr<DownloadTestHandler> handler =
new DownloadTestHandler(DownloadTestHandler::PENDING);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}

View File

@@ -650,3 +650,193 @@ TEST(RequestContextTest, NoReferrerLinkDifferentOrigin) {
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}
namespace {
const char kResolveOrigin[] = "http://www.google.com";
class MethodTestHandler : public TestHandler {
public:
enum Method {
METHOD_CLEAR_CERTIFICATE_EXCEPTIONS,
METHOD_CLOSE_ALL_CONNECTIONS,
METHOD_RESOLVE_HOST,
};
class CompletionCallback : public CefCompletionCallback,
public CefResolveCallback {
public:
CompletionCallback(MethodTestHandler* test_handler,
CefRefPtr<CefBrowser> browser)
: test_handler_(test_handler),
browser_(browser) {
}
~CompletionCallback() override {
EXPECT_UI_THREAD();
// OnComplete should be executed.
EXPECT_FALSE(test_handler_);
}
void OnComplete() override {
EXPECT_UI_THREAD();
// OnComplete should be executed only one time.
EXPECT_TRUE(test_handler_);
test_handler_->OnCompleteCallback(browser_);
test_handler_ = nullptr;
browser_ = nullptr;
}
void OnResolveCompleted(
cef_errorcode_t result,
const std::vector<CefString>& resolved_ips) override {
EXPECT_EQ(ERR_NONE, result);
EXPECT_TRUE(!resolved_ips.empty());
OnComplete();
}
private:
MethodTestHandler* test_handler_;
CefRefPtr<CefBrowser> browser_;
IMPLEMENT_REFCOUNTING(CompletionCallback);
};
MethodTestHandler(bool global_context,
Method method)
: global_context_(global_context),
method_(method) {
}
void RunTest() override {
const char kUrl[] = "http://tests/method.html";
AddResource(kUrl, "<html><body>Method</body></html>", "text/html");
CefRefPtr<CefRequestContext> request_context;
if (!global_context_) {
CefRequestContextSettings settings;
request_context = CefRequestContext::CreateContext(settings, nullptr);
}
CreateBrowser(kUrl, request_context);
// Time out the test after a reasonable period of time.
SetTestTimeout();
}
void OnLoadEnd(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int httpStatusCode) override {
CefRefPtr<CefRequestContext> context =
browser->GetHost()->GetRequestContext();
CefRefPtr<CompletionCallback> callback =
new CompletionCallback(this, browser);
if (method_ == METHOD_CLEAR_CERTIFICATE_EXCEPTIONS)
context->ClearCertificateExceptions(callback);
else if (method_ == METHOD_CLOSE_ALL_CONNECTIONS)
context->CloseAllConnections(callback);
else if (method_ == METHOD_RESOLVE_HOST)
context->ResolveHost(kResolveOrigin, callback);
}
void OnCompleteCallback(CefRefPtr<CefBrowser> browser) {
EXPECT_UI_THREAD();
EXPECT_FALSE(got_completion_callback_);
got_completion_callback_.yes();
if (method_ == METHOD_RESOLVE_HOST) {
// Now try a cached request.
CefPostTask(TID_IO,
base::Bind(&MethodTestHandler::ResolveHostCached, this, browser));
} else {
DestroyTest();
}
}
void ResolveHostCached(CefRefPtr<CefBrowser> browser) {
EXPECT_IO_THREAD();
CefRefPtr<CefRequestContext> context =
browser->GetHost()->GetRequestContext();
std::vector<CefString> resolved_ips;
cef_errorcode_t result =
context->ResolveHostCached(kResolveOrigin, resolved_ips);
EXPECT_EQ(ERR_NONE, result);
EXPECT_TRUE(!resolved_ips.empty());
CefPostTask(TID_UI, base::Bind(&MethodTestHandler::DestroyTest, this));
}
private:
void DestroyTest() override {
EXPECT_TRUE(got_completion_callback_);
TestHandler::DestroyTest();
}
const bool global_context_;
const Method method_;
TrackCallback got_completion_callback_;
IMPLEMENT_REFCOUNTING(MethodTestHandler);
};
} // namespace
// Test CefRequestContext::ClearCertificateExceptions with the global context.
TEST(RequestContextTest, ClearCertificateExceptionsGlobal) {
CefRefPtr<MethodTestHandler> handler =
new MethodTestHandler(true,
MethodTestHandler::METHOD_CLEAR_CERTIFICATE_EXCEPTIONS);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}
// Test CefRequestContext::ClearCertificateExceptions with a custom context.
TEST(RequestContextTest, ClearCertificateExceptionsCustom) {
CefRefPtr<MethodTestHandler> handler =
new MethodTestHandler(false,
MethodTestHandler::METHOD_CLEAR_CERTIFICATE_EXCEPTIONS);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}
// Test CefRequestContext::CloseAllConnections with the global context.
TEST(RequestContextTest, CloseAllConnectionsGlobal) {
CefRefPtr<MethodTestHandler> handler =
new MethodTestHandler(true,
MethodTestHandler::METHOD_CLOSE_ALL_CONNECTIONS);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}
// Test CefRequestContext::CloseAllConnections with a custom context.
TEST(RequestContextTest, CloseAllConnectionsCustom) {
CefRefPtr<MethodTestHandler> handler =
new MethodTestHandler(false,
MethodTestHandler::METHOD_CLOSE_ALL_CONNECTIONS);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}
// Test CefRequestContext::ResolveHost with the global context.
TEST(RequestContextTest, ResolveHostGlobal) {
CefRefPtr<MethodTestHandler> handler =
new MethodTestHandler(true,
MethodTestHandler::METHOD_RESOLVE_HOST);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}
// Test CefRequestContext::ResolveHost with a custom context.
TEST(RequestContextTest, ResolveHostCustom) {
CefRefPtr<MethodTestHandler> handler =
new MethodTestHandler(false,
MethodTestHandler::METHOD_RESOLVE_HOST);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}

View File

@@ -8,11 +8,15 @@
#include "tests/unittests/test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
void TestMapEqual(CefRequest::HeaderMap& map1,
CefRequest::HeaderMap& map2,
void TestMapEqual(const CefRequest::HeaderMap& map1,
const CefRequest::HeaderMap& map2,
bool allowExtras) {
if (!allowExtras)
EXPECT_EQ(map1.size(), map2.size());
TestMapNoDuplicates(map1);
TestMapNoDuplicates(map2);
CefRequest::HeaderMap::const_iterator it1, it2;
for (it1 = map1.begin(); it1 != map1.end(); ++it1) {
@@ -25,6 +29,17 @@ void TestMapEqual(CefRequest::HeaderMap& map1,
}
}
void TestMapNoDuplicates(const CefRequest::HeaderMap& map) {
CefRequest::HeaderMap::const_iterator it1 = map.begin();
for (; it1 != map.end(); ++it1) {
CefRequest::HeaderMap::const_iterator it2 = it1;
for (++it2; it2 != map.end(); ++it2) {
EXPECT_FALSE(it1->first == it2->first && it1->second == it2->second) <<
"Duplicate entry for " << it1->first << ": " << it1->second;
}
}
}
void TestPostDataElementEqual(CefRefPtr<CefPostDataElement> elem1,
CefRefPtr<CefPostDataElement> elem2) {
EXPECT_TRUE(elem1.get());

View File

@@ -14,10 +14,13 @@
// Test that CefRequest::HeaderMap objects are equal
// If |allowExtras| is true then additional header fields will be allowed in
// |map2|.
void TestMapEqual(CefRequest::HeaderMap& map1,
CefRequest::HeaderMap& map2,
void TestMapEqual(const CefRequest::HeaderMap& map1,
const CefRequest::HeaderMap& map2,
bool allowExtras);
// Test that the CefRequest::HeaderMap object contains no duplicate entries.
void TestMapNoDuplicates(const CefRequest::HeaderMap& map);
// Test that CefPostDataElement objects are equal
void TestPostDataElementEqual(CefRefPtr<CefPostDataElement> elem1,
CefRefPtr<CefPostDataElement> elem2);

View File

@@ -168,6 +168,21 @@ def get_comment(body, name):
result.reverse()
return result
def validate_comment(file, name, comment):
""" Validate the comment array returned by get_comment(). """
# Verify that the comment contains beginning and ending '///' as required by
# CppDoc (the leading '//' from each line will already have been removed by
# the get_comment() logic). There may be additional comments proceeding the
# CppDoc block so we look at the quantity of lines equaling '/' and expect
# the last line to be '/'.
docct = 0
for line in comment:
if not line is None and len(line) > 0 and line == '/':
docct = docct + 1
if docct != 2 or len(comment) < 3 or comment[len(comment)-1] != '/':
raise Exception('Missing or incorrect comment in %s for: %s' % \
(file, name))
def format_comment(comment, indent, translate_map = None, maxchars = 80):
""" Return the comments array as a formatted string. """
result = ''
@@ -550,6 +565,7 @@ class obj_header:
# build the global function objects
for attrib, retval, argval in list:
comment = get_comment(data, retval+'('+argval+');')
validate_comment(filename, retval, comment)
self.funcs.append(obj_function(self, filename, attrib, retval,
argval, comment))
@@ -574,6 +590,7 @@ class obj_header:
# build the class objects
for attrib, name, parent_name, body in list:
comment = get_comment(data, name+' : public')
validate_comment(filename, name, comment)
self.classes.append(
obj_class(self, filename, attrib, name, parent_name, body,
comment, includes, forward_declares))
@@ -754,6 +771,7 @@ class obj_class:
self.staticfuncs = []
for attrib, retval, argval in list:
comment = get_comment(body, retval+'('+argval+')')
validate_comment(filename, retval, comment)
self.staticfuncs.append(
obj_function_static(self, attrib, retval, argval, comment))
@@ -767,6 +785,7 @@ class obj_class:
self.virtualfuncs = []
for attrib, retval, argval, vfmod in list:
comment = get_comment(body, retval+'('+argval+')')
validate_comment(filename, retval, comment)
self.virtualfuncs.append(
obj_function_virtual(self, attrib, retval, argval, comment,
vfmod))

View File

@@ -45,7 +45,7 @@ install_name_tool and a path relative to @executable_path.
The "cefclient Helper" app is used for executing separate processes (renderer,
plugin, etc) with different characteristics. It needs to have a separate app
bundle and Info.plist files so that, among other things, it does not show dock
bundle and Info.plist file so that, among other things, it doesnt show dock
icons.
Required components:

View File

@@ -25,9 +25,8 @@ Release Contains libcef.dll, libcef.lib and other components required to
executable and will be copied there as part of the build process.
Resources Contains resources required by libcef.dll. By default these files
should be placed in the same directory as libcef.dll. By default
these files should be placed in the same directory as libcef.dll
and will be copied there as part of the build process.
should be placed in the same directory as libcef.dll and will be
copied there as part of the build process.
USAGE

View File

@@ -12,7 +12,7 @@ set CPPDOC_REV="%1"
if not exist %CPPDOC_EXE% (
echo ERROR: Please install CppDoc from http://www.cppdoc.com/
) else (
%CPPDOC_EXE% -overwrite -title="CEF3 C++ API Docs - Revision %CPPDOC_REV%" -footer="<center><a href="http://code.google.com/p/chromiumembedded" target="_top">Chromium Embedded Framework (CEF)</a> Copyright &copy 2012 Marshall A. Greenblatt</center>" -namespace-as-project -comment-format="///;//;///" -classdir=projects -module="cppdoc-standard" -extensions=h -languages="c=cpp,cc=cpp,cpp=cpp,cs=csharp,cxx=cpp,h=cpp,hpp=cpp,hxx=cpp,java=java" -D"OS_WIN" -D"USING_CEF_SHARED" -D"__cplusplus" -D"CEF_STRING_TYPE_UTF16" -enable-author=false -enable-deprecations=true -enable-since=true -enable-version=false -file-links-for-globals=false -generate-deprecations-list=false -generate-hierarchy=true -header-background-dark="#ccccff" -header-background-light="#eeeeff" -include-private=false -include-protected=true -index-file-base=index -overview-html=overview.html -reduce-summary-font=true -selected-text-background=navy -selected-text-foreground=white -separate-index-pages=false -show-cppdoc-version=false -show-timestamp=false -summary-html=project.html -suppress-details=false -suppress-frames-links=false -table-background=white -wrap-long-lines=false ..\include #cef_runnable.h #cef_tuple.h #capi "..\docs\index.html"
%CPPDOC_EXE% -overwrite -title="CEF3 C++ API Docs - Revision %CPPDOC_REV%" -footer="<center><a href="https://bitbucket.org/chromiumembedded/cef" target="_top">Chromium Embedded Framework (CEF)</a> Copyright &copy 2016 Marshall A. Greenblatt</center>" -namespace-as-project -comment-format="///;//;///" -classdir=projects -module="cppdoc-standard" -extensions=h -languages="c=cpp,cc=cpp,cpp=cpp,cs=csharp,cxx=cpp,h=cpp,hpp=cpp,hxx=cpp,java=java" -D"OS_WIN" -D"USING_CEF_SHARED" -D"__cplusplus" -D"CEF_STRING_TYPE_UTF16" -enable-author=false -enable-deprecations=true -enable-since=true -enable-version=false -file-links-for-globals=false -generate-deprecations-list=false -generate-hierarchy=true -header-background-dark="#ccccff" -header-background-light="#eeeeff" -include-private=false -include-protected=true -index-file-base=index -overview-html=overview.html -reduce-summary-font=true -selected-text-background=navy -selected-text-foreground=white -separate-index-pages=false -show-cppdoc-version=false -show-timestamp=false -summary-html=project.html -suppress-details=false -suppress-frames-links=false -table-background=white -wrap-long-lines=false ..\include #cef_runnable.h #cef_tuple.h #capi "..\docs\index.html"
)
endlocal

View File

@@ -454,7 +454,7 @@ if platform == 'windows':
if mode == 'standard':
# transfer Debug files
build_dir = os.path.join(out_dir, 'Debug' + build_dir_suffix);
if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.exe')):
if not options.allowpartial or path_exists(os.path.join(build_dir, 'libcef.dll')):
valid_build_dir = build_dir
dst_dir = os.path.join(output_dir, 'Debug')
make_dir(dst_dir, options.quiet)
@@ -475,7 +475,7 @@ if platform == 'windows':
# transfer Release files
build_dir = os.path.join(out_dir, 'Release' + build_dir_suffix);
if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.exe')):
if not options.allowpartial or path_exists(os.path.join(build_dir, 'libcef.dll')):
valid_build_dir = build_dir
dst_dir = os.path.join(output_dir, 'Release')
make_dir(dst_dir, options.quiet)
@@ -624,12 +624,13 @@ elif platform == 'linux':
if mode == 'standard':
# transfer Debug files
build_dir = os.path.join(out_dir, 'Debug');
if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient')):
libcef_path = os.path.join(build_dir, lib_dir_name, 'libcef.so')
if not options.allowpartial or path_exists(libcef_path):
valid_build_dir = build_dir
dst_dir = os.path.join(output_dir, 'Debug')
make_dir(dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'chrome_sandbox'), os.path.join(dst_dir, 'chrome-sandbox'), options.quiet)
copy_file(os.path.join(build_dir, lib_dir_name, 'libcef.so'), dst_dir, options.quiet)
copy_file(libcef_path, dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'natives_blob.bin'), dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'snapshot_blob.bin'), dst_dir, options.quiet)
else:
@@ -637,7 +638,8 @@ elif platform == 'linux':
# transfer Release files
build_dir = os.path.join(out_dir, 'Release');
if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient')):
libcef_path = os.path.join(build_dir, lib_dir_name, 'libcef.so')
if not options.allowpartial or path_exists(libcef_path):
valid_build_dir = build_dir
dst_dir = os.path.join(output_dir, 'Release')
make_dir(dst_dir, options.quiet)
@@ -645,10 +647,10 @@ elif platform == 'linux':
if mode == 'client':
lib_dst_dir = os.path.join(dst_dir, lib_dir_name)
make_dir(lib_dst_dir, options.quiet)
copy_file(os.path.join(build_dir, lib_dir_name, 'libcef.so'), lib_dst_dir, options.quiet)
copy_file(libcef_path, lib_dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'cefclient'), dst_dir, options.quiet)
else:
copy_file(os.path.join(build_dir, lib_dir_name, 'libcef.so'), dst_dir, options.quiet)
copy_file(libcef_path, dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'chrome_sandbox'), os.path.join(dst_dir, 'chrome-sandbox'), options.quiet)
copy_file(os.path.join(build_dir, 'natives_blob.bin'), dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'snapshot_blob.bin'), dst_dir, options.quiet)