mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
33 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b660893c6e | ||
|
6ae6e613f8 | ||
|
ea9b6c8a6b | ||
|
3d0912d766 | ||
|
e207b1758b | ||
|
d94bfc5a98 | ||
|
c4715049d1 | ||
|
8617e7c22c | ||
|
07e6226bbf | ||
|
f6bf57b45e | ||
|
abb11589b2 | ||
|
26b3a7a5d0 | ||
|
456ea5a198 | ||
|
00b7616fdc | ||
|
ced449a0ef | ||
|
d153a2c484 | ||
|
bd97e664c4 | ||
|
3fb1b92d20 | ||
|
e7a02fe00f | ||
|
2ddbe64750 | ||
|
bc8a9b09a8 | ||
|
61f7df010a | ||
|
3b5b58fb78 | ||
|
c6855b4489 | ||
|
37b43c83e1 | ||
|
ce6efff27f | ||
|
cf20046bba | ||
|
63aa211b61 | ||
|
42f0b5218d | ||
|
f082782859 | ||
|
c32584d266 | ||
|
156dc552b9 | ||
|
bdae0bf335 |
@@ -7,5 +7,5 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'cb947c0153db0ec02a8abbcb3ca086d88bf6006f',
|
||||
'chromium_checkout': 'refs/tags/47.0.2526.80',
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#
|
||||
# The below requirements must be met to build this CEF binary distribution.
|
||||
#
|
||||
# - CMake version 2.8.12.2 or newer.
|
||||
# - CMake version 2.8.12.1 or newer.
|
||||
#
|
||||
# - Linux requirements:
|
||||
# Currently supported distributions include Debian Wheezy, Ubuntu Precise, and
|
||||
@@ -121,7 +121,7 @@
|
||||
# Shared configuration.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12.2)
|
||||
cmake_minimum_required(VERSION 2.8.12.1)
|
||||
|
||||
# Only generate Debug and Release configuration types.
|
||||
set(CMAKE_CONFIGURATION_TYPES Debug Release)
|
||||
@@ -379,12 +379,14 @@ endif()
|
||||
#
|
||||
|
||||
if(OS_WINDOWS)
|
||||
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
|
||||
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
|
||||
|
||||
# Platform-specific compiler/linker flags.
|
||||
set(CEF_LIBTYPE STATIC)
|
||||
# /MP = Multiprocess compilation
|
||||
# /Gy = Enable function-level linking
|
||||
# /GR- = Disable run-time type information
|
||||
# /Zi = Enable program database
|
||||
# /W4 = Warning level 4
|
||||
# /WX = Treat warnings as errors
|
||||
# /wd"4100" = Ignore "unreferenced formal parameter" warning
|
||||
@@ -394,7 +396,7 @@ if(OS_WINDOWS)
|
||||
# /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- /Zi /W4 /WX /wd\"4100\" /wd\"4127\" /wd\"4244\" /wd\"4512\" /wd\"4701\" /wd\"4702\" /wd\"4996\"")
|
||||
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}")
|
||||
# /MTd = Multithreaded debug runtime
|
||||
# /Od = Disable optimizations
|
||||
# /RTC1 = Enable basic run-time checks
|
||||
|
52
cef.gyp
52
cef.gyp
@@ -612,10 +612,11 @@
|
||||
'target_name': 'cef_locales',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'<(DEPTH)/ui/strings/ui_strings.gyp:ui_strings',
|
||||
'<(DEPTH)/chrome/chrome_resources.gyp:platform_locale_settings',
|
||||
'<(DEPTH)/components/components_strings.gyp:components_strings',
|
||||
'<(DEPTH)/content/app/strings/content_strings.gyp:content_strings',
|
||||
'<(DEPTH)/extensions/extensions_strings.gyp:extensions_strings',
|
||||
'<(DEPTH)/ui/strings/ui_strings.gyp:ui_strings',
|
||||
'cef_strings',
|
||||
],
|
||||
'actions': [
|
||||
@@ -811,6 +812,7 @@
|
||||
'action_name': 'make_pack_strings_header',
|
||||
'variables': {
|
||||
'header_inputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/chrome/grit/platform_locale_settings.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/components/strings/grit/components_strings.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/content/app/strings/grit/content_strings.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/extensions/strings/grit/extensions_strings.h',
|
||||
@@ -854,6 +856,7 @@
|
||||
'<(DEPTH)/cef/libcef/resources/grit_stub',
|
||||
'<(DEPTH)/cef/libcef/resources/grit_stub/chrome',
|
||||
'<(grit_out_dir)',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/chrome',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/components',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/ui/resources',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/ui/strings',
|
||||
@@ -891,6 +894,9 @@
|
||||
'<(DEPTH)/components/components.gyp:update_client',
|
||||
'<(DEPTH)/components/components.gyp:user_prefs',
|
||||
'<(DEPTH)/components/components.gyp:version_info',
|
||||
'<(DEPTH)/components/components.gyp:visitedlink_browser',
|
||||
'<(DEPTH)/components/components.gyp:visitedlink_common',
|
||||
'<(DEPTH)/components/components.gyp:visitedlink_renderer',
|
||||
'<(DEPTH)/components/components.gyp:web_cache_renderer',
|
||||
'<(DEPTH)/components/url_formatter/url_formatter.gyp:url_formatter',
|
||||
'<(DEPTH)/content/content.gyp:content_app_both',
|
||||
@@ -957,14 +963,12 @@
|
||||
'libcef/browser/browser_message_filter.h',
|
||||
'libcef/browser/browser_message_loop.cc',
|
||||
'libcef/browser/browser_message_loop.h',
|
||||
'libcef/browser/browser_pref_store.cc',
|
||||
'libcef/browser/browser_pref_store.h',
|
||||
'libcef/browser/browser_settings.cc',
|
||||
'libcef/browser/browser_settings.h',
|
||||
'libcef/browser/browser_urlrequest_impl.cc',
|
||||
'libcef/browser/browser_urlrequest_impl.h',
|
||||
'libcef/browser/chrome_browser_process_stub.cc',
|
||||
'libcef/browser/chrome_browser_process_stub.h',
|
||||
'libcef/browser/chrome_profile_stub.cc',
|
||||
'libcef/browser/chrome_profile_stub.h',
|
||||
'libcef/browser/chrome_scheme_handler.cc',
|
||||
'libcef/browser/chrome_scheme_handler.h',
|
||||
'libcef/browser/content_browser_client.cc',
|
||||
@@ -1051,6 +1055,10 @@
|
||||
'libcef/browser/plugins/plugin_info_message_filter.h',
|
||||
'libcef/browser/plugins/plugin_service_filter.cc',
|
||||
'libcef/browser/plugins/plugin_service_filter.h',
|
||||
'libcef/browser/prefs/browser_prefs.cc',
|
||||
'libcef/browser/prefs/browser_prefs.h',
|
||||
'libcef/browser/prefs/renderer_prefs.cc',
|
||||
'libcef/browser/prefs/renderer_prefs.h',
|
||||
'libcef/browser/print_settings_impl.cc',
|
||||
'libcef/browser/print_settings_impl.h',
|
||||
'libcef/browser/printing/printing_message_filter.cc',
|
||||
@@ -1069,6 +1077,8 @@
|
||||
'libcef/browser/resource_dispatcher_host_delegate.h',
|
||||
'libcef/browser/resource_request_job.cc',
|
||||
'libcef/browser/resource_request_job.h',
|
||||
'libcef/browser/response_filter_wrapper.cc',
|
||||
'libcef/browser/response_filter_wrapper.h',
|
||||
'libcef/browser/request_context_impl.cc',
|
||||
'libcef/browser/request_context_impl.h',
|
||||
'libcef/browser/scheme_handler.cc',
|
||||
@@ -1223,16 +1233,10 @@
|
||||
'<(DEPTH)/chrome/common/chrome_switches.cc',
|
||||
'<(DEPTH)/chrome/common/chrome_switches.h',
|
||||
# Include sources for proxy support.
|
||||
'<(DEPTH)/base/prefs/testing_pref_store.cc',
|
||||
'<(DEPTH)/base/prefs/testing_pref_store.h',
|
||||
'<(DEPTH)/chrome/browser/net/proxy_service_factory.cc',
|
||||
'<(DEPTH)/chrome/browser/net/proxy_service_factory.h',
|
||||
'<(DEPTH)/chrome/browser/net/utility_process_mojo_proxy_resolver_factory.cc',
|
||||
'<(DEPTH)/chrome/browser/net/utility_process_mojo_proxy_resolver_factory.h',
|
||||
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.cc',
|
||||
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.h',
|
||||
'<(DEPTH)/chrome/common/pref_names.cc',
|
||||
'<(DEPTH)/chrome/common/pref_names.h',
|
||||
'<(DEPTH)/components/data_reduction_proxy/core/common/data_reduction_proxy_switches.cc',
|
||||
'<(DEPTH)/components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h',
|
||||
'<(DEPTH)/components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.cc',
|
||||
@@ -1357,6 +1361,32 @@
|
||||
'<(DEPTH)/chrome/browser/plugins/plugin_metadata.h',
|
||||
'<(DEPTH)/components/nacl/common/nacl_constants.cc',
|
||||
'<(DEPTH)/components/nacl/common/nacl_constants.h',
|
||||
# Include sources for preferences support.
|
||||
'<(DEPTH)/base/prefs/testing_pref_store.cc',
|
||||
'<(DEPTH)/base/prefs/testing_pref_store.h',
|
||||
'<(DEPTH)/chrome/browser/accessibility/animation_policy_prefs.cc',
|
||||
'<(DEPTH)/chrome/browser/accessibility/animation_policy_prefs.h',
|
||||
'<(DEPTH)/chrome/browser/character_encoding.cc',
|
||||
'<(DEPTH)/chrome/browser/character_encoding.h',
|
||||
'<(DEPTH)/chrome/browser/defaults.cc',
|
||||
'<(DEPTH)/chrome/browser/defaults.h',
|
||||
'<(DEPTH)/chrome/browser/extensions/extension_webkit_preferences.cc',
|
||||
'<(DEPTH)/chrome/browser/extensions/extension_webkit_preferences.h',
|
||||
'<(DEPTH)/chrome/browser/font_family_cache.cc',
|
||||
'<(DEPTH)/chrome/browser/font_family_cache.h',
|
||||
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.cc',
|
||||
'<(DEPTH)/chrome/browser/prefs/command_line_pref_store.h',
|
||||
'<(DEPTH)/chrome/browser/renderer_preferences_util.cc',
|
||||
'<(DEPTH)/chrome/browser/renderer_preferences_util.h',
|
||||
'<(DEPTH)/chrome/browser/ui/prefs/prefs_tab_helper.cc',
|
||||
'<(DEPTH)/chrome/browser/ui/prefs/prefs_tab_helper.h',
|
||||
'<(DEPTH)/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc',
|
||||
'<(DEPTH)/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h',
|
||||
'<(DEPTH)/chrome/common/pref_font_webkit_names.h',
|
||||
'<(DEPTH)/chrome/common/pref_names.cc',
|
||||
'<(DEPTH)/chrome/common/pref_names.h',
|
||||
'<(DEPTH)/chrome/common/pref_names_util.cc',
|
||||
'<(DEPTH)/chrome/common/pref_names_util.h',
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
|
5
cef.gypi
5
cef.gypi
@@ -24,6 +24,11 @@
|
||||
# Strip symbols and create dSYM files for the Release target.
|
||||
'mac_strip_release': 1,
|
||||
}],
|
||||
['os_posix==1 and OS!="mac" and OS!="android"', {
|
||||
# Disable theme support on Linux so we don't need to implement
|
||||
# ThemeService[Factory] classes.
|
||||
'enable_themes': 0,
|
||||
}]
|
||||
]
|
||||
}, 'conditions': [
|
||||
['os_posix==1 and OS!="mac" and OS!="android"', {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
|
||||
# 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.
|
||||
#
|
||||
@@ -56,6 +56,7 @@
|
||||
'include/cef_resource_bundle_handler.h',
|
||||
'include/cef_resource_handler.h',
|
||||
'include/cef_response.h',
|
||||
'include/cef_response_filter.h',
|
||||
'include/cef_scheme.h',
|
||||
'include/cef_ssl_info.h',
|
||||
'include/cef_stream.h',
|
||||
@@ -115,6 +116,7 @@
|
||||
'include/capi/cef_resource_bundle_handler_capi.h',
|
||||
'include/capi/cef_resource_handler_capi.h',
|
||||
'include/capi/cef_response_capi.h',
|
||||
'include/capi/cef_response_filter_capi.h',
|
||||
'include/capi/cef_scheme_capi.h',
|
||||
'include/capi/cef_ssl_info_capi.h',
|
||||
'include/capi/cef_stream_capi.h',
|
||||
@@ -258,6 +260,8 @@
|
||||
'libcef_dll/ctocpp/resource_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/response_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/response_cpptoc.h',
|
||||
'libcef_dll/ctocpp/response_filter_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/response_filter_ctocpp.h',
|
||||
'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.cc',
|
||||
@@ -456,6 +460,8 @@
|
||||
'libcef_dll/cpptoc/resource_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/response_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/response_ctocpp.h',
|
||||
'libcef_dll/cpptoc/response_filter_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/response_filter_cpptoc.h',
|
||||
'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.cc',
|
||||
|
@@ -175,6 +175,8 @@
|
||||
'tests/cefclient/browser/preferences_test.h',
|
||||
'tests/cefclient/browser/resource.h',
|
||||
'tests/cefclient/browser/resource_util.h',
|
||||
'tests/cefclient/browser/response_filter_test.cc',
|
||||
'tests/cefclient/browser/response_filter_test.h',
|
||||
'tests/cefclient/browser/root_window.cc',
|
||||
'tests/cefclient/browser/root_window.h',
|
||||
'tests/cefclient/browser/root_window_manager.cc',
|
||||
@@ -223,6 +225,7 @@
|
||||
'tests/cefclient/resources/performance.html',
|
||||
'tests/cefclient/resources/performance2.html',
|
||||
'tests/cefclient/resources/preferences.html',
|
||||
'tests/cefclient/resources/response_filter.html',
|
||||
'tests/cefclient/resources/transparency.html',
|
||||
'tests/cefclient/resources/urlrequest.html',
|
||||
'tests/cefclient/resources/window.html',
|
||||
|
@@ -175,7 +175,10 @@
|
||||
// C++11 support may not be enabled in client applications. CEF internal classes
|
||||
// should use the `override` keyword directly.
|
||||
#ifndef OVERRIDE
|
||||
#if defined(__clang__) || defined(COMPILER_MSVC)
|
||||
#if defined(__clang__)
|
||||
#define OVERRIDE override
|
||||
#elif defined(COMPILER_MSVC) && _MSC_VER >= 1600
|
||||
// Visual Studio 2010 and later support override.
|
||||
#define OVERRIDE override
|
||||
#elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \
|
||||
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700
|
||||
|
@@ -141,6 +141,14 @@
|
||||
// This can happen in cases where Chromium code is used directly by the
|
||||
// client application. When using Chromium code directly always include
|
||||
// the Chromium header first to avoid type conflicts.
|
||||
|
||||
// Always define the DCHECK_IS_ON macro which is used from other CEF headers.
|
||||
#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
|
||||
#define DCHECK_IS_ON() 0
|
||||
#else
|
||||
#define DCHECK_IS_ON() 1
|
||||
#endif
|
||||
|
||||
#elif defined(BUILDING_CEF_SHARED)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/logging.h"
|
||||
|
@@ -41,6 +41,7 @@
|
||||
// updated to match.
|
||||
|
||||
#include <stddef.h> // For size_t.
|
||||
#include "include/base/cef_build.h" // For COMPILER_MSVC
|
||||
|
||||
#if !defined(ALLOW_THIS_IN_INITIALIZER_LIST)
|
||||
#if defined(COMPILER_MSVC)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
@@ -87,6 +87,27 @@ typedef struct _cef_request_t {
|
||||
void (CEF_CALLBACK *set_method)(struct _cef_request_t* self,
|
||||
const cef_string_t* method);
|
||||
|
||||
///
|
||||
// Set the referrer URL and policy. If non-NULL the referrer URL must be fully
|
||||
// qualified with an HTTP or HTTPS scheme component. Any username, password or
|
||||
// ref component will be removed.
|
||||
///
|
||||
void (CEF_CALLBACK *set_referrer)(struct _cef_request_t* self,
|
||||
const cef_string_t* referrer_url, cef_referrer_policy_t policy);
|
||||
|
||||
///
|
||||
// Get the referrer URL.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_referrer_url)(
|
||||
struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
// Get the referrer policy.
|
||||
///
|
||||
cef_referrer_policy_t (CEF_CALLBACK *get_referrer_policy)(
|
||||
struct _cef_request_t* self);
|
||||
|
||||
///
|
||||
// Get the post data.
|
||||
///
|
||||
@@ -100,13 +121,14 @@ typedef struct _cef_request_t {
|
||||
struct _cef_post_data_t* postData);
|
||||
|
||||
///
|
||||
// Get the header values.
|
||||
// Get the header values. Will not include the Referer value if any.
|
||||
///
|
||||
void (CEF_CALLBACK *get_header_map)(struct _cef_request_t* self,
|
||||
cef_string_multimap_t headerMap);
|
||||
|
||||
///
|
||||
// Set the header values.
|
||||
// Set the header values. If a Referer value exists in the header map it will
|
||||
// be removed and ignored.
|
||||
///
|
||||
void (CEF_CALLBACK *set_header_map)(struct _cef_request_t* self,
|
||||
cef_string_multimap_t headerMap);
|
||||
@@ -190,6 +212,14 @@ typedef struct _cef_post_data_t {
|
||||
///
|
||||
int (CEF_CALLBACK *is_read_only)(struct _cef_post_data_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if the underlying POST data includes elements that are not
|
||||
// represented by this cef_post_data_t object (for example, multi-part file
|
||||
// upload data). Modifying cef_post_data_t objects with excluded elements may
|
||||
// result in the request failing.
|
||||
///
|
||||
int (CEF_CALLBACK *has_excluded_elements)(struct _cef_post_data_t* self);
|
||||
|
||||
///
|
||||
// Returns the number of existing post data elements.
|
||||
///
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "include/capi/cef_request_capi.h"
|
||||
#include "include/capi/cef_resource_handler_capi.h"
|
||||
#include "include/capi/cef_response_capi.h"
|
||||
#include "include/capi/cef_response_filter_capi.h"
|
||||
#include "include/capi/cef_ssl_info_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -162,13 +163,38 @@ typedef struct _cef_request_handler_t {
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request, struct _cef_response_t* response);
|
||||
|
||||
///
|
||||
// Called on the IO thread to optionally filter resource response content.
|
||||
// |request| and |response| represent the request and response respectively
|
||||
// and cannot be modified in this callback.
|
||||
///
|
||||
struct _cef_response_filter_t* (CEF_CALLBACK *get_resource_response_filter)(
|
||||
struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame, struct _cef_request_t* request,
|
||||
struct _cef_response_t* response);
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource load has completed. |request| and
|
||||
// |response| represent the request and response respectively and cannot be
|
||||
// modified in this callback. |status| indicates the load completion status.
|
||||
// |received_content_length| is the number of response bytes actually read.
|
||||
///
|
||||
void (CEF_CALLBACK *on_resource_load_complete)(
|
||||
struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame, struct _cef_request_t* request,
|
||||
struct _cef_response_t* response, cef_urlrequest_status_t status,
|
||||
int64 received_content_length);
|
||||
|
||||
///
|
||||
// Called on the IO thread when the browser needs credentials from the user.
|
||||
// |isProxy| indicates whether the host is a proxy server. |host| contains the
|
||||
// hostname and |port| contains the port number. Return true (1) to continue
|
||||
// the request and call cef_auth_callback_t::cont() either in this function or
|
||||
// at a later time when the authentication information is available. Return
|
||||
// false (0) to cancel the request immediately.
|
||||
// hostname and |port| contains the port number. |realm| is the realm of the
|
||||
// challenge and may be NULL. |scheme| is the authentication scheme used, such
|
||||
// as "basic" or "digest", and will be NULL if the source of the request is an
|
||||
// FTP server. Return true (1) to continue the request and call
|
||||
// cef_auth_callback_t::cont() either in this function or at a later time when
|
||||
// the authentication information is available. Return false (0) to cancel the
|
||||
// request immediately.
|
||||
///
|
||||
int (CEF_CALLBACK *get_auth_credentials)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame, int isProxy,
|
||||
@@ -203,10 +229,9 @@ typedef struct _cef_request_handler_t {
|
||||
// Called on the UI thread to handle requests for URLs with an invalid SSL
|
||||
// certificate. Return true (1) and call cef_request_tCallback::cont() either
|
||||
// in this function or at a later time to continue or cancel the request.
|
||||
// Return false (0) to cancel the request immediately. If |callback| is NULL
|
||||
// the error cannot be recovered from and the request will be canceled
|
||||
// automatically. If CefSettings.ignore_certificate_errors is set all invalid
|
||||
// certificates will be accepted without calling this function.
|
||||
// Return false (0) to cancel the request immediately. If
|
||||
// CefSettings.ignore_certificate_errors is set all invalid certificates will
|
||||
// be accepted without calling this function.
|
||||
///
|
||||
int (CEF_CALLBACK *on_certificate_error)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser, cef_errorcode_t cert_error,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
91
include/capi/cef_response_filter_capi.h
Normal file
91
include/capi/cef_response_filter_capi.h
Normal file
@@ -0,0 +1,91 @@
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RESPONSE_FILTER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_RESPONSE_FILTER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
///
|
||||
// Implement this structure to filter resource response content. The functions
|
||||
// of this structure will be called on the browser process IO thread.
|
||||
///
|
||||
typedef struct _cef_response_filter_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Initialize the response filter. Will only be called a single time. The
|
||||
// filter will not be installed if this function returns false (0).
|
||||
///
|
||||
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
|
||||
// to |data_out_size| bytes of filtered output data. Set |data_in_read| to the
|
||||
// number of bytes that were read from |data_in|. Set |data_out_written| to
|
||||
// the number of bytes that were written into |data_out|. If some or all of
|
||||
// the pre-filter data was read successfully but more data is needed in order
|
||||
// to continue filtering (filtered output is pending) return
|
||||
// RESPONSE_FILTER_NEED_MORE_DATA. If some or all of the pre-filter data was
|
||||
// read successfully and all available filtered output has been written return
|
||||
// RESPONSE_FILTER_DONE. If an error occurs during filtering return
|
||||
// RESPONSE_FILTER_ERROR. This function will be called repeatedly until there
|
||||
// is no more data to filter (resource response is complete), |data_in_read|
|
||||
// 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,
|
||||
size_t* data_out_written);
|
||||
} cef_response_filter_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_RESPONSE_FILTER_CAPI_H_
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
@@ -126,6 +126,24 @@ typedef struct _cef_sslinfo_t {
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Returns a bitmask containing any and all problems verifying the server
|
||||
// certificate.
|
||||
///
|
||||
cef_cert_status_t (CEF_CALLBACK *get_cert_status)(
|
||||
struct _cef_sslinfo_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if the certificate status has any error, major or minor.
|
||||
///
|
||||
int (CEF_CALLBACK *is_cert_status_error)(struct _cef_sslinfo_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if the certificate status represents only minor errors
|
||||
// (e.g. failure to verify certificate revocation).
|
||||
///
|
||||
int (CEF_CALLBACK *is_cert_status_minor_error)(struct _cef_sslinfo_t* self);
|
||||
|
||||
///
|
||||
// Returns the subject of the X.509 certificate. For HTTPS server certificates
|
||||
// this represents the web server. The common name of the subject should
|
||||
@@ -170,6 +188,28 @@ typedef struct _cef_sslinfo_t {
|
||||
///
|
||||
struct _cef_binary_value_t* (CEF_CALLBACK *get_pemencoded)(
|
||||
struct _cef_sslinfo_t* self);
|
||||
|
||||
///
|
||||
// Returns the number of certificates in the issuer chain. If 0, the
|
||||
// certificate is self-signed.
|
||||
///
|
||||
size_t (CEF_CALLBACK *get_issuer_chain_size)(struct _cef_sslinfo_t* self);
|
||||
|
||||
///
|
||||
// Returns the DER encoded data for the certificate issuer chain. If we failed
|
||||
// to encode a certificate in the chain it is still present in the array but
|
||||
// is an NULL string.
|
||||
///
|
||||
void (CEF_CALLBACK *get_derencoded_issuer_chain)(struct _cef_sslinfo_t* self,
|
||||
size_t* chainCount, struct _cef_binary_value_t** chain);
|
||||
|
||||
///
|
||||
// Returns the PEM encoded data for the certificate issuer chain. If we failed
|
||||
// to encode a certificate in the chain it is still present in the array but
|
||||
// is an NULL string.
|
||||
///
|
||||
void (CEF_CALLBACK *get_pemencoded_issuer_chain)(struct _cef_sslinfo_t* self,
|
||||
size_t* chainCount, struct _cef_binary_value_t** chain);
|
||||
} cef_sslinfo_t;
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
@@ -53,6 +53,7 @@ class CefPostDataElement;
|
||||
class CefRequest : public virtual CefBase {
|
||||
public:
|
||||
typedef std::multimap<CefString, CefString> HeaderMap;
|
||||
typedef cef_referrer_policy_t ReferrerPolicy;
|
||||
typedef cef_resource_type_t ResourceType;
|
||||
typedef cef_transition_type_t TransitionType;
|
||||
|
||||
@@ -93,6 +94,27 @@ class CefRequest : public virtual CefBase {
|
||||
/*--cef()--*/
|
||||
virtual void SetMethod(const CefString& method) =0;
|
||||
|
||||
///
|
||||
// Set the referrer URL and policy. If non-empty the referrer URL must be
|
||||
// fully qualified with an HTTP or HTTPS scheme component. Any username,
|
||||
// password or ref component will be removed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetReferrer(const CefString& referrer_url,
|
||||
ReferrerPolicy policy) =0;
|
||||
|
||||
///
|
||||
// Get the referrer URL.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetReferrerURL() =0;
|
||||
|
||||
///
|
||||
// Get the referrer policy.
|
||||
///
|
||||
/*--cef(default_retval=REFERRER_POLICY_DEFAULT)--*/
|
||||
virtual ReferrerPolicy GetReferrerPolicy() =0;
|
||||
|
||||
///
|
||||
// Get the post data.
|
||||
///
|
||||
@@ -106,13 +128,14 @@ class CefRequest : public virtual CefBase {
|
||||
virtual void SetPostData(CefRefPtr<CefPostData> postData) =0;
|
||||
|
||||
///
|
||||
// Get the header values.
|
||||
// Get the header values. Will not include the Referer value if any.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void GetHeaderMap(HeaderMap& headerMap) =0;
|
||||
|
||||
///
|
||||
// Set the header values.
|
||||
// Set the header values. If a Referer value exists in the header map it will
|
||||
// be removed and ignored.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetHeaderMap(const HeaderMap& headerMap) =0;
|
||||
@@ -200,6 +223,15 @@ class CefPostData : public virtual CefBase {
|
||||
/*--cef()--*/
|
||||
virtual bool IsReadOnly() =0;
|
||||
|
||||
///
|
||||
// Returns true if the underlying POST data includes elements that are not
|
||||
// represented by this CefPostData object (for example, multi-part file upload
|
||||
// data). Modifying CefPostData objects with excluded elements may result in
|
||||
// the request failing.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool HasExcludedElements() = 0;
|
||||
|
||||
///
|
||||
// Returns the number of existing post data elements.
|
||||
///
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_resource_handler.h"
|
||||
#include "include/cef_response.h"
|
||||
#include "include/cef_response_filter.h"
|
||||
#include "include/cef_request.h"
|
||||
#include "include/cef_ssl_info.h"
|
||||
|
||||
@@ -78,6 +79,7 @@ class CefRequestHandler : public virtual CefBase {
|
||||
public:
|
||||
typedef cef_return_value_t ReturnValue;
|
||||
typedef cef_termination_status_t TerminationStatus;
|
||||
typedef cef_urlrequest_status_t URLRequestStatus;
|
||||
typedef cef_window_open_disposition_t WindowOpenDisposition;
|
||||
|
||||
///
|
||||
@@ -180,15 +182,46 @@ class CefRequestHandler : public virtual CefBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread to optionally filter resource response content.
|
||||
// |request| and |response| represent the request and response respectively
|
||||
// and cannot be modified in this callback.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread when a resource load has completed. |request| and
|
||||
// |response| represent the request and response respectively and cannot be
|
||||
// modified in this callback. |status| indicates the load completion status.
|
||||
// |received_content_length| is the number of response bytes actually read.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnResourceLoadComplete(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response,
|
||||
URLRequestStatus status,
|
||||
int64 received_content_length) {}
|
||||
|
||||
///
|
||||
// Called on the IO thread when the browser needs credentials from the user.
|
||||
// |isProxy| indicates whether the host is a proxy server. |host| contains the
|
||||
// hostname and |port| contains the port number. Return true to continue the
|
||||
// request and call CefAuthCallback::Continue() either in this method or
|
||||
// at a later time when the authentication information is available. Return
|
||||
// false to cancel the request immediately.
|
||||
// hostname and |port| contains the port number. |realm| is the realm of the
|
||||
// challenge and may be empty. |scheme| is the authentication scheme used,
|
||||
// such as "basic" or "digest", and will be empty if the source of the request
|
||||
// is an FTP server. Return true to continue the request and call
|
||||
// CefAuthCallback::Continue() either in this method or at a later time when
|
||||
// the authentication information is available. Return false to cancel the
|
||||
// request immediately.
|
||||
///
|
||||
/*--cef(optional_param=realm)--*/
|
||||
/*--cef(optional_param=realm,optional_param=scheme)--*/
|
||||
virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isProxy,
|
||||
@@ -232,10 +265,9 @@ class CefRequestHandler : public virtual CefBase {
|
||||
// Called on the UI thread to handle requests for URLs with an invalid
|
||||
// SSL certificate. Return true and call CefRequestCallback::Continue() either
|
||||
// in this method or at a later time to continue or cancel the request. Return
|
||||
// false to cancel the request immediately. If |callback| is empty the error
|
||||
// cannot be recovered from and the request will be canceled automatically.
|
||||
// If CefSettings.ignore_certificate_errors is set all invalid certificates
|
||||
// will be accepted without calling this method.
|
||||
// false to cancel the request immediately. If
|
||||
// CefSettings.ignore_certificate_errors is set all invalid certificates will
|
||||
// be accepted without calling this method.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnCertificateError(
|
||||
|
84
include/cef_response_filter.h
Normal file
84
include/cef_response_filter.h
Normal file
@@ -0,0 +1,84 @@
|
||||
// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_RESPONSE_FILTER_H_
|
||||
#define CEF_INCLUDE_CEF_RESPONSE_FILTER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
///
|
||||
// Implement this interface to filter resource response content. The methods of
|
||||
// this class will be called on the browser process IO thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefResponseFilter : public virtual CefBase {
|
||||
public:
|
||||
typedef cef_response_filter_status_t FilterStatus;
|
||||
|
||||
///
|
||||
// Initialize the response filter. Will only be called a single time. The
|
||||
// filter will not be installed if this method returns false.
|
||||
///
|
||||
/*--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
|
||||
// to |data_out_size| bytes of filtered output data. Set |data_in_read| to the
|
||||
// number of bytes that were read from |data_in|. Set |data_out_written| to
|
||||
// the number of bytes that were written into |data_out|. If some or all of
|
||||
// the pre-filter data was read successfully but more data is needed in order
|
||||
// to continue filtering (filtered output is pending) return
|
||||
// RESPONSE_FILTER_NEED_MORE_DATA. If some or all of the pre-filter data was
|
||||
// read successfully and all available filtered output has been written return
|
||||
// RESPONSE_FILTER_DONE. If an error occurs during filtering return
|
||||
// RESPONSE_FILTER_ERROR. This method will be called repeatedly until there is
|
||||
// no more data to filter (resource response is complete), |data_in_read|
|
||||
// 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,
|
||||
size_t& data_in_read,
|
||||
void* data_out,
|
||||
size_t data_out_size,
|
||||
size_t& data_out_written) =0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_RESPONSE_FILTER_H_
|
@@ -111,6 +111,28 @@ class CefSSLCertPrincipal : public virtual CefBase {
|
||||
/*--cef(source=library)--*/
|
||||
class CefSSLInfo : public virtual CefBase {
|
||||
public:
|
||||
typedef std::vector<CefRefPtr<CefBinaryValue> > IssuerChainBinaryList;
|
||||
|
||||
///
|
||||
// Returns a bitmask containing any and all problems verifying the server
|
||||
// certificate.
|
||||
///
|
||||
/*--cef(default_retval=CERT_STATUS_NONE)--*/
|
||||
virtual cef_cert_status_t GetCertStatus() =0;
|
||||
|
||||
///
|
||||
// Returns true if the certificate status has any error, major or minor.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsCertStatusError() =0;
|
||||
|
||||
///
|
||||
// Returns true if the certificate status represents only minor errors
|
||||
// (e.g. failure to verify certificate revocation).
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsCertStatusMinorError() =0;
|
||||
|
||||
///
|
||||
// Returns the subject of the X.509 certificate. For HTTPS server
|
||||
// certificates this represents the web server. The common name of the
|
||||
@@ -157,6 +179,29 @@ class CefSSLInfo : public virtual CefBase {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefBinaryValue> GetPEMEncoded() =0;
|
||||
|
||||
///
|
||||
// Returns the number of certificates in the issuer chain.
|
||||
// If 0, the certificate is self-signed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual size_t GetIssuerChainSize() =0;
|
||||
|
||||
///
|
||||
// Returns the DER encoded data for the certificate issuer chain.
|
||||
// If we failed to encode a certificate in the chain it is still
|
||||
// present in the array but is an empty string.
|
||||
///
|
||||
/*--cef(count_func=chain:GetIssuerChainSize)--*/
|
||||
virtual void GetDEREncodedIssuerChain(IssuerChainBinaryList& chain) =0;
|
||||
|
||||
///
|
||||
// Returns the PEM encoded data for the certificate issuer chain.
|
||||
// If we failed to encode a certificate in the chain it is still
|
||||
// present in the array but is an empty string.
|
||||
///
|
||||
/*--cef(count_func=chain:GetIssuerChainSize)--*/
|
||||
virtual void GetPEMEncodedIssuerChain(IssuerChainBinaryList& chain) =0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_SSL_INFO_H_
|
||||
|
@@ -218,15 +218,25 @@ typedef struct _cef_settings_t {
|
||||
///
|
||||
// To persist session cookies (cookies without an expiry date or validity
|
||||
// interval) by default when using the global cookie manager set this value to
|
||||
// true. Session cookies are generally intended to be transient and most Web
|
||||
// browsers do not persist them. A |cache_path| value must also be specified
|
||||
// to enable this feature. Also configurable using the
|
||||
// true (1). Session cookies are generally intended to be transient and most
|
||||
// Web browsers do not persist them. A |cache_path| value must also be
|
||||
// specified to enable this feature. Also configurable using the
|
||||
// "persist-session-cookies" command-line switch. Can be overridden for
|
||||
// individual CefRequestContext instances via the
|
||||
// CefRequestContextSettings.persist_session_cookies value.
|
||||
///
|
||||
int persist_session_cookies;
|
||||
|
||||
///
|
||||
// To persist user preferences as a JSON file in the cache path directory set
|
||||
// this value to true (1). A |cache_path| value must also be specified
|
||||
// to enable this feature. Also configurable using the
|
||||
// "persist-user-preferences" command-line switch. Can be overridden for
|
||||
// individual CefRequestContext instances via the
|
||||
// CefRequestContextSettings.persist_user_preferences value.
|
||||
///
|
||||
int persist_user_preferences;
|
||||
|
||||
///
|
||||
// Value that will be returned as the User-Agent HTTP header. If empty the
|
||||
// default User-Agent string will be used. Also configurable using the
|
||||
@@ -252,10 +262,12 @@ typedef struct _cef_settings_t {
|
||||
cef_string_t locale;
|
||||
|
||||
///
|
||||
// The directory and file name to use for the debug log. If empty, the
|
||||
// default name of "debug.log" will be used and the file will be written
|
||||
// to the application directory. Also configurable using the "log-file"
|
||||
// command-line switch.
|
||||
// The directory and file name to use for the debug log. If empty a default
|
||||
// log file name and location will be used. On Windows and Linux a "debug.log"
|
||||
// file will be written in the main executable directory. On Mac OS X a
|
||||
// "~/Library/Logs/<app name>_debug.log" file will be written where <app name>
|
||||
// is the name of the main app executable. Also configurable using the
|
||||
// "log-file" command-line switch.
|
||||
///
|
||||
cef_string_t log_file;
|
||||
|
||||
@@ -394,13 +406,21 @@ typedef struct _cef_request_context_settings_t {
|
||||
///
|
||||
// To persist session cookies (cookies without an expiry date or validity
|
||||
// interval) by default when using the global cookie manager set this value to
|
||||
// true. Session cookies are generally intended to be transient and most Web
|
||||
// browsers do not persist them. Can be set globally using the
|
||||
// true (1). Session cookies are generally intended to be transient and most
|
||||
// Web browsers do not persist them. Can be set globally using the
|
||||
// CefSettings.persist_session_cookies value. This value will be ignored if
|
||||
// |cache_path| is empty or if it matches the CefSettings.cache_path value.
|
||||
///
|
||||
int persist_session_cookies;
|
||||
|
||||
///
|
||||
// To persist user preferences as a JSON file in the cache path directory set
|
||||
// this value to true (1). Can be set globally using the
|
||||
// CefSettings.persist_user_preferences value. This value will be ignored if
|
||||
// |cache_path| is empty or if it matches the CefSettings.cache_path value.
|
||||
///
|
||||
int persist_user_preferences;
|
||||
|
||||
///
|
||||
// Set to true (1) to ignore errors related to invalid SSL certificates.
|
||||
// Enabling this setting can lead to potential security vulnerabilities like
|
||||
@@ -846,6 +866,7 @@ typedef enum {
|
||||
ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113,
|
||||
ERR_SSL_RENEGOTIATION_REQUESTED = -114,
|
||||
ERR_CERT_COMMON_NAME_INVALID = -200,
|
||||
ERR_CERT_BEGIN = ERR_CERT_COMMON_NAME_INVALID,
|
||||
ERR_CERT_DATE_INVALID = -201,
|
||||
ERR_CERT_AUTHORITY_INVALID = -202,
|
||||
ERR_CERT_CONTAINS_ERRORS = -203,
|
||||
@@ -853,7 +874,13 @@ typedef enum {
|
||||
ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205,
|
||||
ERR_CERT_REVOKED = -206,
|
||||
ERR_CERT_INVALID = -207,
|
||||
ERR_CERT_END = -208,
|
||||
ERR_CERT_WEAK_SIGNATURE_ALGORITHM = -208,
|
||||
// -209 is available: was ERR_CERT_NOT_IN_DNS.
|
||||
ERR_CERT_NON_UNIQUE_NAME = -210,
|
||||
ERR_CERT_WEAK_KEY = -211,
|
||||
ERR_CERT_NAME_CONSTRAINT_VIOLATION = -212,
|
||||
ERR_CERT_VALIDITY_TOO_LONG = -213,
|
||||
ERR_CERT_END = ERR_CERT_VALIDITY_TOO_LONG,
|
||||
ERR_INVALID_URL = -300,
|
||||
ERR_DISALLOWED_URL_SCHEME = -301,
|
||||
ERR_UNKNOWN_URL_SCHEME = -302,
|
||||
@@ -870,6 +897,38 @@ typedef enum {
|
||||
ERR_INSECURE_RESPONSE = -501,
|
||||
} cef_errorcode_t;
|
||||
|
||||
///
|
||||
// Supported certificate status code values. See net\cert\cert_status_flags.h
|
||||
// for more information. CERT_STATUS_NONE is new in CEF because we use an
|
||||
// enum while cert_status_flags.h uses a typedef and static const variables.
|
||||
///
|
||||
typedef enum {
|
||||
CERT_STATUS_NONE = 0,
|
||||
CERT_STATUS_COMMON_NAME_INVALID = 1 << 0,
|
||||
CERT_STATUS_DATE_INVALID = 1 << 1,
|
||||
CERT_STATUS_AUTHORITY_INVALID = 1 << 2,
|
||||
// 1 << 3 is reserved for ERR_CERT_CONTAINS_ERRORS (not useful with WinHTTP).
|
||||
CERT_STATUS_NO_REVOCATION_MECHANISM = 1 << 4,
|
||||
CERT_STATUS_UNABLE_TO_CHECK_REVOCATION = 1 << 5,
|
||||
CERT_STATUS_REVOKED = 1 << 6,
|
||||
CERT_STATUS_INVALID = 1 << 7,
|
||||
CERT_STATUS_WEAK_SIGNATURE_ALGORITHM = 1 << 8,
|
||||
// 1 << 9 was used for CERT_STATUS_NOT_IN_DNS
|
||||
CERT_STATUS_NON_UNIQUE_NAME = 1 << 10,
|
||||
CERT_STATUS_WEAK_KEY = 1 << 11,
|
||||
// 1 << 12 was used for CERT_STATUS_WEAK_DH_KEY
|
||||
CERT_STATUS_PINNED_KEY_MISSING = 1 << 13,
|
||||
CERT_STATUS_NAME_CONSTRAINT_VIOLATION = 1 << 14,
|
||||
CERT_STATUS_VALIDITY_TOO_LONG = 1 << 15,
|
||||
|
||||
// Bits 16 to 31 are for non-error statuses.
|
||||
CERT_STATUS_IS_EV = 1 << 16,
|
||||
CERT_STATUS_REV_CHECKING_ENABLED = 1 << 17,
|
||||
// Bit 18 was CERT_STATUS_IS_DNSSEC
|
||||
CERT_STATUS_SHA1_SIGNATURE_PRESENT = 1 << 19,
|
||||
CERT_STATUS_CT_COMPLIANCE_FAILED = 1 << 20,
|
||||
} cef_cert_status_t;
|
||||
|
||||
///
|
||||
// The manner in which a link click should be opened.
|
||||
///
|
||||
@@ -2279,6 +2338,70 @@ typedef enum {
|
||||
PLUGIN_POLICY_DISABLE,
|
||||
} cef_plugin_policy_t;
|
||||
|
||||
///
|
||||
// Policy for how the Referrer HTTP header value will be sent during navigation.
|
||||
// If the `--no-referrers` command-line flag is specified then the policy value
|
||||
// will be ignored and the Referrer value will never be sent.
|
||||
///
|
||||
typedef enum {
|
||||
///
|
||||
// Always send the complete Referrer value.
|
||||
///
|
||||
REFERRER_POLICY_ALWAYS,
|
||||
|
||||
///
|
||||
// Use the default policy. This is REFERRER_POLICY_ORIGIN_WHEN_CROSS_ORIGIN
|
||||
// when the `--reduced-referrer-granularity` command-line flag is specified
|
||||
// and REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE otherwise.
|
||||
//
|
||||
///
|
||||
REFERRER_POLICY_DEFAULT,
|
||||
|
||||
///
|
||||
// When navigating from HTTPS to HTTP do not send the Referrer value.
|
||||
// Otherwise, send the complete Referrer value.
|
||||
///
|
||||
REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE,
|
||||
|
||||
///
|
||||
// Never send the Referrer value.
|
||||
///
|
||||
REFERRER_POLICY_NEVER,
|
||||
|
||||
///
|
||||
// Only send the origin component of the Referrer value.
|
||||
///
|
||||
REFERRER_POLICY_ORIGIN,
|
||||
|
||||
///
|
||||
// When navigating cross-origin only send the origin component of the Referrer
|
||||
// value. Otherwise, send the complete Referrer value.
|
||||
///
|
||||
REFERRER_POLICY_ORIGIN_WHEN_CROSS_ORIGIN,
|
||||
} cef_referrer_policy_t;
|
||||
|
||||
///
|
||||
// Return values for CefResponseFilter::Filter().
|
||||
///
|
||||
typedef enum {
|
||||
///
|
||||
// Some or all of the pre-filter data was read successfully but more data is
|
||||
// needed in order to continue filtering (filtered output is pending).
|
||||
///
|
||||
RESPONSE_FILTER_NEED_MORE_DATA,
|
||||
|
||||
///
|
||||
// Some or all of the pre-filter data was read successfully and all available
|
||||
// filtered output has been written.
|
||||
///
|
||||
RESPONSE_FILTER_DONE,
|
||||
|
||||
///
|
||||
// An error occurred during filtering.
|
||||
///
|
||||
RESPONSE_FILTER_ERROR
|
||||
} cef_response_filter_status_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -489,6 +489,7 @@ struct CefSettingsTraits {
|
||||
cef_string_set(src->user_data_path.str, src->user_data_path.length,
|
||||
&target->user_data_path, copy);
|
||||
target->persist_session_cookies = src->persist_session_cookies;
|
||||
target->persist_user_preferences = src->persist_user_preferences;
|
||||
|
||||
cef_string_set(src->user_agent.str, src->user_agent.length,
|
||||
&target->user_agent, copy);
|
||||
@@ -541,6 +542,7 @@ struct CefRequestContextSettingsTraits {
|
||||
cef_string_set(src->cache_path.str, src->cache_path.length,
|
||||
&target->cache_path, copy);
|
||||
target->persist_session_cookies = src->persist_session_cookies;
|
||||
target->persist_user_preferences = src->persist_user_preferences;
|
||||
target->ignore_certificate_errors = src->ignore_certificate_errors;
|
||||
cef_string_set(src->accept_language_list.str,
|
||||
src->accept_language_list.length, &target->accept_language_list, copy);
|
||||
|
@@ -5,12 +5,15 @@
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
#include "components/user_prefs/user_prefs.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
base::AtomicRefCount CefBrowserContext::DebugObjCt = 0;
|
||||
@@ -24,16 +27,8 @@ CefBrowserContext::CefBrowserContext()
|
||||
}
|
||||
|
||||
CefBrowserContext::~CefBrowserContext() {
|
||||
if (resource_context_.get()) {
|
||||
// Destruction of the ResourceContext will trigger destruction of all
|
||||
// associated URLRequests.
|
||||
content::BrowserThread::DeleteSoon(
|
||||
content::BrowserThread::IO, FROM_HERE, resource_context_.release());
|
||||
}
|
||||
|
||||
// Remove any BrowserContextKeyedServiceFactory associations.
|
||||
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
|
||||
this);
|
||||
// Should be cleared in Shutdown().
|
||||
DCHECK(!resource_context_.get());
|
||||
|
||||
#ifndef NDEBUG
|
||||
base::AtomicRefCountDec(&DebugObjCt);
|
||||
@@ -68,6 +63,27 @@ void CefBrowserContext::Initialize() {
|
||||
extension_system_->Init();
|
||||
}
|
||||
|
||||
void CefBrowserContext::Shutdown() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (resource_context_.get()) {
|
||||
// Destruction of the ResourceContext will trigger destruction of all
|
||||
// associated URLRequests.
|
||||
content::BrowserThread::DeleteSoon(
|
||||
content::BrowserThread::IO, FROM_HERE, resource_context_.release());
|
||||
}
|
||||
|
||||
// Remove any BrowserContextKeyedServiceFactory associations. This must be
|
||||
// called before the ProxyService owned by CefBrowserContextImpl is destroyed.
|
||||
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
|
||||
this);
|
||||
}
|
||||
|
||||
content::ResourceContext* CefBrowserContext::GetResourceContext() {
|
||||
return resource_context_.get();
|
||||
}
|
||||
|
||||
ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() {
|
||||
return static_cast<ChromeZoomLevelPrefs*>(
|
||||
GetStoragePartition(this, NULL)->GetZoomLevelDelegate());
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_request_context_handler.h"
|
||||
#include "libcef/browser/chrome_profile_stub.h"
|
||||
#include "libcef/browser/resource_context.h"
|
||||
#include "libcef/browser/url_request_context_getter_impl.h"
|
||||
|
||||
@@ -115,7 +116,7 @@ class CefExtensionSystem;
|
||||
// of this class is passed to WebContents::Create in CefBrowserHostImpl::
|
||||
// CreateInternal. Only accessed on the UI thread unless otherwise indicated.
|
||||
class CefBrowserContext
|
||||
: public content::BrowserContext,
|
||||
: public ChromeProfileStub,
|
||||
public base::RefCountedThreadSafe<
|
||||
CefBrowserContext, content::BrowserThread::DeleteOnUIThread> {
|
||||
public:
|
||||
@@ -127,6 +128,9 @@ class CefBrowserContext
|
||||
// BrowserContext methods.
|
||||
content::ResourceContext* GetResourceContext() override;
|
||||
|
||||
// Profile methods.
|
||||
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;
|
||||
|
||||
// Returns the settings associated with this object. Safe to call from any
|
||||
// thread.
|
||||
virtual const CefRequestContextSettings& GetSettings() const = 0;
|
||||
@@ -148,8 +152,9 @@ class CefBrowserContext
|
||||
// Settings for plugins and extensions.
|
||||
virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0;
|
||||
|
||||
// Preferences.
|
||||
virtual PrefService* GetPrefs() = 0;
|
||||
// Called from CefBrowserHostImpl::DidNavigateAnyFrame to update the table of
|
||||
// visited links.
|
||||
virtual void AddVisitedURLs(const std::vector<GURL>& urls) = 0;
|
||||
|
||||
CefResourceContext* resource_context() const {
|
||||
return resource_context_.get();
|
||||
@@ -166,6 +171,9 @@ class CefBrowserContext
|
||||
protected:
|
||||
~CefBrowserContext() override;
|
||||
|
||||
// Must be called before the child object destructor has completed.
|
||||
void Shutdown();
|
||||
|
||||
private:
|
||||
// Only allow deletion via scoped_refptr().
|
||||
friend struct content::BrowserThread::DeleteOnThread<
|
||||
|
@@ -10,21 +10,28 @@
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/permission_manager.h"
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/ssl_host_state_delegate.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/containers/scoped_ptr_map.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/prefs/pref_service.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "chrome/browser/font_family_cache.h"
|
||||
#include "chrome/browser/net/proxy_service_factory.h"
|
||||
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "components/guest_view/browser/guest_view_manager.h"
|
||||
#include "components/ui/zoom/zoom_event_manager.h"
|
||||
#include "components/visitedlink/browser/visitedlink_event_listener.h"
|
||||
#include "components/visitedlink/browser/visitedlink_master.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
@@ -124,6 +131,67 @@ base::LazyInstance<ImplManager> g_manager = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
// Creates and manages VisitedLinkEventListener objects for each
|
||||
// CefBrowserContext sharing the same VisitedLinkMaster.
|
||||
class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
|
||||
public:
|
||||
CefVisitedLinkListener()
|
||||
: master_(nullptr) {
|
||||
}
|
||||
|
||||
void set_master(visitedlink::VisitedLinkMaster* master) {
|
||||
DCHECK(!master_);
|
||||
master_ = master;
|
||||
}
|
||||
|
||||
void CreateListenerForContext(const CefBrowserContext* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
scoped_ptr<visitedlink::VisitedLinkEventListener> listener(
|
||||
new visitedlink::VisitedLinkEventListener(
|
||||
master_, const_cast<CefBrowserContext*>(context)));
|
||||
listener_map_.insert(context, listener.Pass());
|
||||
}
|
||||
|
||||
void RemoveListenerForContext(const CefBrowserContext* context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
listener_map_.erase(context);
|
||||
}
|
||||
|
||||
// visitedlink::VisitedLinkMaster::Listener methods.
|
||||
|
||||
void NewTable(base::SharedMemory* shared_memory) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::const_iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
it->second->NewTable(shared_memory);
|
||||
}
|
||||
|
||||
void Add(visitedlink::VisitedLinkCommon::Fingerprint fingerprint) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::const_iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
it->second->Add(fingerprint);
|
||||
}
|
||||
|
||||
void Reset() override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::const_iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
it->second->Reset();
|
||||
}
|
||||
|
||||
private:
|
||||
visitedlink::VisitedLinkMaster* master_;
|
||||
|
||||
// Map of CefBrowserContext to the associated VisitedLinkEventListener.
|
||||
typedef base::ScopedPtrMap<
|
||||
const CefBrowserContext*,
|
||||
scoped_ptr<visitedlink::VisitedLinkEventListener> > ListenerMap;
|
||||
ListenerMap listener_map_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefVisitedLinkListener);
|
||||
};
|
||||
|
||||
CefBrowserContextImpl::CefBrowserContextImpl(
|
||||
const CefRequestContextSettings& settings)
|
||||
: settings_(settings) {
|
||||
@@ -131,6 +199,12 @@ CefBrowserContextImpl::CefBrowserContextImpl(
|
||||
}
|
||||
|
||||
CefBrowserContextImpl::~CefBrowserContextImpl() {
|
||||
Shutdown();
|
||||
|
||||
// The FontFamilyCache references the ProxyService so delete it before the
|
||||
// ProxyService is deleted.
|
||||
SetUserData(&kFontFamilyCacheKey, NULL);
|
||||
|
||||
pref_proxy_config_tracker_->DetachFromPrefService();
|
||||
|
||||
if (host_content_settings_map_.get())
|
||||
@@ -166,10 +240,24 @@ void CefBrowserContextImpl::Initialize() {
|
||||
CefString(&CefContext::Get()->settings().accept_language_list);
|
||||
}
|
||||
|
||||
// Initialize user preferences.
|
||||
pref_store_ = new CefBrowserPrefStore();
|
||||
pref_store_->SetInitializationCompleted();
|
||||
pref_service_ = pref_store_->CreateService().Pass();
|
||||
// Initialize preferences.
|
||||
base::FilePath pref_path;
|
||||
if (!cache_path_.empty() && settings_.persist_user_preferences)
|
||||
pref_path = cache_path_.AppendASCII(browser_prefs::kUserPrefsFileName);
|
||||
pref_service_ = browser_prefs::CreatePrefService(pref_path);
|
||||
|
||||
// Initialize visited links management.
|
||||
base::FilePath visited_link_path;
|
||||
if (!cache_path_.empty())
|
||||
visited_link_path = cache_path_.Append(FILE_PATH_LITERAL("Visited Links"));
|
||||
visitedlink_listener_ = new CefVisitedLinkListener;
|
||||
visitedlink_master_.reset(
|
||||
new visitedlink::VisitedLinkMaster(visitedlink_listener_, this,
|
||||
!visited_link_path.empty(), false,
|
||||
visited_link_path, 0));
|
||||
visitedlink_listener_->set_master(visitedlink_master_.get());
|
||||
visitedlink_listener_->CreateListenerForContext(this);
|
||||
visitedlink_master_->Init();
|
||||
|
||||
CefBrowserContext::Initialize();
|
||||
|
||||
@@ -190,10 +278,15 @@ void CefBrowserContextImpl::AddProxy(const CefBrowserContextProxy* proxy) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!HasProxy(proxy));
|
||||
proxy_list_.push_back(proxy);
|
||||
|
||||
visitedlink_listener_->CreateListenerForContext(proxy);
|
||||
}
|
||||
|
||||
void CefBrowserContextImpl::RemoveProxy(const CefBrowserContextProxy* proxy) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
visitedlink_listener_->RemoveListenerForContext(proxy);
|
||||
|
||||
bool found = false;
|
||||
ProxyList::iterator it = proxy_list_.begin();
|
||||
for (; it != proxy_list_.end(); ++it) {
|
||||
@@ -239,8 +332,14 @@ base::FilePath CefBrowserContextImpl::GetPath() const {
|
||||
}
|
||||
|
||||
scoped_ptr<content::ZoomLevelDelegate>
|
||||
CefBrowserContextImpl::CreateZoomLevelDelegate(const base::FilePath&) {
|
||||
return scoped_ptr<content::ZoomLevelDelegate>();
|
||||
CefBrowserContextImpl::CreateZoomLevelDelegate(
|
||||
const base::FilePath& partition_path) {
|
||||
if (cache_path_.empty())
|
||||
return scoped_ptr<content::ZoomLevelDelegate>();
|
||||
|
||||
return make_scoped_ptr(new ChromeZoomLevelPrefs(
|
||||
GetPrefs(), cache_path_, partition_path,
|
||||
ui_zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()));
|
||||
}
|
||||
|
||||
bool CefBrowserContextImpl::IsOffTheRecord() const {
|
||||
@@ -313,6 +412,14 @@ content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() {
|
||||
return permission_manager_.get();
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextImpl::GetPrefs() {
|
||||
return pref_service_.get();
|
||||
}
|
||||
|
||||
const PrefService* CefBrowserContextImpl::GetPrefs() const {
|
||||
return pref_service_.get();
|
||||
}
|
||||
|
||||
const CefRequestContextSettings& CefBrowserContextImpl::GetSettings() const {
|
||||
return settings_;
|
||||
}
|
||||
@@ -381,6 +488,12 @@ HostContentSettingsMap* CefBrowserContextImpl::GetHostContentSettingsMap() {
|
||||
return host_content_settings_map_.get();
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextImpl::GetPrefs() {
|
||||
return pref_service_.get();
|
||||
void CefBrowserContextImpl::AddVisitedURLs(const std::vector<GURL>& urls) {
|
||||
visitedlink_master_->AddURLs(urls);
|
||||
}
|
||||
|
||||
void CefBrowserContextImpl::RebuildTable(
|
||||
const scoped_refptr<URLEnumerator>& enumerator) {
|
||||
// Called when visited links will not or cannot be loaded from disk.
|
||||
enumerator->OnComplete(true);
|
||||
}
|
||||
|
@@ -8,28 +8,29 @@
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
|
||||
#include "libcef/browser/browser_pref_store.h"
|
||||
#include "libcef/browser/url_request_context_getter_impl.h"
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "components/proxy_config/pref_proxy_config_tracker.h"
|
||||
|
||||
namespace content {
|
||||
class DownloadManagerDelegate;
|
||||
class SpeechRecognitionPreferences;
|
||||
}
|
||||
#include "components/visitedlink/browser/visitedlink_delegate.h"
|
||||
|
||||
class CefBrowserContextProxy;
|
||||
class CefDownloadManagerDelegate;
|
||||
class CefSSLHostStateDelegate;
|
||||
class CefVisitedLinkListener;
|
||||
|
||||
namespace visitedlink {
|
||||
class VisitedLinkMaster;
|
||||
}
|
||||
|
||||
// Isolated BrowserContext implementation. Life span is controlled by
|
||||
// CefRequestContextImpl and (for the main context) CefBrowserMainParts. Only
|
||||
// accessed on the UI thread unless otherwise indicated. See browser_context.h
|
||||
// for an object relationship diagram.
|
||||
class CefBrowserContextImpl : public CefBrowserContext {
|
||||
class CefBrowserContextImpl : public CefBrowserContext,
|
||||
public visitedlink::VisitedLinkDelegate {
|
||||
public:
|
||||
explicit CefBrowserContextImpl(const CefRequestContextSettings& settings);
|
||||
|
||||
@@ -75,6 +76,10 @@ class CefBrowserContextImpl : public CefBrowserContext {
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::PermissionManager* GetPermissionManager() override;
|
||||
|
||||
// Profile methods.
|
||||
PrefService* GetPrefs() override;
|
||||
const PrefService* GetPrefs() const override;
|
||||
|
||||
// CefBrowserContext methods.
|
||||
const CefRequestContextSettings& GetSettings() const override;
|
||||
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
||||
@@ -89,7 +94,10 @@ class CefBrowserContextImpl : public CefBrowserContext {
|
||||
content::URLRequestInterceptorScopedVector request_interceptors)
|
||||
override;
|
||||
HostContentSettingsMap* GetHostContentSettingsMap() override;
|
||||
PrefService* GetPrefs() override;
|
||||
void AddVisitedURLs(const std::vector<GURL>& urls) override;
|
||||
|
||||
// visitedlink::VisitedLinkDelegate methods.
|
||||
void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override;
|
||||
|
||||
// Guaranteed to exist once this object has been initialized.
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context() const {
|
||||
@@ -112,7 +120,6 @@ class CefBrowserContextImpl : public CefBrowserContext {
|
||||
typedef std::vector<const CefBrowserContextProxy*> ProxyList;
|
||||
ProxyList proxy_list_;
|
||||
|
||||
scoped_refptr<CefBrowserPrefStore> pref_store_;
|
||||
scoped_ptr<PrefService> pref_service_;
|
||||
scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
|
||||
|
||||
@@ -121,6 +128,9 @@ class CefBrowserContextImpl : public CefBrowserContext {
|
||||
scoped_ptr<content::PermissionManager> permission_manager_;
|
||||
scoped_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
|
||||
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
|
||||
scoped_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;
|
||||
// |visitedlink_listener_| is owned by visitedlink_master_.
|
||||
CefVisitedLinkListener* visitedlink_listener_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserContextImpl);
|
||||
};
|
||||
|
@@ -10,7 +10,9 @@
|
||||
#include "libcef/browser/url_request_context_getter_proxy.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "chrome/browser/font_family_cache.h"
|
||||
#include "components/guest_view/common/guest_view_constants.h"
|
||||
#include "components/visitedlink/browser/visitedlink_master.h"
|
||||
#include "content/browser/streams/stream_context.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
|
||||
@@ -24,9 +26,16 @@ bool ShouldProxyUserData(const void* key) {
|
||||
|
||||
// If this value is not proxied then CefBrowserContextImpl::GetGuestManager()
|
||||
// returns NULL.
|
||||
// See also CefExtensionsAPIClient::CreateGuestViewManagerDelegate.
|
||||
if (key == guest_view::kGuestViewManagerKeyName)
|
||||
return true;
|
||||
|
||||
// If this value is not proxied then there will be a use-after-free while
|
||||
// destroying the FontFamilyCache because it will try to access the
|
||||
// ProxyService owned by CefBrowserContextImpl (which has already been freed).
|
||||
if (key == kFontFamilyCacheKey)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -43,6 +52,8 @@ CefBrowserContextProxy::CefBrowserContextProxy(
|
||||
}
|
||||
|
||||
CefBrowserContextProxy::~CefBrowserContextProxy() {
|
||||
Shutdown();
|
||||
|
||||
parent_->RemoveProxy(this);
|
||||
}
|
||||
|
||||
@@ -142,6 +153,14 @@ content::PermissionManager* CefBrowserContextProxy::GetPermissionManager() {
|
||||
return parent_->GetPermissionManager();
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextProxy::GetPrefs() {
|
||||
return parent_->GetPrefs();
|
||||
}
|
||||
|
||||
const PrefService* CefBrowserContextProxy::GetPrefs() const {
|
||||
return parent_->GetPrefs();
|
||||
}
|
||||
|
||||
const CefRequestContextSettings& CefBrowserContextProxy::GetSettings() const {
|
||||
return parent_->GetSettings();
|
||||
}
|
||||
@@ -174,6 +193,6 @@ HostContentSettingsMap* CefBrowserContextProxy::GetHostContentSettingsMap() {
|
||||
return parent_->GetHostContentSettingsMap();
|
||||
}
|
||||
|
||||
PrefService* CefBrowserContextProxy::GetPrefs() {
|
||||
return parent_->GetPrefs();
|
||||
void CefBrowserContextProxy::AddVisitedURLs(const std::vector<GURL>& urls) {
|
||||
parent_->AddVisitedURLs(urls);
|
||||
}
|
||||
|
@@ -13,11 +13,6 @@
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
|
||||
namespace content {
|
||||
class DownloadManagerDelegate;
|
||||
class SpeechRecognitionPreferences;
|
||||
}
|
||||
|
||||
class CefDownloadManagerDelegate;
|
||||
class CefURLRequestContextGetterProxy;
|
||||
|
||||
@@ -56,6 +51,10 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::PermissionManager* GetPermissionManager() override;
|
||||
|
||||
// Profile methods.
|
||||
PrefService* GetPrefs() override;
|
||||
const PrefService* GetPrefs() const override;
|
||||
|
||||
// CefBrowserContext methods.
|
||||
const CefRequestContextSettings& GetSettings() const override;
|
||||
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
||||
@@ -70,7 +69,7 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
||||
content::URLRequestInterceptorScopedVector request_interceptors)
|
||||
override;
|
||||
HostContentSettingsMap* GetHostContentSettingsMap() override;
|
||||
PrefService* GetPrefs() override;
|
||||
void AddVisitedURLs(const std::vector<GURL>& urls) override;
|
||||
|
||||
scoped_refptr<CefBrowserContextImpl> parent() const {
|
||||
return parent_;
|
||||
|
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/browser_pref_store.h"
|
||||
#include "libcef/browser/chrome_scheme_handler.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
@@ -40,6 +39,7 @@
|
||||
#include "base/command_line.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "content/browser/gpu/compositor_util.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/common/view_messages.h"
|
||||
@@ -629,13 +629,13 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::GetBrowserForView(
|
||||
return GetBrowserForHost(render_view_host);
|
||||
} else {
|
||||
// Use the thread-safe approach.
|
||||
bool is_guest_view = false;
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefContentBrowserClient::Get()->GetBrowserInfoForView(
|
||||
render_process_id,
|
||||
render_routing_id);
|
||||
if (info.get()) {
|
||||
render_process_id, render_routing_id, &is_guest_view);
|
||||
if (info.get() && !is_guest_view) {
|
||||
CefRefPtr<CefBrowserHostImpl> browser = info->browser();
|
||||
if (!browser.get() && !info->is_mime_handler_view()) {
|
||||
if (!browser.get()) {
|
||||
LOG(WARNING) << "Found browser id " << info->browser_id() <<
|
||||
" but no browser object matching view process id " <<
|
||||
render_process_id << " and routing id " <<
|
||||
@@ -662,13 +662,13 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::GetBrowserForFrame(
|
||||
return GetBrowserForHost(render_frame_host);
|
||||
} else {
|
||||
// Use the thread-safe approach.
|
||||
bool is_guest_view = false;
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefContentBrowserClient::Get()->GetBrowserInfoForFrame(
|
||||
render_process_id,
|
||||
render_routing_id);
|
||||
if (info.get()) {
|
||||
render_process_id, render_routing_id, &is_guest_view);
|
||||
if (info.get() && !is_guest_view) {
|
||||
CefRefPtr<CefBrowserHostImpl> browser = info->browser();
|
||||
if (!browser.get() && !info->is_mime_handler_view()) {
|
||||
if (!browser.get()) {
|
||||
LOG(WARNING) << "Found browser id " << info->browser_id() <<
|
||||
" but no browser object matching frame process id " <<
|
||||
render_process_id << " and routing id " <<
|
||||
@@ -1713,26 +1713,10 @@ void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) {
|
||||
|
||||
void CefBrowserHostImpl::LoadRequest(int64 frame_id,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
CefNavigateParams params(GURL(std::string(request->GetURL())),
|
||||
ui::PAGE_TRANSITION_TYPED);
|
||||
params.method = request->GetMethod();
|
||||
CefNavigateParams params(GURL(), ui::PAGE_TRANSITION_TYPED);
|
||||
params.frame_id = frame_id;
|
||||
params.first_party_for_cookies =
|
||||
GURL(std::string(request->GetFirstPartyForCookies()));
|
||||
|
||||
CefRequest::HeaderMap headerMap;
|
||||
request->GetHeaderMap(headerMap);
|
||||
if (!headerMap.empty())
|
||||
params.headers = HttpHeaderUtils::GenerateHeaders(headerMap);
|
||||
|
||||
CefRefPtr<CefPostData> postData = request->GetPostData();
|
||||
if (postData.get()) {
|
||||
CefPostDataImpl* impl = static_cast<CefPostDataImpl*>(postData.get());
|
||||
params.upload_data = new net::UploadData();
|
||||
impl->Get(*params.upload_data.get());
|
||||
}
|
||||
|
||||
params.load_flags = request->GetFlags();
|
||||
static_cast<CefRequestImpl*>(request.get())->Get(params);
|
||||
|
||||
Navigate(params);
|
||||
}
|
||||
@@ -2220,6 +2204,8 @@ void CefBrowserHostImpl::DragSourceEndedAt(
|
||||
// content::WebContentsDelegate methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// |source| may be NULL if the navigation originates from a guest view via
|
||||
// CefContentBrowserClient::CanCreateWindow.
|
||||
content::WebContents* CefBrowserHostImpl::OpenURLFromTab(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params) {
|
||||
@@ -2484,12 +2470,17 @@ void CefBrowserHostImpl::WebContentsCreated(
|
||||
content::RenderFrameHost* main_frame_host = new_contents->GetMainFrame();
|
||||
|
||||
CefWindowHandle opener = kNullWindowHandle;
|
||||
bool is_guest_view = false;
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefContentBrowserClient::Get()->GetOrCreateBrowserInfo(
|
||||
view_host->GetProcess()->GetID(),
|
||||
view_host->GetRoutingID(),
|
||||
main_frame_host->GetProcess()->GetID(),
|
||||
main_frame_host->GetRoutingID());
|
||||
main_frame_host->GetRoutingID(),
|
||||
&is_guest_view);
|
||||
|
||||
// A CefBrowser should never be created for a guest view WebContents.
|
||||
CHECK(!is_guest_view);
|
||||
|
||||
if (source_contents) {
|
||||
DCHECK(info->is_popup());
|
||||
@@ -2644,21 +2635,23 @@ bool CefBrowserHostImpl::CheckMediaAccessPermission(
|
||||
|
||||
void CefBrowserHostImpl::RenderFrameCreated(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
browser_info_->add_render_frame_id(render_frame_host->GetProcess()->GetID(),
|
||||
render_frame_host->GetRoutingID());
|
||||
browser_info_->render_id_manager()->add_render_frame_id(
|
||||
render_frame_host->GetProcess()->GetID(),
|
||||
render_frame_host->GetRoutingID());
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::RenderFrameDeleted(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
browser_info_->remove_render_frame_id(
|
||||
browser_info_->render_id_manager()->remove_render_frame_id(
|
||||
render_frame_host->GetProcess()->GetID(),
|
||||
render_frame_host->GetRoutingID());
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::RenderViewCreated(
|
||||
content::RenderViewHost* render_view_host) {
|
||||
browser_info_->add_render_view_id(render_view_host->GetProcess()->GetID(),
|
||||
render_view_host->GetRoutingID());
|
||||
browser_info_->render_id_manager()->add_render_view_id(
|
||||
render_view_host->GetProcess()->GetID(),
|
||||
render_view_host->GetRoutingID());
|
||||
|
||||
// May be already registered if the renderer crashed previously.
|
||||
if (!registrar_->IsRegistered(
|
||||
@@ -2671,8 +2664,9 @@ void CefBrowserHostImpl::RenderViewCreated(
|
||||
|
||||
void CefBrowserHostImpl::RenderViewDeleted(
|
||||
content::RenderViewHost* render_view_host) {
|
||||
browser_info_->remove_render_view_id(render_view_host->GetProcess()->GetID(),
|
||||
render_view_host->GetRoutingID());
|
||||
browser_info_->render_id_manager()->remove_render_view_id(
|
||||
render_view_host->GetProcess()->GetID(),
|
||||
render_view_host->GetRoutingID());
|
||||
|
||||
if (registrar_->IsRegistered(
|
||||
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||
@@ -2789,9 +2783,29 @@ void CefBrowserHostImpl::FrameDeleted(
|
||||
focused_frame_id_ = CefFrameHostImpl::kInvalidFrameId;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidNavigateAnyFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const content::LoadCommittedDetails& details,
|
||||
const content::FrameNavigateParams& params) {
|
||||
if (!web_contents())
|
||||
return;
|
||||
|
||||
scoped_refptr<CefBrowserContext> context =
|
||||
static_cast<CefBrowserContext*>(web_contents()->GetBrowserContext());
|
||||
if (!context.get())
|
||||
return;
|
||||
|
||||
context->AddVisitedURLs(params.redirects);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::TitleWasSet(content::NavigationEntry* entry,
|
||||
bool explicit_set) {
|
||||
OnTitleChange(entry->GetTitle());
|
||||
// |entry| may be NULL if a popup is created via window.open and never
|
||||
// navigated.
|
||||
if (entry)
|
||||
OnTitleChange(entry->GetTitle());
|
||||
else if (web_contents())
|
||||
OnTitleChange(web_contents()->GetTitle());
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::PluginCrashed(const base::FilePath& plugin_path,
|
||||
@@ -3039,6 +3053,7 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
||||
CefString(), CefString(),
|
||||
CefFrameHostImpl::kInvalidFrameId);
|
||||
|
||||
PrefsTabHelper::CreateForWebContents(web_contents_.get());
|
||||
printing::PrintViewManager::CreateForWebContents(web_contents_.get());
|
||||
|
||||
// Make sure RenderViewCreated is called at least one time.
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_client.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/frame_host_impl.h"
|
||||
#include "libcef/browser/javascript_dialog_manager.h"
|
||||
#include "libcef/browser/menu_creator.h"
|
||||
@@ -303,6 +304,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// Thread safe accessors.
|
||||
const CefBrowserSettings& settings() const { return settings_; }
|
||||
CefRefPtr<CefClient> client() const { return client_; }
|
||||
scoped_refptr<CefBrowserInfo> browser_info() const { return browser_info_; }
|
||||
int browser_id() const;
|
||||
|
||||
#if defined(USE_AURA)
|
||||
@@ -471,6 +473,10 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
bool was_ignored_by_handler) override;
|
||||
void FrameDeleted(
|
||||
content::RenderFrameHost* render_frame_host) override;
|
||||
void DidNavigateAnyFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const content::LoadCommittedDetails& details,
|
||||
const content::FrameNavigateParams& params) override;
|
||||
void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override;
|
||||
void PluginCrashed(const base::FilePath& plugin_path,
|
||||
base::ProcessId plugin_pid) override;
|
||||
|
@@ -440,8 +440,12 @@ void RunOpenFileDialog(const CefBrowserHostImpl::FileChooserParams& params,
|
||||
[openPanel setShowsHiddenFiles:!params.hidereadonly];
|
||||
|
||||
// Show panel.
|
||||
[openPanel beginSheetModalForWindow:[view window] completionHandler:nil];
|
||||
if ([openPanel runModal] == NSFileHandlingPanelOKButton) {
|
||||
[openPanel beginSheetModalForWindow:[view window]
|
||||
completionHandler:^(NSInteger returnCode) {
|
||||
[NSApp stopModalWithCode:returnCode];
|
||||
}];
|
||||
NSInteger result = [NSApp runModalForWindow:[view window]];
|
||||
if (result == NSFileHandlingPanelOKButton) {
|
||||
NSArray *urls = [openPanel URLs];
|
||||
int i, count = [urls count];
|
||||
for (i=0; i<count; i++) {
|
||||
@@ -453,8 +457,6 @@ void RunOpenFileDialog(const CefBrowserHostImpl::FileChooserParams& params,
|
||||
|
||||
if (filter_delegate != nil)
|
||||
*filter_index = [filter_delegate filter];
|
||||
|
||||
[NSApp endSheet:openPanel];
|
||||
}
|
||||
|
||||
bool RunSaveFileDialog(const CefBrowserHostImpl::FileChooserParams& params,
|
||||
@@ -503,9 +505,14 @@ bool RunSaveFileDialog(const CefBrowserHostImpl::FileChooserParams& params,
|
||||
|
||||
bool success = false;
|
||||
|
||||
[savePanel beginSheetModalForWindow:[view window] completionHandler:nil];
|
||||
if ([savePanel runModal] == NSFileHandlingPanelOKButton) {
|
||||
NSURL * url = [savePanel URL];
|
||||
// Show panel.
|
||||
[savePanel beginSheetModalForWindow:[view window]
|
||||
completionHandler:^(NSInteger resultCode) {
|
||||
[NSApp stopModalWithCode:resultCode];
|
||||
}];
|
||||
NSInteger result = [NSApp runModalForWindow:[view window]];
|
||||
if (result == NSFileHandlingPanelOKButton) {
|
||||
NSURL* url = [savePanel URL];
|
||||
NSString* path = [url path];
|
||||
*file = base::FilePath([path UTF8String]);
|
||||
success = true;
|
||||
@@ -514,8 +521,6 @@ bool RunSaveFileDialog(const CefBrowserHostImpl::FileChooserParams& params,
|
||||
if (filter_delegate != nil)
|
||||
*filter_index = [filter_delegate filter];
|
||||
|
||||
[NSApp endSheet:savePanel];
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@@ -3,78 +3,59 @@
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/browser_info.h"
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
||||
#include "ipc/ipc_message.h"
|
||||
|
||||
CefBrowserInfo::CefBrowserInfo(int browser_id, bool is_popup)
|
||||
: browser_id_(browser_id),
|
||||
is_popup_(is_popup),
|
||||
is_windowless_(false),
|
||||
is_mime_handler_view_(false) {
|
||||
DCHECK_GT(browser_id, 0);
|
||||
// CefBrowserInfo::RenderIDManager
|
||||
|
||||
CefBrowserInfo::RenderIDManager::RenderIDManager(base::Lock* lock)
|
||||
: lock_(lock) {
|
||||
DCHECK(lock);
|
||||
}
|
||||
|
||||
CefBrowserInfo::~CefBrowserInfo() {
|
||||
}
|
||||
|
||||
void CefBrowserInfo::set_windowless(bool windowless) {
|
||||
is_windowless_ = windowless;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::set_mime_handler_view(bool mime_handler_view) {
|
||||
is_mime_handler_view_ = mime_handler_view;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::add_render_view_id(
|
||||
void CefBrowserInfo::RenderIDManager::add_render_view_id(
|
||||
int render_process_id, int render_routing_id) {
|
||||
add_render_id(&render_view_id_set_, render_process_id, render_routing_id);
|
||||
}
|
||||
|
||||
void CefBrowserInfo::add_render_frame_id(
|
||||
void CefBrowserInfo::RenderIDManager::add_render_frame_id(
|
||||
int render_process_id, int render_routing_id) {
|
||||
add_render_id(&render_frame_id_set_, render_process_id, render_routing_id);
|
||||
}
|
||||
|
||||
void CefBrowserInfo::remove_render_view_id(
|
||||
void CefBrowserInfo::RenderIDManager::remove_render_view_id(
|
||||
int render_process_id, int render_routing_id) {
|
||||
remove_render_id(&render_view_id_set_, render_process_id, render_routing_id);
|
||||
}
|
||||
|
||||
void CefBrowserInfo::remove_render_frame_id(
|
||||
void CefBrowserInfo::RenderIDManager::remove_render_frame_id(
|
||||
int render_process_id, int render_routing_id) {
|
||||
remove_render_id(&render_frame_id_set_, render_process_id, render_routing_id);
|
||||
}
|
||||
|
||||
bool CefBrowserInfo::is_render_view_id_match(
|
||||
bool CefBrowserInfo::RenderIDManager::is_render_view_id_match(
|
||||
int render_process_id, int render_routing_id) {
|
||||
return is_render_id_match(&render_view_id_set_,
|
||||
render_process_id,
|
||||
render_routing_id);
|
||||
}
|
||||
|
||||
bool CefBrowserInfo::is_render_frame_id_match(
|
||||
bool CefBrowserInfo::RenderIDManager::is_render_frame_id_match(
|
||||
int render_process_id, int render_routing_id) {
|
||||
return is_render_id_match(&render_frame_id_set_,
|
||||
render_process_id,
|
||||
render_routing_id);
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> CefBrowserInfo::browser() {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
return browser_;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::set_browser(CefRefPtr<CefBrowserHostImpl> browser) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
browser_ = browser;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::add_render_id(RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
void CefBrowserInfo::RenderIDManager::add_render_id(RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
DCHECK_GT(render_process_id, 0);
|
||||
DCHECK_GT(render_routing_id, 0);
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
base::AutoLock lock_scope(*lock_);
|
||||
|
||||
if (!id_set->empty()) {
|
||||
RenderIdSet::const_iterator it =
|
||||
@@ -86,13 +67,13 @@ void CefBrowserInfo::add_render_id(RenderIdSet* id_set,
|
||||
id_set->insert(std::make_pair(render_process_id, render_routing_id));
|
||||
}
|
||||
|
||||
void CefBrowserInfo::remove_render_id(RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
void CefBrowserInfo::RenderIDManager::remove_render_id(RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
DCHECK_GT(render_process_id, 0);
|
||||
DCHECK_GT(render_routing_id, 0);
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
base::AutoLock lock_scope(*lock_);
|
||||
|
||||
DCHECK(!id_set->empty());
|
||||
if (id_set->empty())
|
||||
@@ -103,10 +84,11 @@ void CefBrowserInfo::remove_render_id(RenderIdSet* id_set,
|
||||
DCHECK(erased);
|
||||
}
|
||||
|
||||
bool CefBrowserInfo::is_render_id_match(const RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
bool CefBrowserInfo::RenderIDManager::is_render_id_match(
|
||||
const RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id) {
|
||||
base::AutoLock lock_scope(*lock_);
|
||||
|
||||
if (id_set->empty())
|
||||
return false;
|
||||
@@ -115,3 +97,32 @@ bool CefBrowserInfo::is_render_id_match(const RenderIdSet* id_set,
|
||||
id_set->find(std::make_pair(render_process_id, render_routing_id));
|
||||
return (it != id_set->end());
|
||||
}
|
||||
|
||||
|
||||
// CefBrowserInfo
|
||||
|
||||
CefBrowserInfo::CefBrowserInfo(int browser_id, bool is_popup)
|
||||
: browser_id_(browser_id),
|
||||
is_popup_(is_popup),
|
||||
is_windowless_(false),
|
||||
render_id_manager_(&lock_),
|
||||
guest_render_id_manager_(&lock_) {
|
||||
DCHECK_GT(browser_id, 0);
|
||||
}
|
||||
|
||||
CefBrowserInfo::~CefBrowserInfo() {
|
||||
}
|
||||
|
||||
void CefBrowserInfo::set_windowless(bool windowless) {
|
||||
is_windowless_ = windowless;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> CefBrowserInfo::browser() {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
return browser_;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::set_browser(CefRefPtr<CefBrowserHostImpl> browser) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
browser_ = browser;
|
||||
}
|
||||
|
@@ -8,8 +8,12 @@
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "include/internal/cef_ptr.h"
|
||||
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
|
||||
class CefBrowserHostImpl;
|
||||
|
||||
// CefBrowserInfo is used to associate a browser ID and render view/process
|
||||
// IDs with a particular CefBrowserHostImpl. Render view/process IDs may change
|
||||
@@ -19,27 +23,70 @@
|
||||
// be created directly.
|
||||
class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
public:
|
||||
class RenderIDManager {
|
||||
public:
|
||||
explicit RenderIDManager(base::Lock* lock);
|
||||
|
||||
// Adds an ID pair if it doesn't already exist.
|
||||
void add_render_view_id(int render_process_id, int render_routing_id);
|
||||
void add_render_frame_id(int render_process_id, int render_routing_id);
|
||||
|
||||
// Remove an ID pair if it exists.
|
||||
void remove_render_view_id(int render_process_id, int render_routing_id);
|
||||
void remove_render_frame_id(int render_process_id, int render_routing_id);
|
||||
|
||||
// Returns true if this browser matches the specified ID pair.
|
||||
bool is_render_view_id_match(int render_process_id, int render_routing_id);
|
||||
bool is_render_frame_id_match(int render_process_id, int render_routing_id);
|
||||
|
||||
private:
|
||||
typedef std::set<std::pair<int, int> > RenderIdSet;
|
||||
|
||||
void add_render_id(RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id);
|
||||
void remove_render_id(RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id);
|
||||
bool is_render_id_match(const RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id);
|
||||
|
||||
base::Lock* lock_;
|
||||
|
||||
// The below members must be protected by |lock_|.
|
||||
|
||||
// Set of mapped (process_id, routing_id) pairs. Keeping this set is
|
||||
// necessary for the following reasons:
|
||||
// 1. When navigating cross-origin the new (pending) RenderViewHost will be
|
||||
// created before the old (current) RenderViewHost is destroyed.
|
||||
// 2. When canceling and asynchronously continuing navigation of the same
|
||||
// URL a new RenderViewHost may be created for the first (canceled)
|
||||
// navigation and then destroyed as a result of the second (allowed)
|
||||
// navigation.
|
||||
// 3. Out-of-process iframes have their own render IDs which must also be
|
||||
// associated with the host browser.
|
||||
RenderIdSet render_view_id_set_;
|
||||
RenderIdSet render_frame_id_set_;
|
||||
};
|
||||
|
||||
CefBrowserInfo(int browser_id, bool is_popup);
|
||||
|
||||
int browser_id() const { return browser_id_; };
|
||||
bool is_popup() const { return is_popup_; }
|
||||
bool is_windowless() const { return is_windowless_; }
|
||||
bool is_mime_handler_view() const { return is_mime_handler_view_; }
|
||||
|
||||
void set_windowless(bool windowless);
|
||||
void set_mime_handler_view(bool mime_handler_view);
|
||||
|
||||
// Adds an ID pair if it doesn't already exist.
|
||||
void add_render_view_id(int render_process_id, int render_routing_id);
|
||||
void add_render_frame_id(int render_process_id, int render_routing_id);
|
||||
// Returns the render ID manager for this browser.
|
||||
RenderIDManager* render_id_manager() {
|
||||
return &render_id_manager_;
|
||||
}
|
||||
|
||||
// Remove an ID pair if it exists.
|
||||
void remove_render_view_id(int render_process_id, int render_routing_id);
|
||||
void remove_render_frame_id(int render_process_id, int render_routing_id);
|
||||
|
||||
// Returns true if this browser matches the specified ID pair.
|
||||
bool is_render_view_id_match(int render_process_id, int render_routing_id);
|
||||
bool is_render_frame_id_match(int render_process_id, int render_routing_id);
|
||||
// Returns the render ID manager for guest views owned by this browser.
|
||||
RenderIDManager* guest_render_id_manager() {
|
||||
return &guest_render_id_manager_;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser();
|
||||
void set_browser(CefRefPtr<CefBrowserHostImpl> browser);
|
||||
@@ -49,38 +96,16 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
|
||||
~CefBrowserInfo();
|
||||
|
||||
typedef std::set<std::pair<int, int> > RenderIdSet;
|
||||
|
||||
void add_render_id(RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id);
|
||||
void remove_render_id(RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id);
|
||||
bool is_render_id_match(const RenderIdSet* id_set,
|
||||
int render_process_id,
|
||||
int render_routing_id);
|
||||
|
||||
int browser_id_;
|
||||
bool is_popup_;
|
||||
bool is_windowless_;
|
||||
bool is_mime_handler_view_;
|
||||
|
||||
base::Lock lock_;
|
||||
|
||||
// The below members must be protected by |lock_|.
|
||||
|
||||
// Set of mapped (process_id, routing_id) pairs. Keeping this set is
|
||||
// necessary for the following reasons:
|
||||
// 1. When navigating cross-origin the new (pending) RenderViewHost will be
|
||||
// created before the old (current) RenderViewHost is destroyed.
|
||||
// 2. When canceling and asynchronously continuing navigation of the same URL
|
||||
// a new RenderViewHost may be created for the first (canceled) navigation
|
||||
// and then destroyed as a result of the second (allowed) navigation.
|
||||
// 3. Out-of-process iframes have their own render IDs which must also be
|
||||
// associated with the host browser.
|
||||
RenderIdSet render_view_id_set_;
|
||||
RenderIdSet render_frame_id_set_;
|
||||
RenderIDManager render_id_manager_;
|
||||
RenderIDManager guest_render_id_manager_;
|
||||
|
||||
// May be NULL if the browser has not yet been created or if the browser has
|
||||
// been destroyed.
|
||||
|
@@ -97,11 +97,11 @@ void CefBrowserMessageFilter::OnGetNewBrowserInfo(
|
||||
host_->GetID(),
|
||||
render_view_routing_id,
|
||||
host_->GetID(),
|
||||
render_frame_routing_id);
|
||||
render_frame_routing_id,
|
||||
¶ms->is_guest_view);
|
||||
params->browser_id = info->browser_id();
|
||||
params->is_popup = info->is_popup();
|
||||
params->is_windowless = info->is_windowless();
|
||||
params->is_mime_handler_view = info->is_mime_handler_view();
|
||||
}
|
||||
|
||||
void CefBrowserMessageFilter::OnCreateWindow(
|
||||
|
@@ -1,25 +0,0 @@
|
||||
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_PREF_STORE_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_PREF_STORE_H_
|
||||
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/prefs/testing_pref_store.h"
|
||||
|
||||
class PrefService;
|
||||
|
||||
class CefBrowserPrefStore : public TestingPrefStore {
|
||||
public:
|
||||
CefBrowserPrefStore();
|
||||
|
||||
scoped_ptr<PrefService> CreateService();
|
||||
|
||||
protected:
|
||||
~CefBrowserPrefStore() override;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserPrefStore);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_PREF_STORE_H_
|
@@ -1,128 +0,0 @@
|
||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/browser_settings.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "content/public/common/web_preferences.h"
|
||||
|
||||
// Set default preferences based on CEF command-line flags. Chromium command-
|
||||
// line flags should not exist for these preferences.
|
||||
void SetDefaults(content::WebPreferences& web) {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
|
||||
if (command_line->HasSwitch(switches::kDefaultEncoding)) {
|
||||
web.default_encoding =
|
||||
command_line->GetSwitchValueASCII(switches::kDefaultEncoding);
|
||||
}
|
||||
|
||||
web.javascript_can_open_windows_automatically =
|
||||
!command_line->HasSwitch(switches::kDisableJavascriptOpenWindows);
|
||||
web.allow_scripts_to_close_windows =
|
||||
!command_line->HasSwitch(switches::kDisableJavascriptCloseWindows);
|
||||
web.javascript_can_access_clipboard =
|
||||
!command_line->HasSwitch(switches::kDisableJavascriptAccessClipboard);
|
||||
web.dom_paste_enabled =
|
||||
!command_line->HasSwitch(switches::kDisableJavascriptDomPaste);
|
||||
web.caret_browsing_enabled =
|
||||
command_line->HasSwitch(switches::kEnableCaretBrowsing);
|
||||
web.allow_universal_access_from_file_urls =
|
||||
command_line->HasSwitch(switches::kAllowUniversalAccessFromFileUrls);
|
||||
web.loads_images_automatically =
|
||||
!command_line->HasSwitch(switches::kDisableImageLoading);
|
||||
web.shrinks_standalone_images_to_fit =
|
||||
command_line->HasSwitch(switches::kImageShrinkStandaloneToFit);
|
||||
web.text_areas_are_resizable =
|
||||
!command_line->HasSwitch(switches::kDisableTextAreaResize);
|
||||
web.tabs_to_links =
|
||||
!command_line->HasSwitch(switches::kDisableTabToLinks);
|
||||
}
|
||||
|
||||
// Helper macro for setting a WebPreferences variable based on the value of a
|
||||
// CefBrowserSettings variable.
|
||||
#define SET_STATE(cef_var, web_var) \
|
||||
if (cef_var == STATE_ENABLED) \
|
||||
web_var = true; \
|
||||
else if (cef_var == STATE_DISABLED) \
|
||||
web_var = false;
|
||||
|
||||
// Use the preferences from WebContentsImpl::GetWebkitPrefs and the
|
||||
// WebPreferences constructor by default. Only override features that are
|
||||
// explicitly enabled or disabled.
|
||||
void BrowserToWebSettings(const CefBrowserSettings& cef,
|
||||
content::WebPreferences& web) {
|
||||
SetDefaults(web);
|
||||
|
||||
if (cef.standard_font_family.length > 0) {
|
||||
web.standard_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.standard_font_family);
|
||||
}
|
||||
if (cef.fixed_font_family.length > 0) {
|
||||
web.fixed_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.fixed_font_family);
|
||||
}
|
||||
if (cef.serif_font_family.length > 0) {
|
||||
web.serif_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.serif_font_family);
|
||||
}
|
||||
if (cef.sans_serif_font_family.length > 0) {
|
||||
web.sans_serif_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.sans_serif_font_family);
|
||||
}
|
||||
if (cef.cursive_font_family.length > 0) {
|
||||
web.cursive_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.cursive_font_family);
|
||||
}
|
||||
if (cef.fantasy_font_family.length > 0) {
|
||||
web.fantasy_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.fantasy_font_family);
|
||||
}
|
||||
|
||||
if (cef.default_font_size > 0)
|
||||
web.default_font_size = cef.default_font_size;
|
||||
if (cef.default_fixed_font_size > 0)
|
||||
web.default_fixed_font_size = cef.default_fixed_font_size;
|
||||
if (cef.minimum_font_size > 0)
|
||||
web.minimum_font_size = cef.minimum_font_size;
|
||||
if (cef.minimum_logical_font_size > 0)
|
||||
web.minimum_logical_font_size = cef.minimum_logical_font_size;
|
||||
|
||||
if (cef.default_encoding.length > 0)
|
||||
web.default_encoding = CefString(&cef.default_encoding);
|
||||
|
||||
SET_STATE(cef.remote_fonts, web.remote_fonts_enabled);
|
||||
SET_STATE(cef.javascript, web.javascript_enabled);
|
||||
SET_STATE(cef.javascript_open_windows,
|
||||
web.javascript_can_open_windows_automatically);
|
||||
SET_STATE(cef.javascript_close_windows, web.allow_scripts_to_close_windows);
|
||||
SET_STATE(cef.javascript_access_clipboard,
|
||||
web.javascript_can_access_clipboard);
|
||||
SET_STATE(cef.javascript_dom_paste, web.dom_paste_enabled);
|
||||
SET_STATE(cef.caret_browsing, web.caret_browsing_enabled);
|
||||
SET_STATE(cef.plugins, web.plugins_enabled);
|
||||
SET_STATE(cef.universal_access_from_file_urls,
|
||||
web.allow_universal_access_from_file_urls);
|
||||
SET_STATE(cef.file_access_from_file_urls,
|
||||
web.allow_file_access_from_file_urls);
|
||||
SET_STATE(cef.web_security, web.web_security_enabled);
|
||||
SET_STATE(cef.image_loading, web.loads_images_automatically);
|
||||
SET_STATE(cef.image_shrink_standalone_to_fit,
|
||||
web.shrinks_standalone_images_to_fit);
|
||||
SET_STATE(cef.text_area_resize, web.text_areas_are_resizable);
|
||||
SET_STATE(cef.tab_to_links, web.tabs_to_links);
|
||||
SET_STATE(cef.local_storage, web.local_storage_enabled);
|
||||
SET_STATE(cef.databases, web.databases_enabled);
|
||||
SET_STATE(cef.application_cache, web.application_cache_enabled);
|
||||
|
||||
// Never explicitly enable GPU-related functions in this method because the
|
||||
// GPU blacklist is not being checked here.
|
||||
if (cef.webgl == STATE_DISABLED)
|
||||
web.experimental_webgl_enabled = false;
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_SETTINGS_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_SETTINGS_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
|
||||
namespace content {
|
||||
struct WebPreferences;
|
||||
}
|
||||
|
||||
void BrowserToWebSettings(const CefBrowserSettings& cef,
|
||||
content::WebPreferences& web);
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_SETTINGS_H_
|
@@ -11,7 +11,6 @@
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/url_request_user_data.h"
|
||||
#include "libcef/common/http_header_utils.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/response_impl.h"
|
||||
|
||||
@@ -21,9 +20,7 @@
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/common/url_fetcher.h"
|
||||
#include "net/base/io_buffer.h"
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "net/http/http_request_headers.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/url_request/url_fetcher.h"
|
||||
#include "net/url_request/url_fetcher_delegate.h"
|
||||
@@ -208,116 +205,24 @@ class CefBrowserURLRequest::Context
|
||||
net::URLFetcher::RequestType request_type) {
|
||||
DCHECK(CalledOnValidThread());
|
||||
|
||||
fetcher_delegate_.reset(
|
||||
new CefURLFetcherDelegate(this, request_->GetFlags()));
|
||||
int request_flags = request_->GetFlags();
|
||||
|
||||
fetcher_delegate_.reset(new CefURLFetcherDelegate(this, request_flags));
|
||||
fetcher_ = net::URLFetcher::Create(url, request_type,
|
||||
fetcher_delegate_.get());
|
||||
|
||||
DCHECK(url_request_getter_.get());
|
||||
fetcher_->SetRequestContext(url_request_getter_.get());
|
||||
|
||||
CefRequest::HeaderMap headerMap;
|
||||
request_->GetHeaderMap(headerMap);
|
||||
|
||||
// Extract the Referer header value.
|
||||
{
|
||||
CefString referrerStr;
|
||||
referrerStr.FromASCII(net::HttpRequestHeaders::kReferer);
|
||||
CefRequest::HeaderMap::iterator it = headerMap.find(referrerStr);
|
||||
if (it == headerMap.end()) {
|
||||
fetcher_->SetReferrer("");
|
||||
} else {
|
||||
fetcher_->SetReferrer(it->second);
|
||||
headerMap.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
std::string content_type;
|
||||
|
||||
// Extract the Content-Type header value.
|
||||
{
|
||||
CefString contentTypeStr;
|
||||
contentTypeStr.FromASCII(net::HttpRequestHeaders::kContentType);
|
||||
CefRequest::HeaderMap::iterator it = headerMap.find(contentTypeStr);
|
||||
if (it != headerMap.end()) {
|
||||
content_type = it->second;
|
||||
headerMap.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
int64 upload_data_size = 0;
|
||||
|
||||
CefRefPtr<CefPostData> post_data = request_->GetPostData();
|
||||
if (post_data.get()) {
|
||||
CefPostData::ElementVector elements;
|
||||
post_data->GetElements(elements);
|
||||
if (elements.size() == 1) {
|
||||
// Default to URL encoding if not specified.
|
||||
if (content_type.empty())
|
||||
content_type = "application/x-www-form-urlencoded";
|
||||
|
||||
CefPostDataElementImpl* impl =
|
||||
static_cast<CefPostDataElementImpl*>(elements[0].get());
|
||||
|
||||
switch (elements[0]->GetType())
|
||||
case PDE_TYPE_BYTES: {
|
||||
upload_data_size = impl->GetBytesCount();
|
||||
fetcher_->SetUploadData(content_type,
|
||||
std::string(static_cast<char*>(impl->GetBytes()),
|
||||
upload_data_size));
|
||||
break;
|
||||
case PDE_TYPE_FILE:
|
||||
fetcher_->SetUploadFilePath(
|
||||
content_type,
|
||||
base::FilePath(impl->GetFile()),
|
||||
0, kuint64max,
|
||||
content::BrowserThread::GetMessageLoopProxyForThread(
|
||||
content::BrowserThread::FILE).get());
|
||||
break;
|
||||
case PDE_TYPE_EMPTY:
|
||||
break;
|
||||
}
|
||||
} else if (elements.size() > 1) {
|
||||
NOTIMPLEMENTED() << " multi-part form data is not supported";
|
||||
}
|
||||
}
|
||||
|
||||
std::string first_party_for_cookies = request_->GetFirstPartyForCookies();
|
||||
if (!first_party_for_cookies.empty())
|
||||
fetcher_->SetFirstPartyForCookies(GURL(first_party_for_cookies));
|
||||
|
||||
int cef_flags = request_->GetFlags();
|
||||
|
||||
if (cef_flags & UR_FLAG_NO_RETRY_ON_5XX)
|
||||
fetcher_->SetAutomaticallyRetryOn5xx(false);
|
||||
|
||||
int load_flags = 0;
|
||||
|
||||
if (cef_flags & UR_FLAG_SKIP_CACHE)
|
||||
load_flags |= net::LOAD_BYPASS_CACHE;
|
||||
|
||||
if (!(cef_flags & UR_FLAG_ALLOW_CACHED_CREDENTIALS)) {
|
||||
load_flags |= net::LOAD_DO_NOT_SEND_AUTH_DATA;
|
||||
load_flags |= net::LOAD_DO_NOT_SEND_COOKIES;
|
||||
load_flags |= net::LOAD_DO_NOT_SAVE_COOKIES;
|
||||
}
|
||||
|
||||
if (cef_flags & UR_FLAG_REPORT_UPLOAD_PROGRESS) {
|
||||
upload_data_size_ = upload_data_size;
|
||||
}
|
||||
|
||||
fetcher_->SetLoadFlags(load_flags);
|
||||
|
||||
fetcher_->SetExtraRequestHeaders(
|
||||
HttpHeaderUtils::GenerateHeaders(headerMap));
|
||||
static_cast<CefRequestImpl*>(request_.get())->Get(*fetcher_,
|
||||
upload_data_size_);
|
||||
|
||||
fetcher_->SetURLRequestUserData(
|
||||
CefURLRequestUserData::kUserDataKey,
|
||||
base::Bind(&CreateURLRequestUserData, client_));
|
||||
|
||||
scoped_ptr<net::URLFetcherResponseWriter> response_writer;
|
||||
if (cef_flags & UR_FLAG_NO_DOWNLOAD_DATA) {
|
||||
if (request_flags & UR_FLAG_NO_DOWNLOAD_DATA) {
|
||||
response_writer.reset(new CefURLFetcherResponseWriter(NULL, NULL));
|
||||
} else {
|
||||
response_writer.reset(
|
||||
|
@@ -12,8 +12,8 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
|
||||
// This file provides a stub implementation of chrome::BrowserProcess so that
|
||||
// PrintJobWorker can determine the current locale.
|
||||
// This file provides a stub implementation of Chrome's BrowserProcess object
|
||||
// for use as an interop layer between CEF and files that live in chrome/.
|
||||
|
||||
class BackgroundModeManager {
|
||||
public:
|
||||
|
222
libcef/browser/chrome_profile_stub.cc
Normal file
222
libcef/browser/chrome_profile_stub.cc
Normal file
@@ -0,0 +1,222 @@
|
||||
// Copyright (c) 2015 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/chrome_profile_stub.h"
|
||||
|
||||
// Profile implementation.
|
||||
// Based on chrome/browser/profiles/profile.cc.
|
||||
|
||||
Profile::Profile() {
|
||||
}
|
||||
|
||||
Profile::~Profile() {
|
||||
}
|
||||
|
||||
// static
|
||||
Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) {
|
||||
// This is safe; this is the only implementation of the browser context.
|
||||
return static_cast<Profile*>(browser_context);
|
||||
}
|
||||
|
||||
// static
|
||||
Profile* Profile::FromWebUI(content::WebUI* web_ui) {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TestingProfile* Profile::AsTestingProfile() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ChromeZoomLevelPrefs* Profile::GetZoomLevelPrefs() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// static
|
||||
void Profile::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
std::string Profile::GetDebugName() {
|
||||
NOTIMPLEMENTED();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
bool Profile::IsGuestSession() const {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Profile::IsSystemProfile() const {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Profile::IsNewProfile() {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Profile::IsSyncAllowed() {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
void Profile::MaybeSendDestroyedNotification() {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
bool ProfileCompare::operator()(Profile* a, Profile* b) const {
|
||||
DCHECK(a && b);
|
||||
if (a->IsSameProfile(b))
|
||||
return false;
|
||||
return a->GetOriginalProfile() < b->GetOriginalProfile();
|
||||
}
|
||||
|
||||
double Profile::GetDefaultZoomLevelForProfile() {
|
||||
NOTIMPLEMENTED();
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
// ChromeProfileStub implementation.
|
||||
|
||||
ChromeProfileStub::ChromeProfileStub(){
|
||||
}
|
||||
|
||||
ChromeProfileStub::~ChromeProfileStub() {
|
||||
}
|
||||
|
||||
scoped_refptr<base::SequencedTaskRunner> ChromeProfileStub::GetIOTaskRunner() {
|
||||
NOTIMPLEMENTED();
|
||||
return scoped_refptr<base::SequencedTaskRunner>();
|
||||
}
|
||||
|
||||
std::string ChromeProfileStub::GetProfileUserName() const {
|
||||
NOTIMPLEMENTED();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
Profile::ProfileType ChromeProfileStub::GetProfileType() const {
|
||||
NOTIMPLEMENTED();
|
||||
return REGULAR_PROFILE;
|
||||
}
|
||||
|
||||
Profile* ChromeProfileStub::GetOffTheRecordProfile() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ChromeProfileStub::DestroyOffTheRecordProfile() {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::HasOffTheRecordProfile() {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
Profile* ChromeProfileStub::GetOriginalProfile() {
|
||||
return this;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsSupervised() const {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsChild() const {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsLegacySupervised() const {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
ExtensionSpecialStoragePolicy*
|
||||
ChromeProfileStub::GetExtensionSpecialStoragePolicy() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PrefService* ChromeProfileStub::GetOffTheRecordPrefs() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter*
|
||||
ChromeProfileStub::GetRequestContextForExtensions() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net::SSLConfigService* ChromeProfileStub::GetSSLConfigService() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsSameProfile(Profile* profile) {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
base::Time ChromeProfileStub::GetStartTime() const {
|
||||
NOTIMPLEMENTED();
|
||||
return base::Time();
|
||||
}
|
||||
|
||||
base::FilePath ChromeProfileStub::last_selected_directory() {
|
||||
NOTIMPLEMENTED();
|
||||
return base::FilePath();
|
||||
}
|
||||
|
||||
void ChromeProfileStub::set_last_selected_directory(
|
||||
const base::FilePath& path) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
PrefProxyConfigTracker* ChromeProfileStub::GetProxyConfigTracker() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
chrome_browser_net::Predictor* ChromeProfileStub::GetNetworkPredictor() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DevToolsNetworkControllerHandle*
|
||||
ChromeProfileStub::GetDevToolsNetworkControllerHandle() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ChromeProfileStub::ClearNetworkingHistorySince(
|
||||
base::Time time,
|
||||
const base::Closure& completion) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
GURL ChromeProfileStub::GetHomePage() {
|
||||
NOTIMPLEMENTED();
|
||||
return GURL();
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::WasCreatedByVersionOrLater(
|
||||
const std::string& version) {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeProfileStub::SetExitType(ExitType exit_type) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
Profile::ExitType ChromeProfileStub::GetLastSessionExitType() {
|
||||
NOTIMPLEMENTED();
|
||||
return EXIT_NORMAL;
|
||||
}
|
57
libcef/browser/chrome_profile_stub.h
Normal file
57
libcef/browser/chrome_profile_stub.h
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2015 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2012 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.
|
||||
|
||||
// This class gathers state related to a single user profile.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_CHROME_PROFILE_STUB_H_
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_PROFILE_STUB_H_
|
||||
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
|
||||
// This file provides a stub implementation of Chrome's Profile object for use
|
||||
// as an interop layer between CEF and files that live in chrome/.
|
||||
|
||||
class ChromeProfileStub : public Profile {
|
||||
public:
|
||||
ChromeProfileStub();
|
||||
~ChromeProfileStub() override;
|
||||
|
||||
protected:
|
||||
// Profile methods.
|
||||
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
|
||||
std::string GetProfileUserName() const override;
|
||||
ProfileType GetProfileType() const override;
|
||||
Profile* GetOffTheRecordProfile() override;
|
||||
void DestroyOffTheRecordProfile() override;
|
||||
bool HasOffTheRecordProfile() override;
|
||||
Profile* GetOriginalProfile() override;
|
||||
bool IsSupervised() const override;
|
||||
bool IsChild() const override;
|
||||
bool IsLegacySupervised() const override;
|
||||
ExtensionSpecialStoragePolicy*
|
||||
GetExtensionSpecialStoragePolicy() override;
|
||||
PrefService* GetOffTheRecordPrefs() override;
|
||||
net::URLRequestContextGetter* GetRequestContextForExtensions() override;
|
||||
net::SSLConfigService* GetSSLConfigService() override;
|
||||
bool IsSameProfile(Profile* profile) override;
|
||||
base::Time GetStartTime() const override;
|
||||
base::FilePath last_selected_directory() override;
|
||||
void set_last_selected_directory(const base::FilePath& path) override;
|
||||
PrefProxyConfigTracker* GetProxyConfigTracker() override;
|
||||
chrome_browser_net::Predictor* GetNetworkPredictor() override;
|
||||
DevToolsNetworkControllerHandle*
|
||||
GetDevToolsNetworkControllerHandle() override;
|
||||
void ClearNetworkingHistorySince(base::Time time,
|
||||
const base::Closure& completion) override;
|
||||
GURL GetHomePage() override;
|
||||
bool WasCreatedByVersionOrLater(const std::string& version) override;
|
||||
void SetExitType(ExitType exit_type) override;
|
||||
ExitType GetLastSessionExitType() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ChromeProfileStub);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_PROFILE_STUB_H_
|
@@ -10,7 +10,6 @@
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/browser_main.h"
|
||||
#include "libcef/browser/browser_message_filter.h"
|
||||
#include "libcef/browser/browser_settings.h"
|
||||
#include "libcef/browser/chrome_scheme_handler.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools_delegate.h"
|
||||
@@ -20,6 +19,7 @@
|
||||
#include "libcef/browser/pepper/browser_pepper_host_factory.h"
|
||||
#include "libcef/browser/plugins/plugin_info_message_filter.h"
|
||||
#include "libcef/browser/plugins/plugin_service_filter.h"
|
||||
#include "libcef/browser/prefs/renderer_prefs.h"
|
||||
#include "libcef/browser/printing/printing_message_filter.h"
|
||||
#include "libcef/browser/resource_dispatcher_host_delegate.h"
|
||||
#include "libcef/browser/speech_recognition_manager_delegate.h"
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "content/public/browser/client_certificate_delegate.h"
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
#include "content/public/browser/page_navigator.h"
|
||||
#include "content/public/browser/quota_permission_context.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
@@ -467,24 +468,37 @@ scoped_refptr<CefBrowserInfo>
|
||||
int render_view_process_id,
|
||||
int render_view_routing_id,
|
||||
int render_frame_process_id,
|
||||
int render_frame_routing_id) {
|
||||
int render_frame_routing_id,
|
||||
bool* is_guest_view) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
BrowserInfoList::const_iterator it = browser_info_list_.begin();
|
||||
for (; it != browser_info_list_.end(); ++it) {
|
||||
const scoped_refptr<CefBrowserInfo>& browser_info = *it;
|
||||
if (browser_info->is_render_view_id_match(render_view_process_id,
|
||||
render_view_routing_id)) {
|
||||
if (browser_info->render_id_manager()->is_render_view_id_match(
|
||||
render_view_process_id, render_view_routing_id)) {
|
||||
// Make sure the frame id is also registered.
|
||||
browser_info->add_render_frame_id(render_frame_process_id,
|
||||
render_frame_routing_id);
|
||||
browser_info->render_id_manager()->add_render_frame_id(
|
||||
render_frame_process_id, render_frame_routing_id);
|
||||
return browser_info;
|
||||
} else if (browser_info->is_render_frame_id_match(
|
||||
render_frame_process_id,
|
||||
render_frame_routing_id)) {
|
||||
}
|
||||
if (browser_info->render_id_manager()->is_render_frame_id_match(
|
||||
render_frame_process_id, render_frame_routing_id)) {
|
||||
// Make sure the view id is also registered.
|
||||
browser_info->add_render_view_id(render_view_process_id,
|
||||
render_view_routing_id);
|
||||
browser_info->render_id_manager()->add_render_view_id(
|
||||
render_view_process_id, render_view_routing_id);
|
||||
return browser_info;
|
||||
}
|
||||
if (extensions::ExtensionsEnabled() &&
|
||||
(browser_info->guest_render_id_manager()->is_render_view_id_match(
|
||||
render_view_process_id, render_view_routing_id) ||
|
||||
browser_info->guest_render_id_manager()->is_render_frame_id_match(
|
||||
render_frame_process_id, render_frame_routing_id))) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = true;
|
||||
return browser_info;
|
||||
}
|
||||
}
|
||||
@@ -492,10 +506,10 @@ scoped_refptr<CefBrowserInfo>
|
||||
// Must be a popup if it hasn't already been created.
|
||||
scoped_refptr<CefBrowserInfo> browser_info =
|
||||
new CefBrowserInfo(++next_browser_id_, true);
|
||||
browser_info->add_render_view_id(render_view_process_id,
|
||||
render_view_routing_id);
|
||||
browser_info->add_render_frame_id(render_frame_process_id,
|
||||
render_frame_routing_id);
|
||||
browser_info->render_id_manager()->add_render_view_id(
|
||||
render_view_process_id, render_view_routing_id);
|
||||
browser_info->render_id_manager()->add_render_frame_id(
|
||||
render_frame_process_id, render_frame_routing_id);
|
||||
browser_info_list_.push_back(browser_info);
|
||||
return browser_info;
|
||||
}
|
||||
@@ -550,16 +564,28 @@ void CefContentBrowserClient::DestroyAllBrowsers() {
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefContentBrowserClient::GetBrowserInfoForView(
|
||||
int render_process_id, int render_routing_id) {
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
BrowserInfoList::const_iterator it = browser_info_list_.begin();
|
||||
for (; it != browser_info_list_.end(); ++it) {
|
||||
const scoped_refptr<CefBrowserInfo>& browser_info = *it;
|
||||
if (browser_info->is_render_view_id_match(
|
||||
if (browser_info->render_id_manager()->is_render_view_id_match(
|
||||
render_process_id, render_routing_id)) {
|
||||
return browser_info;
|
||||
}
|
||||
if (extensions::ExtensionsEnabled() &&
|
||||
browser_info->guest_render_id_manager()->is_render_view_id_match(
|
||||
render_process_id, render_routing_id)) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = true;
|
||||
return browser_info;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(WARNING) << "No browser info matching view process id " <<
|
||||
@@ -569,14 +595,26 @@ scoped_refptr<CefBrowserInfo> CefContentBrowserClient::GetBrowserInfoForView(
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefContentBrowserClient::GetBrowserInfoForFrame(
|
||||
int render_process_id, int render_routing_id) {
|
||||
int render_process_id,
|
||||
int render_routing_id,
|
||||
bool* is_guest_view) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
BrowserInfoList::const_iterator it = browser_info_list_.begin();
|
||||
for (; it != browser_info_list_.end(); ++it) {
|
||||
const scoped_refptr<CefBrowserInfo>& browser_info = *it;
|
||||
if (browser_info->is_render_frame_id_match(
|
||||
render_process_id, render_routing_id)) {
|
||||
if (browser_info->render_id_manager()->is_render_frame_id_match(
|
||||
render_process_id, render_routing_id)) {
|
||||
return browser_info;
|
||||
}
|
||||
if (extensions::ExtensionsEnabled() &&
|
||||
browser_info->guest_render_id_manager()->is_render_frame_id_match(
|
||||
render_process_id, render_routing_id)) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = true;
|
||||
return browser_info;
|
||||
}
|
||||
}
|
||||
@@ -872,14 +910,13 @@ void CefContentBrowserClient::AllowCertificateError(
|
||||
|
||||
CefRefPtr<CefSSLInfo> cef_ssl_info = new CefSSLInfoImpl(ssl_info);
|
||||
|
||||
CefRefPtr<CefAllowCertificateErrorCallbackImpl> callbackImpl;
|
||||
if (overridable && !strict_enforcement)
|
||||
callbackImpl = new CefAllowCertificateErrorCallbackImpl(callback);
|
||||
CefRefPtr<CefAllowCertificateErrorCallbackImpl> callbackImpl(
|
||||
new CefAllowCertificateErrorCallbackImpl(callback));
|
||||
|
||||
bool proceed = handler->OnCertificateError(
|
||||
browser.get(), static_cast<cef_errorcode_t>(cert_error),
|
||||
request_url.spec(), cef_ssl_info, callbackImpl.get());
|
||||
if (!proceed && callbackImpl.get())
|
||||
if (!proceed)
|
||||
callbackImpl->Disconnect();
|
||||
|
||||
*result = proceed ? content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE :
|
||||
@@ -924,12 +961,36 @@ bool CefContentBrowserClient::CanCreateWindow(
|
||||
if (last_create_window_params_.opener_process_id == MSG_ROUTING_NONE)
|
||||
return false;
|
||||
|
||||
bool is_guest_view = false;
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForView(
|
||||
extensions::GetOwnerBrowserForView(
|
||||
last_create_window_params_.opener_process_id,
|
||||
last_create_window_params_.opener_view_id);
|
||||
if (!browser.get())
|
||||
last_create_window_params_.opener_view_id,
|
||||
&is_guest_view);
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get()) {
|
||||
// Cancel the popup.
|
||||
last_create_window_params_.opener_process_id = MSG_ROUTING_NONE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_guest_view) {
|
||||
content::OpenURLParams params(target_url,
|
||||
referrer,
|
||||
disposition,
|
||||
ui::PAGE_TRANSITION_LINK,
|
||||
true);
|
||||
params.user_gesture = user_gesture;
|
||||
|
||||
// Pass navigation to the owner browser.
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(base::IgnoreResult(&CefBrowserHostImpl::OpenURLFromTab),
|
||||
browser.get(), nullptr, params));
|
||||
|
||||
// Cancel the popup.
|
||||
last_create_window_params_.opener_process_id = MSG_ROUTING_NONE;
|
||||
return false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
bool allow = true;
|
||||
@@ -1004,24 +1065,10 @@ void CefContentBrowserClient::ResourceDispatcherHostCreated() {
|
||||
void CefContentBrowserClient::OverrideWebkitPrefs(
|
||||
content::RenderViewHost* rvh,
|
||||
content::WebPreferences* prefs) {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
renderer_prefs::PopulateWebPreferences(rvh, *prefs);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
extensions::GetOwnerBrowserForHost(rvh);
|
||||
if (browser.get()) {
|
||||
// Populate WebPreferences based on CefBrowserSettings.
|
||||
BrowserToWebSettings(browser->settings(), *prefs);
|
||||
}
|
||||
|
||||
prefs->base_background_color = GetBaseBackgroundColor(browser);
|
||||
if (rvh->GetView())
|
||||
rvh->GetView()->SetBackgroundColor(prefs->base_background_color);
|
||||
|
||||
prefs->asynchronous_spell_checking_enabled = true;
|
||||
// Auto-correct does not work in combination with the unified text checker.
|
||||
prefs->unified_textchecker_enabled =
|
||||
!command_line->HasSwitch(switches::kEnableSpellingAutoCorrect);
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::BrowserURLHandlerCreated(
|
||||
@@ -1161,27 +1208,3 @@ CefContentBrowserClient::browser_context() const {
|
||||
CefDevToolsDelegate* CefContentBrowserClient::devtools_delegate() const {
|
||||
return browser_main_parts_->devtools_delegate();
|
||||
}
|
||||
|
||||
// static
|
||||
SkColor CefContentBrowserClient::GetBaseBackgroundColor(
|
||||
CefRefPtr<CefBrowserHostImpl> browser) {
|
||||
if (browser.get()) {
|
||||
const CefBrowserSettings& browser_settings = browser->settings();
|
||||
if (CefColorGetA(browser_settings.background_color) > 0) {
|
||||
return SkColorSetRGB(
|
||||
CefColorGetR(browser_settings.background_color),
|
||||
CefColorGetG(browser_settings.background_color),
|
||||
CefColorGetB(browser_settings.background_color));
|
||||
}
|
||||
}
|
||||
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
if (CefColorGetA(settings.background_color) > 0) {
|
||||
return SkColorSetRGB(
|
||||
CefColorGetR(settings.background_color),
|
||||
CefColorGetG(settings.background_color),
|
||||
CefColorGetB(settings.background_color));
|
||||
}
|
||||
|
||||
return SK_ColorWHITE;
|
||||
}
|
||||
|
@@ -50,23 +50,30 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
// to CefBrowserHostImpl::ShouldCreateWebContents on the UI thread. To resolve
|
||||
// this race CefBrowserInfo may be created when requested for the first time
|
||||
// and before the associated CefBrowserHostImpl is created.
|
||||
// |is_guest_view| will be set to true if the IDs match a guest view
|
||||
// associated with the returned browser info instead of the browser itself.
|
||||
scoped_refptr<CefBrowserInfo> CreateBrowserInfo(bool is_popup);
|
||||
scoped_refptr<CefBrowserInfo> GetOrCreateBrowserInfo(
|
||||
int render_view_process_id,
|
||||
int render_view_routing_id,
|
||||
int render_frame_process_id,
|
||||
int render_frame_routing_id);
|
||||
int render_frame_routing_id,
|
||||
bool* is_guest_view);
|
||||
void RemoveBrowserInfo(scoped_refptr<CefBrowserInfo> browser_info);
|
||||
void DestroyAllBrowsers();
|
||||
|
||||
// Retrieves the CefBrowserInfo matching the specified IDs or an empty
|
||||
// pointer if no match is found. It is allowed to add new callers of this
|
||||
// method but consider using CefBrowserHostImpl::GetBrowserFor[View|Frame]()
|
||||
// instead.
|
||||
// or extensions::GetOwnerBrowserForView() instead.
|
||||
// |is_guest_view| will be set to true if the IDs match a guest view
|
||||
// associated with the returned browser info instead of the browser itself.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoForView(int render_process_id,
|
||||
int render_routing_id);
|
||||
int render_routing_id,
|
||||
bool* is_guest_view);
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoForFrame(int render_process_id,
|
||||
int render_routing_id);
|
||||
int render_routing_id,
|
||||
bool* is_guest_view);
|
||||
|
||||
// ContentBrowserClient implementation.
|
||||
content::BrowserMainParts* CreateBrowserMainParts(
|
||||
@@ -170,8 +177,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
CefDevToolsDelegate* devtools_delegate() const;
|
||||
|
||||
private:
|
||||
static SkColor GetBaseBackgroundColor(CefRefPtr<CefBrowserHostImpl> browser);
|
||||
|
||||
CefBrowserMainParts* browser_main_parts_;
|
||||
|
||||
scoped_ptr<content::PluginServiceFilter> plugin_service_filter_;
|
||||
|
@@ -58,11 +58,29 @@ class CefForceShutdown {
|
||||
}
|
||||
} g_force_shutdown;
|
||||
|
||||
#if defined(OS_WIN) && defined(ARCH_CPU_X86_64)
|
||||
// VS2013 only checks the existence of FMA3 instructions, not the enabled-ness
|
||||
// of them at the OS level (this is fixed in VS2015). We force off usage of
|
||||
// FMA3 instructions in the CRT to avoid using that path and hitting illegal
|
||||
// instructions when running on CPUs that support FMA3, but OSs that don't.
|
||||
void DisableFMA3() {
|
||||
static bool disabled = false;
|
||||
if (disabled)
|
||||
return;
|
||||
disabled = true;
|
||||
_set_FMA3_enable(0);
|
||||
}
|
||||
#endif // WIN && ARCH_CPU_X86_64
|
||||
|
||||
} // namespace
|
||||
|
||||
int CefExecuteProcess(const CefMainArgs& args,
|
||||
CefRefPtr<CefApp> application,
|
||||
void* windows_sandbox_info) {
|
||||
#if defined(OS_WIN) && defined(ARCH_CPU_X86_64)
|
||||
DisableFMA3();
|
||||
#endif
|
||||
|
||||
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
|
||||
#if defined(OS_WIN)
|
||||
command_line.ParseFromString(::GetCommandLineW());
|
||||
@@ -110,6 +128,10 @@ bool CefInitialize(const CefMainArgs& args,
|
||||
const CefSettings& settings,
|
||||
CefRefPtr<CefApp> application,
|
||||
void* windows_sandbox_info) {
|
||||
#if defined(OS_WIN) && defined(ARCH_CPU_X86_64)
|
||||
DisableFMA3();
|
||||
#endif
|
||||
|
||||
// Return true if the global context already exists.
|
||||
if (g_context)
|
||||
return true;
|
||||
@@ -360,6 +382,9 @@ void CefContext::PopulateRequestContextSettings(
|
||||
settings->persist_session_cookies =
|
||||
settings_.persist_session_cookies ||
|
||||
command_line->HasSwitch(switches::kPersistSessionCookies);
|
||||
settings->persist_user_preferences =
|
||||
settings_.persist_user_preferences ||
|
||||
command_line->HasSwitch(switches::kPersistUserPreferences);
|
||||
settings->ignore_certificate_errors =
|
||||
settings_.ignore_certificate_errors ||
|
||||
command_line->HasSwitch(switches::kIgnoreCertificateErrors);
|
||||
@@ -417,6 +442,9 @@ void CefContext::FinishShutdownOnUIThread(
|
||||
if (trace_subscriber_.get())
|
||||
trace_subscriber_.reset(NULL);
|
||||
|
||||
if (component_updater_.get())
|
||||
component_updater_.reset(NULL);
|
||||
|
||||
if (uithread_shutdown_event)
|
||||
uithread_shutdown_event->Signal();
|
||||
}
|
||||
|
@@ -6,12 +6,14 @@
|
||||
|
||||
#include "libcef/browser/extensions/api/streams_private/streams_private_api.h"
|
||||
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "extensions/browser/renderer_startup_helper.h"
|
||||
|
||||
namespace extensions {
|
||||
namespace cef {
|
||||
|
||||
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
|
||||
PrefsTabHelper::GetServiceInstance();
|
||||
RendererStartupHelperFactory::GetInstance();
|
||||
StreamsPrivateAPI::GetFactoryInstance();
|
||||
}
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "content/browser/browser_plugin/browser_plugin_embedder.h"
|
||||
@@ -58,24 +60,51 @@ content::WebContents* GetOwnerForGuestContents(content::WebContents* guest) {
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForView(int render_process_id,
|
||||
int render_routing_id) {
|
||||
content::RenderViewHost* host =
|
||||
content::RenderViewHost::FromID(render_process_id, render_routing_id);
|
||||
if (host)
|
||||
return GetOwnerBrowserForHost(host);
|
||||
return NULL;
|
||||
int render_routing_id,
|
||||
bool* is_guest_view) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
// Use the non-thread-safe but potentially faster approach.
|
||||
content::RenderViewHost* host =
|
||||
content::RenderViewHost::FromID(render_process_id, render_routing_id);
|
||||
if (host)
|
||||
return GetOwnerBrowserForHost(host, is_guest_view);
|
||||
return NULL;
|
||||
} else {
|
||||
// Use the thread-safe approach.
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefContentBrowserClient::Get()->GetBrowserInfoForView(
|
||||
render_process_id, render_routing_id, is_guest_view);
|
||||
if (info.get()) {
|
||||
CefRefPtr<CefBrowserHostImpl> browser = info->browser();
|
||||
if (!browser.get()) {
|
||||
LOG(WARNING) << "Found browser id " << info->browser_id() <<
|
||||
" but no browser object matching view process id " <<
|
||||
render_process_id << " and routing id " <<
|
||||
render_routing_id;
|
||||
}
|
||||
return browser;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForHost(
|
||||
content::RenderViewHost* host) {
|
||||
content::RenderViewHost* host,
|
||||
bool* is_guest_view) {
|
||||
if (is_guest_view)
|
||||
*is_guest_view = false;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForHost(host);
|
||||
if (!browser.get() && ExtensionsEnabled()) {
|
||||
// Retrieve the owner browser, if any.
|
||||
content::WebContents* owner = GetOwnerForGuestContents(
|
||||
content::WebContents::FromRenderViewHost(host));
|
||||
if (owner)
|
||||
if (owner) {
|
||||
browser = CefBrowserHostImpl::GetBrowserForContents(owner);
|
||||
if (browser.get() && is_guest_view)
|
||||
*is_guest_view = true;
|
||||
}
|
||||
}
|
||||
return browser;
|
||||
}
|
||||
|
@@ -28,13 +28,19 @@ void GetAllGuestsForOwnerContents(content::WebContents* owner,
|
||||
content::WebContents* GetOwnerForGuestContents(content::WebContents* guest);
|
||||
|
||||
// Returns the CefBrowserHostImpl that owns the host identified by the specified
|
||||
// view routing IDs, if any.
|
||||
// view routing IDs, if any. |is_guest_view| will be set to true if the IDs
|
||||
// match a guest view associated with the returned browser instead of the
|
||||
// browser itself.
|
||||
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForView(int render_process_id,
|
||||
int render_routing_id);
|
||||
int render_routing_id,
|
||||
bool* is_guest_view);
|
||||
|
||||
// Returns the CefBrowserHostImpl that owns the specified |host|, if any.
|
||||
// |is_guest_view| will be set to true if the host matches a guest view
|
||||
// associated with the returned browser instead of the browser itself.
|
||||
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForHost(
|
||||
content::RenderViewHost* host);
|
||||
content::RenderViewHost* host,
|
||||
bool* is_guest_view);
|
||||
|
||||
} // namespace extensions
|
||||
|
||||
|
@@ -6,12 +6,15 @@
|
||||
#include "libcef/browser/extensions/extensions_api_client.h"
|
||||
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/extensions/extension_web_contents_observer.h"
|
||||
#include "libcef/browser/extensions/mime_handler_view_guest_delegate.h"
|
||||
#include "libcef/browser/extensions/pdf_web_contents_helper_client.h"
|
||||
#include "libcef/browser/printing/print_view_manager.h"
|
||||
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "components/pdf/browser/pdf_web_contents_helper.h"
|
||||
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
@@ -25,6 +28,22 @@ AppViewGuestDelegate* CefExtensionsAPIClient::CreateAppViewGuestDelegate()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scoped_ptr<guest_view::GuestViewManagerDelegate>
|
||||
CefExtensionsAPIClient::CreateGuestViewManagerDelegate(
|
||||
content::BrowserContext* context) const {
|
||||
// The GuestViewManager instance associated with the returned Delegate, which
|
||||
// will be retrieved in the future via GuestViewManager::FromBrowserContext,
|
||||
// will be associated with the CefBrowserContextImpl instead of |context| due
|
||||
// to ShouldProxyUserData in browser_context_proxy.cc. Because the
|
||||
// GuestViewManagerDelegate keeps a reference to the passed-in context we need
|
||||
// to provide the *Impl object instead of |context| which may be a *Proxy
|
||||
// object. If we don't do this then the Delegate may attempt to access a
|
||||
// *Proxy object that has already been deleted.
|
||||
return make_scoped_ptr(
|
||||
new extensions::ExtensionsGuestViewManagerDelegate(
|
||||
CefBrowserContextImpl::GetForContext(context).get()));
|
||||
}
|
||||
|
||||
scoped_ptr<MimeHandlerViewGuestDelegate>
|
||||
CefExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
|
||||
MimeHandlerViewGuest* guest) const {
|
||||
@@ -33,6 +52,7 @@ CefExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
|
||||
|
||||
void CefExtensionsAPIClient::AttachWebContentsHelpers(
|
||||
content::WebContents* web_contents) const {
|
||||
PrefsTabHelper::CreateForWebContents(web_contents);
|
||||
printing::PrintViewManager::CreateForWebContents(web_contents);
|
||||
pdf::PDFWebContentsHelper::CreateForWebContentsWithClient(
|
||||
web_contents,
|
||||
|
@@ -16,6 +16,9 @@ class CefExtensionsAPIClient : public ExtensionsAPIClient {
|
||||
|
||||
// ExtensionsAPIClient implementation.
|
||||
AppViewGuestDelegate* CreateAppViewGuestDelegate() const override;
|
||||
scoped_ptr<guest_view::GuestViewManagerDelegate>
|
||||
CreateGuestViewManagerDelegate(
|
||||
content::BrowserContext* context) const override;
|
||||
scoped_ptr<MimeHandlerViewGuestDelegate>
|
||||
CreateMimeHandlerViewGuestDelegate(
|
||||
MimeHandlerViewGuest* guest) const override;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user