atom_main_delegate.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright (c) 2013 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_APP_ATOM_MAIN_DELEGATE_H_
  5. #define ATOM_APP_ATOM_MAIN_DELEGATE_H_
  6. #include <memory>
  7. #include <string>
  8. #include "brightray/common/content_client.h"
  9. #include "brightray/common/main_delegate.h"
  10. namespace atom {
  11. class AtomMainDelegate : public brightray::MainDelegate {
  12. public:
  13. AtomMainDelegate();
  14. ~AtomMainDelegate() override;
  15. protected:
  16. // content::ContentMainDelegate:
  17. bool BasicStartupComplete(int* exit_code) override;
  18. void PreSandboxStartup() override;
  19. void PreContentInitialization() override;
  20. content::ContentBrowserClient* CreateContentBrowserClient() override;
  21. content::ContentRendererClient* CreateContentRendererClient() override;
  22. content::ContentUtilityClient* CreateContentUtilityClient() override;
  23. int RunProcess(
  24. const std::string& process_type,
  25. const content::MainFunctionParams& main_function_params) override;
  26. #if defined(OS_MACOSX)
  27. bool ShouldSendMachPort(const std::string& process_type) override;
  28. bool DelaySandboxInitialization(const std::string& process_type) override;
  29. #endif
  30. // brightray::MainDelegate:
  31. std::unique_ptr<brightray::ContentClient> CreateContentClient() override;
  32. #if defined(OS_MACOSX)
  33. void OverrideChildProcessPath() override;
  34. void OverrideFrameworkBundlePath() override;
  35. #endif
  36. private:
  37. #if defined(OS_MACOSX)
  38. void SetUpBundleOverrides();
  39. #endif
  40. std::unique_ptr<content::ContentBrowserClient> browser_client_;
  41. std::unique_ptr<content::ContentRendererClient> renderer_client_;
  42. std::unique_ptr<content::ContentUtilityClient> utility_client_;
  43. DISALLOW_COPY_AND_ASSIGN(AtomMainDelegate);
  44. };
  45. } // namespace atom
  46. #endif // ATOM_APP_ATOM_MAIN_DELEGATE_H_