1 // Copyright 2017 the Chromium Embedded Framework Authors. Portions copyright 2 // 2013 The Chromium Authors. All rights reserved. Use of this source code is 3 // governed by a BSD-style license that can be found in the LICENSE file. 4 5 #ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_BACKGROUND_HOST_H_ 6 #define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_BACKGROUND_HOST_H_ 7 8 #include <memory> 9 10 #include "base/callback_forward.h" 11 #include "extensions/browser/extension_host.h" 12 13 class AlloyBrowserHostImpl; 14 15 namespace content { 16 class WebContents; 17 } // namespace content 18 19 namespace extensions { 20 21 // The ExtensionHost for a background page. This is a thin wrapper around the 22 // ExtensionHost base class to support CEF-specific constructor. Object lifespan 23 // is managed by ProcessManager. 24 class CefExtensionBackgroundHost : public ExtensionHost { 25 public: 26 CefExtensionBackgroundHost(AlloyBrowserHostImpl* browser, 27 base::OnceClosure deleted_callback, 28 const Extension* extension, 29 content::WebContents* host_contents, 30 const GURL& url, 31 mojom::ViewType host_type); 32 33 CefExtensionBackgroundHost(const CefExtensionBackgroundHost&) = delete; 34 CefExtensionBackgroundHost& operator=(const CefExtensionBackgroundHost&) = 35 delete; 36 37 ~CefExtensionBackgroundHost() override; 38 39 // content::WebContentsDelegate methods: 40 bool ShouldAllowRendererInitiatedCrossProcessNavigation( 41 bool is_main_frame_navigation) override; 42 43 private: 44 // Callback that will be executed on host deletion. 45 base::OnceClosure deleted_callback_; 46 }; 47 48 } // namespace extensions 49 50 #endif // CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_BACKGROUND_HOST_H_ 51