atom_main_delegate.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. static const char* const kNonWildcardDomainNonPortSchemes[];
  18. static const size_t kNonWildcardDomainNonPortSchemesSize;
  19. AtomMainDelegate();
  20. ~AtomMainDelegate() override;
  21. protected:
  22. // content::ContentMainDelegate:
  23. bool BasicStartupComplete(int* exit_code) override;
  24. void PreSandboxStartup() override;
  25. void PreCreateMainMessageLoop() override;
  26. void PostEarlyInitialization(bool is_running_tests) override;
  27. content::ContentBrowserClient* CreateContentBrowserClient() override;
  28. content::ContentGpuClient* CreateContentGpuClient() override;
  29. content::ContentRendererClient* CreateContentRendererClient() override;
  30. content::ContentUtilityClient* CreateContentUtilityClient() override;
  31. int RunProcess(
  32. const std::string& process_type,
  33. const content::MainFunctionParams& main_function_params) override;
  34. #if defined(OS_MACOSX)
  35. bool DelaySandboxInitialization(const std::string& process_type) override;
  36. #endif
  37. bool ShouldCreateFeatureList() override;
  38. private:
  39. #if defined(OS_MACOSX)
  40. void OverrideChildProcessPath();
  41. void OverrideFrameworkBundlePath();
  42. void SetUpBundleOverrides();
  43. #endif
  44. std::unique_ptr<content::ContentBrowserClient> browser_client_;
  45. std::unique_ptr<content::ContentClient> content_client_;
  46. std::unique_ptr<content::ContentGpuClient> gpu_client_;
  47. std::unique_ptr<content::ContentRendererClient> renderer_client_;
  48. std::unique_ptr<content::ContentUtilityClient> utility_client_;
  49. std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler_;
  50. DISALLOW_COPY_AND_ASSIGN(AtomMainDelegate);
  51. };
  52. } // namespace electron
  53. #endif // SHELL_APP_ATOM_MAIN_DELEGATE_H_