• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 The Chromium Embedded Framework 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 
5 #ifndef CEF_LIBCEF_BROWSER_BROWSER_MANAGER_H_
6 #define CEF_LIBCEF_BROWSER_BROWSER_MANAGER_H_
7 
8 #include "cef/libcef/common/mojom/cef.mojom.h"
9 #include "mojo/public/cpp/bindings/remote.h"
10 #include "services/service_manager/public/cpp/binder_registry.h"
11 
12 namespace blink {
13 class AssociatedInterfaceRegistry;
14 }
15 
16 namespace content {
17 class RenderProcessHost;
18 }
19 
20 class CefBrowserManager : public cef::mojom::BrowserManager {
21  public:
22   explicit CefBrowserManager(int render_process_id);
23 
24   CefBrowserManager(const CefBrowserManager&) = delete;
25   CefBrowserManager& operator=(const CefBrowserManager&) = delete;
26 
27   ~CefBrowserManager() override;
28 
29   // Called from the ContentBrowserClient method of the same name.
30   // |associated_registry| is used for interfaces which must be associated with
31   // some IPC::ChannelProxy, meaning that messages on the interface retain FIFO
32   // with respect to legacy Chrome IPC messages sent or dispatched on the
33   // channel.
34   static void ExposeInterfacesToRenderer(
35       service_manager::BinderRegistry* registry,
36       blink::AssociatedInterfaceRegistry* associated_registry,
37       content::RenderProcessHost* host);
38 
39   // Connects to CefRenderManager in the render process.
40   static mojo::Remote<cef::mojom::RenderManager> GetRenderManagerForProcess(
41       content::RenderProcessHost* host);
42 
43  private:
44   // cef::mojom::BrowserManager methods:
45   void GetNewRenderThreadInfo(
46       cef::mojom::BrowserManager::GetNewRenderThreadInfoCallback callback)
47       override;
48   void GetNewBrowserInfo(
49       int32_t render_frame_routing_id,
50       cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback) override;
51 
52   // The process ID of the renderer.
53   const int render_process_id_;
54 };
55 
56 #endif  // CEF_LIBCEF_BROWSER_BROWSER_MANAGER_H_
57