chrome: cefclient: Add default handler for request tests (see issue #3444)

Support loading of request tests (e.g. http://tests/other_tests) inside default
browsers created via "New window" and "New incognito window" commands.
This commit is contained in:
Marshall Greenblatt
2023-02-17 15:55:12 -05:00
parent d4c8104ca8
commit 565ad7bb99
7 changed files with 160 additions and 13 deletions

View File

@ -92,24 +92,21 @@ void ClientAppBrowser::OnBeforeCommandLineProcessing(
void ClientAppBrowser::OnRegisterCustomPreferences(
cef_preferences_type_t type,
CefRawPtr<CefPreferenceRegistrar> registrar) {
DelegateSet::iterator it = delegates_.begin();
for (; it != delegates_.end(); ++it) {
(*it)->OnRegisterCustomPreferences(this, type, registrar);
for (auto& delegate : delegates_) {
delegate->OnRegisterCustomPreferences(this, type, registrar);
}
}
void ClientAppBrowser::OnContextInitialized() {
DelegateSet::iterator it = delegates_.begin();
for (; it != delegates_.end(); ++it) {
(*it)->OnContextInitialized(this);
for (auto& delegate : delegates_) {
delegate->OnContextInitialized(this);
}
}
void ClientAppBrowser::OnBeforeChildProcessLaunch(
CefRefPtr<CefCommandLine> command_line) {
DelegateSet::iterator it = delegates_.begin();
for (; it != delegates_.end(); ++it) {
(*it)->OnBeforeChildProcessLaunch(this, command_line);
for (auto& delegate : delegates_) {
delegate->OnBeforeChildProcessLaunch(this, command_line);
}
}
@ -122,4 +119,13 @@ void ClientAppBrowser::OnScheduleMessagePumpWork(int64 delay) {
}
}
CefRefPtr<CefClient> ClientAppBrowser::GetDefaultClient() {
for (auto& delegate : delegates_) {
if (auto client = delegate->GetDefaultClient(this)) {
return client;
}
}
return nullptr;
}
} // namespace client