mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add NetworkService support for CefURLRequest (see issue #2622).
Requests created using CefURLRequest::Create are not associated with a browser/frame. When originating from the render process these requests cannot be intercepted and consequently only http(s) and blob requests are supported. To work around this limitation a new CefFrame::CreateURLRequest method has been added that allows the request to be associated with that browser/frame for interception purposes. This change also fixes an issue with the NetworkService implementation where redirected requests could result in two parallel requests being sent to the target server. To test: URLRequestTest.* tests pass with NetworkService enabled.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/media_capture_devices_dispatcher.h"
|
||||
#include "libcef/browser/net/url_request_context_getter.h"
|
||||
#include "libcef/browser/prefs/pref_store.h"
|
||||
@@ -36,6 +37,7 @@
|
||||
#include "components/google/core/browser/google_url_tracker.h"
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
#include "components/language/core/browser/language_prefs.h"
|
||||
#include "components/language/core/browser/pref_names.h"
|
||||
#include "components/pref_registry/pref_registry_syncable.h"
|
||||
#include "components/prefs/json_pref_store.h"
|
||||
#include "components/prefs/pref_filter.h"
|
||||
@@ -58,6 +60,19 @@
|
||||
|
||||
namespace browser_prefs {
|
||||
|
||||
namespace {
|
||||
|
||||
std::string GetAcceptLanguageList(Profile* profile) {
|
||||
const CefRequestContextSettings& context_settings =
|
||||
static_cast<CefBrowserContext*>(profile)->GetSettings();
|
||||
if (context_settings.accept_language_list.length > 0) {
|
||||
return CefString(&context_settings.accept_language_list);
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const char kUserPrefsFileName[] = "UserPrefs.json";
|
||||
|
||||
std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
@@ -230,6 +245,14 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
// Based on DevToolsWindow::RegisterProfilePrefs.
|
||||
registry->RegisterDictionaryPref(prefs::kDevToolsPreferences);
|
||||
registry->RegisterDictionaryPref(prefs::kDevToolsEditedFiles);
|
||||
|
||||
// Language preferences. Used by ProfileNetworkContextService and
|
||||
// InterceptedRequestHandlerWrapper.
|
||||
const std::string& accept_language_list = GetAcceptLanguageList(profile);
|
||||
if (!accept_language_list.empty()) {
|
||||
registry->SetDefaultPrefValue(language::prefs::kAcceptLanguages,
|
||||
base::Value(accept_language_list));
|
||||
}
|
||||
}
|
||||
|
||||
// Build the PrefService that manages the PrefRegistry and PrefStores.
|
||||
|
Reference in New Issue
Block a user