Remove methods that modify cookie storage at runtime (see issue #2622).

This change removes cookie and request handler functionality that will not
supported by the NetworkService. Specifically, it is no longer possible to
change cookie storage locations at runime by returning a different
CefCookieManager for an already initialized CefRequestContext. After this change
you will need to use a separate CefRequestContext when creating a CefBrowser if
you require separate cookie storage.

The following methods have been removed:
- CefCookieManager::CreateManager
- CefCookieManager::GetBlockingManager
- CefCookieManager::SetStoragePath
- CefRequestContextHandler::GetCookieManager

The following methods have been renamed:
- CefRequestContext::GetDefaultCookieManager to GetCookieManager.

This change substantially simplifies the network implementation in CEF because
it is no longer necessary to proxy objects that are normally owned by Chromium.
Chromium patches that are no longer necessary will be removed as a follow-up
commit.

To test: Verify that `ceftests --gtest_filter=-PluginTest.*` pass with
NetworkService disabled. Plugin tests will be fixed in a follow-up commit.
This commit is contained in:
Marshall Greenblatt
2019-03-22 18:11:51 -04:00
parent 6b2c1fe969
commit a23e845244
66 changed files with 1175 additions and 3939 deletions

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=229d455bfe9f7c8536f7bc03734eaf29e9e637b1$
// $hash=a672fab541f9c28f77a06c31d89f5a9d66c78751$
//
#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
@@ -35,33 +35,6 @@ CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
return CefCookieManagerCppToC::Wrap(_retval);
}
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_blocking_manager() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefRefPtr<CefCookieManager> _retval = CefCookieManager::GetBlockingManager();
// Return type: refptr_same
return CefCookieManagerCppToC::Wrap(_retval);
}
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_create_manager(
const cef_string_t* path,
int persist_session_cookies,
cef_completion_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: path, callback
// Execute
CefRefPtr<CefCookieManager> _retval = CefCookieManager::CreateManager(
CefString(path), persist_session_cookies ? true : false,
CefCompletionCallbackCToCpp::Wrap(callback));
// Return type: refptr_same
return CefCookieManagerCppToC::Wrap(_retval);
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
@@ -193,27 +166,6 @@ cookie_manager_delete_cookies(struct _cef_cookie_manager_t* self,
return _retval;
}
int CEF_CALLBACK
cookie_manager_set_storage_path(struct _cef_cookie_manager_t* self,
const cef_string_t* path,
int persist_session_cookies,
cef_completion_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Unverified params: path, callback
// Execute
bool _retval = CefCookieManagerCppToC::Get(self)->SetStoragePath(
CefString(path), persist_session_cookies ? true : false,
CefCompletionCallbackCToCpp::Wrap(callback));
// Return type: bool
return _retval;
}
int CEF_CALLBACK
cookie_manager_flush_store(struct _cef_cookie_manager_t* self,
cef_completion_callback_t* callback) {
@@ -242,7 +194,6 @@ CefCookieManagerCppToC::CefCookieManagerCppToC() {
GetStruct()->visit_url_cookies = cookie_manager_visit_url_cookies;
GetStruct()->set_cookie = cookie_manager_set_cookie;
GetStruct()->delete_cookies = cookie_manager_delete_cookies;
GetStruct()->set_storage_path = cookie_manager_set_storage_path;
GetStruct()->flush_store = cookie_manager_flush_store;
}

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=f4724d1d945c06c5113ba9e1b7f7ad8d4b735b9c$
// $hash=29ac900a92c4ec966cc115aae96c49b545bc9db9$
//
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
@@ -171,9 +171,9 @@ request_context_get_cache_path(struct _cef_request_context_t* self) {
return _retval.DetachToUserFree();
}
cef_cookie_manager_t* CEF_CALLBACK request_context_get_default_cookie_manager(
struct _cef_request_context_t* self,
cef_completion_callback_t* callback) {
cef_cookie_manager_t* CEF_CALLBACK
request_context_get_cookie_manager(struct _cef_request_context_t* self,
cef_completion_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@@ -183,7 +183,7 @@ cef_cookie_manager_t* CEF_CALLBACK request_context_get_default_cookie_manager(
// Execute
CefRefPtr<CefCookieManager> _retval =
CefRequestContextCppToC::Get(self)->GetDefaultCookieManager(
CefRequestContextCppToC::Get(self)->GetCookieManager(
CefCompletionCallbackCToCpp::Wrap(callback));
// Return type: refptr_same
@@ -535,8 +535,7 @@ CefRequestContextCppToC::CefRequestContextCppToC() {
GetStruct()->is_global = request_context_is_global;
GetStruct()->get_handler = request_context_get_handler;
GetStruct()->get_cache_path = request_context_get_cache_path;
GetStruct()->get_default_cookie_manager =
request_context_get_default_cookie_manager;
GetStruct()->get_cookie_manager = request_context_get_cookie_manager;
GetStruct()->register_scheme_handler_factory =
request_context_register_scheme_handler_factory;
GetStruct()->clear_scheme_handler_factories =

View File

@@ -9,11 +9,10 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=2decd7941020bd2b96ebfa736624d1729a82fa55$
// $hash=b98ed34333ccd44a004c88c0ca496f7821f49e18$
//
#include "libcef_dll/cpptoc/request_context_handler_cpptoc.h"
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
@@ -39,22 +38,6 @@ void CEF_CALLBACK request_context_handler_on_request_context_initialized(
CefRequestContextCToCpp::Wrap(request_context));
}
cef_cookie_manager_t* CEF_CALLBACK request_context_handler_get_cookie_manager(
struct _cef_request_context_handler_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefCookieManager> _retval =
CefRequestContextHandlerCppToC::Get(self)->GetCookieManager();
// Return type: refptr_diff
return CefCookieManagerCToCpp::Unwrap(_retval);
}
int CEF_CALLBACK request_context_handler_on_before_plugin_load(
struct _cef_request_context_handler_t* self,
const cef_string_t* mime_type,
@@ -99,7 +82,6 @@ int CEF_CALLBACK request_context_handler_on_before_plugin_load(
CefRequestContextHandlerCppToC::CefRequestContextHandlerCppToC() {
GetStruct()->on_request_context_initialized =
request_context_handler_on_request_context_initialized;
GetStruct()->get_cookie_manager = request_context_handler_get_cookie_manager;
GetStruct()->on_before_plugin_load =
request_context_handler_on_before_plugin_load;
}

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=bd8fe0f41380bc1e5ecedbcab726bc2ed875f827$
// $hash=fdbb50cba70b9638aaaadc2e4040b18390ae3a6d$
//
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
@@ -36,35 +36,6 @@ CefRefPtr<CefCookieManager> CefCookieManager::GetGlobalManager(
return CefCookieManagerCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefCookieManager> CefCookieManager::GetBlockingManager() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_cookie_manager_t* _retval = cef_cookie_manager_get_blocking_manager();
// Return type: refptr_same
return CefCookieManagerCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
const CefString& path,
bool persist_session_cookies,
CefRefPtr<CefCompletionCallback> callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: path, callback
// Execute
cef_cookie_manager_t* _retval = cef_cookie_manager_create_manager(
path.GetStruct(), persist_session_cookies,
CefCompletionCallbackCppToC::Wrap(callback));
// Return type: refptr_same
return CefCookieManagerCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
@@ -192,28 +163,6 @@ bool CefCookieManagerCToCpp::DeleteCookies(
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
bool CefCookieManagerCToCpp::SetStoragePath(
const CefString& path,
bool persist_session_cookies,
CefRefPtr<CefCompletionCallback> callback) {
cef_cookie_manager_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_storage_path))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: path, callback
// Execute
int _retval = _struct->set_storage_path(
_struct, path.GetStruct(), persist_session_cookies,
CefCompletionCallbackCppToC::Wrap(callback));
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
bool CefCookieManagerCToCpp::FlushStore(
CefRefPtr<CefCompletionCallback> callback) {

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=2363533e3c6b78e16b93dd428121cd45b797ce6a$
// $hash=99bb8be3c19be11e4abf2cf904d75667723ae643$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_COOKIE_MANAGER_CTOCPP_H_
@@ -48,9 +48,6 @@ class CefCookieManagerCToCpp
bool DeleteCookies(const CefString& url,
const CefString& cookie_name,
CefRefPtr<CefDeleteCookiesCallback> callback) OVERRIDE;
bool SetStoragePath(const CefString& path,
bool persist_session_cookies,
CefRefPtr<CefCompletionCallback> callback) OVERRIDE;
bool FlushStore(CefRefPtr<CefCompletionCallback> callback) OVERRIDE;
};

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=ed414e127773ef135584c3c61a386615177feb59$
// $hash=8155639f093ff697fd30a9e330ae3470108251e5$
//
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
@@ -165,10 +165,10 @@ NO_SANITIZE("cfi-icall") CefString CefRequestContextCToCpp::GetCachePath() {
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefCookieManager> CefRequestContextCToCpp::GetDefaultCookieManager(
CefRefPtr<CefCookieManager> CefRequestContextCToCpp::GetCookieManager(
CefRefPtr<CefCompletionCallback> callback) {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_default_cookie_manager))
if (CEF_MEMBER_MISSING(_struct, get_cookie_manager))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@@ -176,7 +176,7 @@ CefRefPtr<CefCookieManager> CefRequestContextCToCpp::GetDefaultCookieManager(
// Unverified params: callback
// Execute
cef_cookie_manager_t* _retval = _struct->get_default_cookie_manager(
cef_cookie_manager_t* _retval = _struct->get_cookie_manager(
_struct, CefCompletionCallbackCppToC::Wrap(callback));
// Return type: refptr_same

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=52475096e498cd28cbd25676eaab24e14c1438b0$
// $hash=73f229f21f0d9ce78f3897fd8a2ec94261a52f48$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_REQUEST_CONTEXT_CTOCPP_H_
@@ -43,7 +43,7 @@ class CefRequestContextCToCpp
bool IsGlobal() OVERRIDE;
CefRefPtr<CefRequestContextHandler> GetHandler() OVERRIDE;
CefString GetCachePath() OVERRIDE;
CefRefPtr<CefCookieManager> GetDefaultCookieManager(
CefRefPtr<CefCookieManager> GetCookieManager(
CefRefPtr<CefCompletionCallback> callback) OVERRIDE;
bool RegisterSchemeHandlerFactory(
const CefString& scheme_name,

View File

@@ -9,11 +9,10 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=80c600e8a2f2035219c00bad1bf28a58b6dabf53$
// $hash=4b25ca3feb69361cc3b6525fdc0c3a56710b65ec$
//
#include "libcef_dll/ctocpp/request_context_handler_ctocpp.h"
#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
@@ -38,21 +37,6 @@ void CefRequestContextHandlerCToCpp::OnRequestContextInitialized(
_struct, CefRequestContextCppToC::Wrap(request_context));
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefCookieManager> CefRequestContextHandlerCToCpp::GetCookieManager() {
cef_request_context_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_cookie_manager))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_cookie_manager_t* _retval = _struct->get_cookie_manager(_struct);
// Return type: refptr_diff
return CefCookieManagerCppToC::Unwrap(_retval);
}
NO_SANITIZE("cfi-icall")
bool CefRequestContextHandlerCToCpp::OnBeforePluginLoad(
const CefString& mime_type,

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=f60c9110cba752df545af2fe5905a01d30ff588e$
// $hash=3cf1dba9c137bc586d91149920ff4558bce74a58$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_REQUEST_CONTEXT_HANDLER_CTOCPP_H_
@@ -39,7 +39,6 @@ class CefRequestContextHandlerCToCpp
// CefRequestContextHandler methods.
void OnRequestContextInitialized(
CefRefPtr<CefRequestContext> request_context) override;
CefRefPtr<CefCookieManager> GetCookieManager() override;
bool OnBeforePluginLoad(const CefString& mime_type,
const CefString& plugin_url,
bool is_main_frame,

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=4a4744491587c5f5b1ce8726d8dd08ad04646b92$
// $hash=7c87ef36c39355a02bb9544b8228acac7a7abee9$
//
#include <dlfcn.h>
@@ -198,12 +198,6 @@ typedef struct _cef_command_line_t* (*cef_command_line_get_global_ptr)();
typedef struct _cef_cookie_manager_t* (
*cef_cookie_manager_get_global_manager_ptr)(
struct _cef_completion_callback_t*);
typedef struct _cef_cookie_manager_t* (
*cef_cookie_manager_get_blocking_manager_ptr)();
typedef struct _cef_cookie_manager_t* (*cef_cookie_manager_create_manager_ptr)(
const cef_string_t*,
int,
struct _cef_completion_callback_t*);
typedef struct _cef_drag_data_t* (*cef_drag_data_create_ptr)();
typedef struct _cef_image_t* (*cef_image_create_ptr)();
typedef struct _cef_menu_model_t* (*cef_menu_model_create_ptr)(
@@ -580,9 +574,6 @@ struct libcef_pointers {
cef_command_line_get_global_ptr cef_command_line_get_global;
cef_cookie_manager_get_global_manager_ptr
cef_cookie_manager_get_global_manager;
cef_cookie_manager_get_blocking_manager_ptr
cef_cookie_manager_get_blocking_manager;
cef_cookie_manager_create_manager_ptr cef_cookie_manager_create_manager;
cef_drag_data_create_ptr cef_drag_data_create;
cef_image_create_ptr cef_image_create;
cef_menu_model_create_ptr cef_menu_model_create;
@@ -797,8 +788,6 @@ int libcef_init_pointers(const char* path) {
INIT_ENTRY(cef_command_line_create);
INIT_ENTRY(cef_command_line_get_global);
INIT_ENTRY(cef_cookie_manager_get_global_manager);
INIT_ENTRY(cef_cookie_manager_get_blocking_manager);
INIT_ENTRY(cef_cookie_manager_create_manager);
INIT_ENTRY(cef_drag_data_create);
INIT_ENTRY(cef_image_create);
INIT_ENTRY(cef_menu_model_create);
@@ -1309,20 +1298,6 @@ struct _cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
return g_libcef_pointers.cef_cookie_manager_get_global_manager(callback);
}
NO_SANITIZE("cfi-icall")
struct _cef_cookie_manager_t* cef_cookie_manager_get_blocking_manager() {
return g_libcef_pointers.cef_cookie_manager_get_blocking_manager();
}
NO_SANITIZE("cfi-icall")
struct _cef_cookie_manager_t* cef_cookie_manager_create_manager(
const cef_string_t* path,
int persist_session_cookies,
struct _cef_completion_callback_t* callback) {
return g_libcef_pointers.cef_cookie_manager_create_manager(
path, persist_session_cookies, callback);
}
NO_SANITIZE("cfi-icall") struct _cef_drag_data_t* cef_drag_data_create() {
return g_libcef_pointers.cef_drag_data_create();
}