cef/tests/shared/common/client_app.cc
Marshall Greenblatt 76642ccafa Move cookieable scheme configuration to settings (see issue #2969)
The Chrome runtime requires that cookieable scheme information be available
at Profile initialization time because it also triggers NetworkContext creation
at the same time. To make this possible, and to avoid various race conditions
when setting state, the cookieable scheme configuration has been added as
|cookieable_schemes_list| and |cookieable_schemes_exclude_defaults| in
CefSettings and CefBrowserContextSettings. The CefCookieManager::
SetSupportedSchemes and CefBrowserProcessHandler::GetCookieableSchemes methods
are no longer required and have been removed.

This change also modifies chrome to delay OffTheRecordProfileImpl initialization
so that |ChromeBrowserContext::profile_| can be set before
ChromeContentBrowserClientCef::ConfigureNetworkContextParams calls
CefBrowserContext::FromBrowserContext to retrieve the ChromeBrowserContext
and associated cookieable scheme information. Otherwise, the
ChromeBrowserContext will not be matched and the NetworkContext will not be
configured correctly.

The CookieTest suite now passes with the Chrome runtime enabled.
2021-04-09 15:04:24 -04:00

48 lines
1.2 KiB
C++

// 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.
#include "tests/shared/common/client_app.h"
#include "include/cef_command_line.h"
namespace client {
namespace {
// These flags must match the Chromium values.
const char kProcessType[] = "type";
const char kRendererProcess[] = "renderer";
#if defined(OS_LINUX)
const char kZygoteProcess[] = "zygote";
#endif
} // namespace
ClientApp::ClientApp() {}
// static
ClientApp::ProcessType ClientApp::GetProcessType(
CefRefPtr<CefCommandLine> command_line) {
// The command-line flag won't be specified for the browser process.
if (!command_line->HasSwitch(kProcessType))
return BrowserProcess;
const std::string& process_type = command_line->GetSwitchValue(kProcessType);
if (process_type == kRendererProcess)
return RendererProcess;
#if defined(OS_LINUX)
else if (process_type == kZygoteProcess)
return ZygoteProcess;
#endif
return OtherProcess;
}
void ClientApp::OnRegisterCustomSchemes(
CefRawPtr<CefSchemeRegistrar> registrar) {
RegisterCustomSchemes(registrar);
}
} // namespace client