WebMain.cpp 949 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #else
  15. CefMainArgs main_args(argc, argv);
  16. command_line->InitFromArgv(argc, argv);
  17. #endif
  18. // Create a ClientApp of the correct type.
  19. CefRefPtr<CefApp> app;
  20. WebApp::ProcessType process_type = WebApp::GetProcessType(command_line);
  21. if (process_type == WebApp::RendererProcess)
  22. {
  23. app = new WebAppRenderer();
  24. }
  25. else if (process_type == WebApp::OtherProcess)
  26. {
  27. app = new WebAppOther();
  28. }
  29. // Execute the secondary process.
  30. return CefExecuteProcess(main_args, app, NULL);
  31. }
  32. }