offscreen_document_host.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2022 The Chromium Authors. 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 EXTENSIONS_BROWSER_OFFSCREEN_DOCUMENT_HOST_H_
  5. #define EXTENSIONS_BROWSER_OFFSCREEN_DOCUMENT_HOST_H_
  6. #include "extensions/browser/extension_host.h"
  7. class GURL;
  8. namespace content {
  9. class SiteInstance;
  10. }
  11. namespace extensions {
  12. class Extension;
  13. // A host for offscreen extension documents. These are essentially WebContents
  14. // owned by an extension that are rendered offscreen. Unlike background pages,
  15. // these cannot register "lazy" event listeners; they will not be respawned
  16. // in response to API events.
  17. class OffscreenDocumentHost : public ExtensionHost {
  18. public:
  19. OffscreenDocumentHost(const Extension& extension,
  20. content::SiteInstance* site_instance,
  21. const GURL& url);
  22. OffscreenDocumentHost(const OffscreenDocumentHost&) = delete;
  23. OffscreenDocumentHost& operator=(const OffscreenDocumentHost&) = delete;
  24. ~OffscreenDocumentHost() override;
  25. private:
  26. // ExtensionHost:
  27. void OnDidStopFirstLoad() override;
  28. bool IsBackgroundPage() const override;
  29. };
  30. } // namespace extensions
  31. #endif // EXTENSIONS_BROWSER_OFFSCREEN_DOCUMENT_HOST_H_