electron_process_manager_delegate.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2019 Slack Technologies, Inc. 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 ELECTRON_SHELL_BROWSER_EXTENSIONS_ELECTRON_PROCESS_MANAGER_DELEGATE_H_
  5. #define ELECTRON_SHELL_BROWSER_EXTENSIONS_ELECTRON_PROCESS_MANAGER_DELEGATE_H_
  6. #include "content/public/browser/notification_observer.h"
  7. #include "content/public/browser/notification_registrar.h"
  8. #include "extensions/browser/process_manager_delegate.h"
  9. class Browser;
  10. class Profile;
  11. namespace extensions {
  12. // Support for ProcessManager. Controls cases where Electron wishes to disallow
  13. // extension background pages or defer their creation.
  14. class ElectronProcessManagerDelegate : public ProcessManagerDelegate {
  15. public:
  16. ElectronProcessManagerDelegate();
  17. ~ElectronProcessManagerDelegate() override;
  18. // disable copy
  19. ElectronProcessManagerDelegate(const ElectronProcessManagerDelegate&) =
  20. delete;
  21. ElectronProcessManagerDelegate& operator=(
  22. const ElectronProcessManagerDelegate&) = delete;
  23. // ProcessManagerDelegate implementation:
  24. bool AreBackgroundPagesAllowedForContext(
  25. content::BrowserContext* context) const override;
  26. bool IsExtensionBackgroundPageAllowed(
  27. content::BrowserContext* context,
  28. const Extension& extension) const override;
  29. bool DeferCreatingStartupBackgroundHosts(
  30. content::BrowserContext* context) const override;
  31. };
  32. } // namespace extensions
  33. #endif // ELECTRON_SHELL_BROWSER_EXTENSIONS_ELECTRON_PROCESS_MANAGER_DELEGATE_H_