main.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef WEBLAYER_PUBLIC_MAIN_H_
  5. #define WEBLAYER_PUBLIC_MAIN_H_
  6. #include <string>
  7. #include "base/callback_forward.h"
  8. #include "base/files/file.h"
  9. #include "base/memory/raw_ptr.h"
  10. #include "build/build_config.h"
  11. #if BUILDFLAG(IS_WIN)
  12. #include <windows.h>
  13. #endif
  14. namespace weblayer {
  15. class MainDelegate {
  16. public:
  17. virtual void PreMainMessageLoopRun() = 0;
  18. virtual void PostMainMessageLoopRun() = 0;
  19. virtual void SetMainMessageLoopQuitClosure(
  20. base::OnceClosure quit_closure) = 0;
  21. };
  22. struct MainParams {
  23. MainParams();
  24. MainParams(const MainParams& other);
  25. ~MainParams();
  26. raw_ptr<MainDelegate> delegate;
  27. // If set, logging will redirect to this file.
  28. base::FilePath log_filename;
  29. // The name of the file that has the PAK data.
  30. std::string pak_name;
  31. };
  32. int Main(MainParams params
  33. #if BUILDFLAG(IS_WIN)
  34. #if !defined(WIN_CONSOLE_APP)
  35. ,
  36. HINSTANCE instance
  37. #endif
  38. #else
  39. ,
  40. int argc,
  41. const char** argv
  42. #endif
  43. );
  44. } // namespace weblayer
  45. #endif // WEBLAYER_PUBLIC_MAIN_H_