Browse Source

fix: override `content::ContentMainDelegate::CreateContentClient()` (#35965)

* fix: override content::ContentMainDelegate::CreateContentClient()

Co-authored-by: Shelley Vohr <[email protected]>

* chore: remove extra call

Co-authored-by: Shelley Vohr <[email protected]>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <[email protected]>
trop[bot] 2 years ago
parent
commit
9048de7cab
2 changed files with 6 additions and 3 deletions
  1. 5 3
      shell/app/electron_main_delegate.cc
  2. 1 0
      shell/app/electron_main_delegate.h

+ 5 - 3
shell/app/electron_main_delegate.cc

@@ -316,9 +316,6 @@ absl::optional<int> ElectronMainDelegate::BasicStartupComplete() {
       ::switches::kDisableGpuMemoryBufferCompositorResources);
 #endif
 
-  content_client_ = std::make_unique<ElectronContentClient>();
-  SetContentClient(content_client_.get());
-
   return absl::nullopt;
 }
 
@@ -437,6 +434,11 @@ base::StringPiece ElectronMainDelegate::GetBrowserV8SnapshotFilename() {
   return ContentMainDelegate::GetBrowserV8SnapshotFilename();
 }
 
+content::ContentClient* ElectronMainDelegate::CreateContentClient() {
+  content_client_ = std::make_unique<ElectronContentClient>();
+  return content_client_.get();
+}
+
 content::ContentBrowserClient*
 ElectronMainDelegate::CreateContentBrowserClient() {
   browser_client_ = std::make_unique<ElectronBrowserClient>();

+ 1 - 0
shell/app/electron_main_delegate.h

@@ -38,6 +38,7 @@ class ElectronMainDelegate : public content::ContentMainDelegate {
   void PreSandboxStartup() override;
   void SandboxInitialized(const std::string& process_type) override;
   absl::optional<int> PreBrowserMain() override;
+  content::ContentClient* CreateContentClient() override;
   content::ContentBrowserClient* CreateContentBrowserClient() override;
   content::ContentGpuClient* CreateContentGpuClient() override;
   content::ContentRendererClient* CreateContentRendererClient() override;