atom_main_delegate.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 SHELL_APP_ATOM_MAIN_DELEGATE_H_
  5. #define SHELL_APP_ATOM_MAIN_DELEGATE_H_
  6. #include <memory>
  7. #include <string>
  8. #include "content/public/app/content_main_delegate.h"
  9. #include "content/public/common/content_client.h"
  10. namespace tracing {
  11. class TracingSamplerProfiler;
  12. }
  13. namespace electron {
  14. void LoadResourceBundle(const std::string& locale);
  15. class AtomMainDelegate : public content::ContentMainDelegate {
  16. public:
  17. AtomMainDelegate();
  18. ~AtomMainDelegate() override;
  19. protected:
  20. // content::ContentMainDelegate:
  21. bool BasicStartupComplete(int* exit_code) override;
  22. void PreSandboxStartup() override;
  23. void PreCreateMainMessageLoop() override;
  24. void PostEarlyInitialization(bool is_running_tests) override;
  25. content::ContentBrowserClient* CreateContentBrowserClient() override;
  26. content::ContentGpuClient* CreateContentGpuClient() override;
  27. content::ContentRendererClient* CreateContentRendererClient() override;
  28. content::ContentUtilityClient* CreateContentUtilityClient() override;
  29. int RunProcess(
  30. const std::string& process_type,
  31. const content::MainFunctionParams& main_function_params) override;
  32. #if defined(OS_MACOSX)
  33. bool DelaySandboxInitialization(const std::string& process_type) override;
  34. #endif
  35. bool ShouldLockSchemeRegistry() override;
  36. bool ShouldCreateFeatureList() override;
  37. private:
  38. #if defined(OS_MACOSX)
  39. void OverrideChildProcessPath();
  40. void OverrideFrameworkBundlePath();
  41. void SetUpBundleOverrides();
  42. #endif
  43. std::unique_ptr<content::ContentBrowserClient> browser_client_;
  44. std::unique_ptr<content::ContentClient> content_client_;
  45. std::unique_ptr<content::ContentGpuClient> gpu_client_;
  46. std::unique_ptr<content::ContentRendererClient> renderer_client_;
  47. std::unique_ptr<content::ContentUtilityClient> utility_client_;
  48. std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler_;
  49. DISALLOW_COPY_AND_ASSIGN(AtomMainDelegate);
  50. };
  51. } // namespace electron
  52. #endif // SHELL_APP_ATOM_MAIN_DELEGATE_H_