WebMain.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include <include/cef_app.h>
  2. #include "WebAppOther.h"
  3. #include "WebAppRenderer.h"
  4. namespace Atomic
  5. {
  6. using namespace Atomic;
  7. int WebMain(int argc, char* argv[])
  8. {
  9. CefRefPtr<CefCommandLine> command_line = CefCommandLine::CreateCommandLine();
  10. // Provide CEF with command-line arguments.
  11. #ifdef ATOMIC_PLATFORM_WINDOWS
  12. CefMainArgs main_args;
  13. command_line->InitFromString(::GetCommandLineW());
  14. #elif ATOMIC_PLATFORM_OSX
  15. CefMainArgs main_args(argc, argv);
  16. command_line->InitFromArgv(argc, argv);
  17. #else
  18. CefMainArgs main_args(argc, argv);
  19. command_line->InitFromArgv(argc, argv);
  20. #endif
  21. // Create a ClientApp of the correct type.
  22. CefRefPtr<CefApp> app;
  23. WebApp::ProcessType process_type = WebApp::GetProcessType(command_line);
  24. if (process_type == WebApp::RendererProcess || process_type == WebApp::ZygoteProcess)
  25. {
  26. // On Linux the zygote process is used to spawn other process types. Since
  27. // we don't know what type of process it will be give it the renderer
  28. // client.
  29. app = new WebAppRenderer();
  30. }
  31. else if (process_type == WebApp::OtherProcess)
  32. {
  33. app = new WebAppOther();
  34. }
  35. // Execute the secondary process.
  36. return CefExecuteProcess(main_args, app, NULL);
  37. }
  38. }