• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium Embedded Framework Authors.
2 // Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 
6 #ifndef CEF_LIBCEF_RENDERER_ALLOY_ALLOY_RENDER_THREAD_OBSERVER_H_
7 #define CEF_LIBCEF_RENDERER_ALLOY_ALLOY_RENDER_THREAD_OBSERVER_H_
8 
9 #include <memory>
10 
11 #include "base/compiler_specific.h"
12 #include "chrome/common/renderer_configuration.mojom.h"
13 #include "components/content_settings/core/common/content_settings.h"
14 #include "content/public/renderer/render_thread_observer.h"
15 #include "mojo/public/cpp/bindings/associated_receiver_set.h"
16 
17 // This class sends and receives control messages in the renderer process.
18 class AlloyRenderThreadObserver : public content::RenderThreadObserver,
19                                   public chrome::mojom::RendererConfiguration {
20  public:
21   AlloyRenderThreadObserver();
22 
23   AlloyRenderThreadObserver(const AlloyRenderThreadObserver&) = delete;
24   AlloyRenderThreadObserver& operator=(const AlloyRenderThreadObserver&) =
25       delete;
26 
27   ~AlloyRenderThreadObserver() override;
28 
is_incognito_process()29   static bool is_incognito_process() { return is_incognito_process_; }
30 
31   // Return the dynamic parameters - those that may change while the
32   // render process is running.
33   static const chrome::mojom::DynamicParams& GetDynamicParams();
34 
35  private:
36   // content::RenderThreadObserver:
37   void RegisterMojoInterfaces(
38       blink::AssociatedInterfaceRegistry* associated_interfaces) override;
39   void UnregisterMojoInterfaces(
40       blink::AssociatedInterfaceRegistry* associated_interfaces) override;
41 
42   // chrome::mojom::RendererConfiguration:
43   void SetInitialConfiguration(
44       bool is_incognito_process,
45       mojo::PendingReceiver<chrome::mojom::ChromeOSListener> chromeos_listener,
46       mojo::PendingRemote<content_settings::mojom::ContentSettingsManager>
47           content_settings_manager) override;
48   void SetConfiguration(chrome::mojom::DynamicParamsPtr params) override;
49   void SetContentSettingRules(
50       const RendererContentSettingRules& rules) override;
51 
52   void OnRendererConfigurationAssociatedRequest(
53       mojo::PendingAssociatedReceiver<chrome::mojom::RendererConfiguration>
54           receiver);
55 
56   static bool is_incognito_process_;
57 
58   mojo::AssociatedReceiverSet<chrome::mojom::RendererConfiguration>
59       renderer_configuration_receivers_;
60 };
61 
62 #endif  // CEF_LIBCEF_RENDERER_ALLOY_ALLOY_RENDER_THREAD_OBSERVER_H_
63