2013-01-03 18:24:24 +01:00
|
|
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
2012-04-03 03:34:16 +02:00
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2016-11-18 00:52:42 +01:00
|
|
|
#include "tests/shared/common/client_app.h"
|
2012-04-12 22:21:50 +02:00
|
|
|
|
2015-01-31 05:41:36 +01:00
|
|
|
#include "include/cef_command_line.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2015-01-23 20:09:34 +01:00
|
|
|
namespace client {
|
|
|
|
|
2015-01-31 05:41:36 +01:00
|
|
|
namespace {
|
2014-01-28 00:31:03 +01:00
|
|
|
|
2015-01-31 05:41:36 +01:00
|
|
|
// These flags must match the Chromium values.
|
|
|
|
const char kProcessType[] = "type";
|
|
|
|
const char kRendererProcess[] = "renderer";
|
|
|
|
#if defined(OS_LINUX)
|
|
|
|
const char kZygoteProcess[] = "zygote";
|
|
|
|
#endif
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2015-01-31 05:41:36 +01:00
|
|
|
} // namespace
|
2012-11-02 19:16:28 +01:00
|
|
|
|
2024-01-20 03:22:56 +01:00
|
|
|
ClientApp::ClientApp() = default;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2015-01-31 05:41:36 +01:00
|
|
|
// static
|
|
|
|
ClientApp::ProcessType ClientApp::GetProcessType(
|
|
|
|
CefRefPtr<CefCommandLine> command_line) {
|
|
|
|
// The command-line flag won't be specified for the browser process.
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!command_line->HasSwitch(kProcessType)) {
|
2015-01-31 05:41:36 +01:00
|
|
|
return BrowserProcess;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2015-01-31 05:41:36 +01:00
|
|
|
const std::string& process_type = command_line->GetSwitchValue(kProcessType);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (process_type == kRendererProcess) {
|
2015-01-31 05:41:36 +01:00
|
|
|
return RendererProcess;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-01-31 05:41:36 +01:00
|
|
|
#if defined(OS_LINUX)
|
2023-01-02 23:59:03 +01:00
|
|
|
else if (process_type == kZygoteProcess) {
|
2015-01-31 05:41:36 +01:00
|
|
|
return ZygoteProcess;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-01-31 05:41:36 +01:00
|
|
|
#endif
|
2012-11-02 19:16:28 +01:00
|
|
|
|
2015-01-31 05:41:36 +01:00
|
|
|
return OtherProcess;
|
2012-06-11 17:52:49 +02:00
|
|
|
}
|
|
|
|
|
2015-01-31 05:41:36 +01:00
|
|
|
void ClientApp::OnRegisterCustomSchemes(
|
2017-02-07 22:25:11 +01:00
|
|
|
CefRawPtr<CefSchemeRegistrar> registrar) {
|
2021-04-09 20:34:45 +02:00
|
|
|
RegisterCustomSchemes(registrar);
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
2015-01-23 20:09:34 +01:00
|
|
|
|
|
|
|
} // namespace client
|