• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "base/macros.h"
12 #include "extensions/browser/extension_host.h"
13 
14 class AlloyBrowserHostImpl;
15 
16 namespace content {
17 class WebContents;
18 }  // namespace content
19 
20 namespace extensions {
21 
22 // The ExtensionHost for a background page. This is a thin wrapper around the
23 // ExtensionHost base class to support CEF-specific constructor. Object lifespan
24 // is managed by ProcessManager.
25 class CefExtensionBackgroundHost : public ExtensionHost {
26  public:
27   CefExtensionBackgroundHost(AlloyBrowserHostImpl* browser,
28                              base::OnceClosure deleted_callback,
29                              const Extension* extension,
30                              content::WebContents* host_contents,
31                              const GURL& url,
32                              mojom::ViewType host_type);
33   ~CefExtensionBackgroundHost() override;
34 
35   // content::WebContentsDelegate methods:
36   bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
37 
38  private:
39   // Callback that will be executed on host deletion.
40   base::OnceClosure deleted_callback_;
41 
42   DISALLOW_COPY_AND_ASSIGN(CefExtensionBackgroundHost);
43 };
44 
45 }  // namespace extensions
46 
47 #endif  // CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_BACKGROUND_HOST_H_
48