forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchrome_render_thread_observer.h
83 lines (64 loc) · 3 KB
/
chrome_render_thread_observer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_
#define CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_
#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/common/renderer_configuration.mojom.h"
#include "components/content_settings/core/common/content_settings.h"
#include "content/public/renderer/render_thread_observer.h"
#include "mojo/public/cpp/bindings/associated_binding_set.h"
namespace content {
class ResourceDispatcherDelegate;
}
namespace visitedlink {
class VisitedLinkSlave;
}
// This class filters the incoming control messages (i.e. ones not destined for
// a RenderView) for Chrome specific messages that the content layer doesn't
// happen. If a few messages are related, they should probably have their own
// observer.
class ChromeRenderThreadObserver : public content::RenderThreadObserver,
public chrome::mojom::RendererConfiguration {
public:
ChromeRenderThreadObserver();
~ChromeRenderThreadObserver() override;
static bool is_incognito_process() { return is_incognito_process_; }
// Return the dynamic parameters - those that may change while the
// render process is running.
static const chrome::mojom::DynamicParams& GetDynamicParams();
// Returns a pointer to the content setting rules owned by
// |ChromeRenderThreadObserver|.
const RendererContentSettingRules* content_setting_rules() const;
visitedlink::VisitedLinkSlave* visited_link_slave() {
return visited_link_slave_.get();
}
private:
// content::RenderThreadObserver:
void RegisterMojoInterfaces(
blink::AssociatedInterfaceRegistry* associated_interfaces) override;
void UnregisterMojoInterfaces(
blink::AssociatedInterfaceRegistry* associated_interfaces) override;
// chrome::mojom::RendererConfiguration:
void SetInitialConfiguration(bool is_incognito_process) override;
void SetConfiguration(chrome::mojom::DynamicParamsPtr params) override;
void SetContentSettingRules(
const RendererContentSettingRules& rules) override;
void SetFieldTrialGroup(const std::string& trial_name,
const std::string& group_name) override;
void OnRendererConfigurationAssociatedRequest(
chrome::mojom::RendererConfigurationAssociatedRequest request);
static bool is_incognito_process_;
std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_;
RendererContentSettingRules content_setting_rules_;
std::unique_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_;
mojo::AssociatedBindingSet<chrome::mojom::RendererConfiguration>
renderer_configuration_bindings_;
base::WeakPtrFactory<ChromeRenderThreadObserver> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ChromeRenderThreadObserver);
};
#endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_