• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 
5 #include "tests/shared/common/client_app.h"
6 
7 #include "include/cef_command_line.h"
8 
9 namespace client {
10 
11 namespace {
12 
13 // These flags must match the Chromium values.
14 const char kProcessType[] = "type";
15 const char kRendererProcess[] = "renderer";
16 #if defined(OS_LINUX)
17 const char kZygoteProcess[] = "zygote";
18 #endif
19 
20 }  // namespace
21 
ClientApp()22 ClientApp::ClientApp() {}
23 
24 // static
GetProcessType(CefRefPtr<CefCommandLine> command_line)25 ClientApp::ProcessType ClientApp::GetProcessType(
26     CefRefPtr<CefCommandLine> command_line) {
27   // The command-line flag won't be specified for the browser process.
28   if (!command_line->HasSwitch(kProcessType))
29     return BrowserProcess;
30 
31   const std::string& process_type = command_line->GetSwitchValue(kProcessType);
32   if (process_type == kRendererProcess)
33     return RendererProcess;
34 #if defined(OS_LINUX)
35   else if (process_type == kZygoteProcess)
36     return ZygoteProcess;
37 #endif
38 
39   return OtherProcess;
40 }
41 
OnRegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar)42 void ClientApp::OnRegisterCustomSchemes(
43     CefRawPtr<CefSchemeRegistrar> registrar) {
44   RegisterCustomSchemes(registrar);
45 }
46 
47 }  // namespace client
48