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
|
|
|
|
2013-11-21 21:59:28 +01:00
|
|
|
|
2015-01-31 05:41:36 +01:00
|
|
|
ClientApp::ClientApp() {
|
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.
|
|
|
|
if (!command_line->HasSwitch(kProcessType))
|
|
|
|
return BrowserProcess;
|
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);
|
|
|
|
if (process_type == kRendererProcess)
|
|
|
|
return RendererProcess;
|
|
|
|
#if defined(OS_LINUX)
|
|
|
|
else if (process_type == kZygoteProcess)
|
|
|
|
return ZygoteProcess;
|
|
|
|
#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(
|
|
|
|
CefRefPtr<CefSchemeRegistrar> registrar) {
|
|
|
|
RegisterCustomSchemes(registrar, cookieable_schemes_);
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
2015-01-23 20:09:34 +01:00
|
|
|
|
|
|
|
} // namespace client
|