OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ | 5 #ifndef CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ |
6 #define CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ | 6 #define CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
| 15 #include "chrome/common/renderer_configuration.mojom.h" |
15 #include "components/content_settings/core/common/content_settings.h" | 16 #include "components/content_settings/core/common/content_settings.h" |
16 #include "components/variations/child_process_field_trial_syncer.h" | 17 #include "components/variations/child_process_field_trial_syncer.h" |
17 #include "content/public/renderer/render_thread_observer.h" | 18 #include "content/public/renderer/render_thread_observer.h" |
| 19 #include "mojo/public/cpp/bindings/associated_binding.h" |
18 | 20 |
19 namespace content { | 21 namespace content { |
20 class ResourceDispatcherDelegate; | 22 class ResourceDispatcherDelegate; |
21 } | 23 } |
22 | 24 |
23 namespace visitedlink { | 25 namespace visitedlink { |
24 class VisitedLinkSlave; | 26 class VisitedLinkSlave; |
25 } | 27 } |
26 | 28 |
27 // This class filters the incoming control messages (i.e. ones not destined for | 29 // This class filters the incoming control messages (i.e. ones not destined for |
28 // a RenderView) for Chrome specific messages that the content layer doesn't | 30 // a RenderView) for Chrome specific messages that the content layer doesn't |
29 // happen. If a few messages are related, they should probably have their own | 31 // happen. If a few messages are related, they should probably have their own |
30 // observer. | 32 // observer. |
31 class ChromeRenderThreadObserver : public content::RenderThreadObserver, | 33 class ChromeRenderThreadObserver : public content::RenderThreadObserver, |
32 public base::FieldTrialList::Observer { | 34 public base::FieldTrialList::Observer, |
| 35 public chrome::mojom::RendererConfiguration { |
33 public: | 36 public: |
34 ChromeRenderThreadObserver(); | 37 ChromeRenderThreadObserver(); |
35 ~ChromeRenderThreadObserver() override; | 38 ~ChromeRenderThreadObserver() override; |
36 | 39 |
37 static bool is_incognito_process() { return is_incognito_process_; } | 40 static bool is_incognito_process() { return is_incognito_process_; } |
38 | 41 |
39 // Returns a pointer to the content setting rules owned by | 42 // Returns a pointer to the content setting rules owned by |
40 // |ChromeRenderThreadObserver|. | 43 // |ChromeRenderThreadObserver|. |
41 const RendererContentSettingRules* content_setting_rules() const; | 44 const RendererContentSettingRules* content_setting_rules() const; |
42 | 45 |
43 visitedlink::VisitedLinkSlave* visited_link_slave() { | 46 visitedlink::VisitedLinkSlave* visited_link_slave() { |
44 return visited_link_slave_.get(); | 47 return visited_link_slave_.get(); |
45 } | 48 } |
46 | 49 |
47 private: | 50 private: |
48 // content::RenderThreadObserver: | 51 // content::RenderThreadObserver: |
| 52 void RegisterMojoInterfaces( |
| 53 content::AssociatedInterfaceRegistry* associated_interfaces) override; |
| 54 void UnregisterMojoInterfaces( |
| 55 content::AssociatedInterfaceRegistry* associated_interfaces) override; |
49 bool OnControlMessageReceived(const IPC::Message& message) override; | 56 bool OnControlMessageReceived(const IPC::Message& message) override; |
50 void OnRenderProcessShutdown() override; | 57 void OnRenderProcessShutdown() override; |
51 | 58 |
52 // base::FieldTrialList::Observer: | 59 // base::FieldTrialList::Observer: |
53 void OnFieldTrialGroupFinalized(const std::string& trial_name, | 60 void OnFieldTrialGroupFinalized(const std::string& trial_name, |
54 const std::string& group_name) override; | 61 const std::string& group_name) override; |
55 | 62 |
56 void OnSetIsIncognitoProcess(bool is_incognito_process); | 63 // chrome::mojom::RendererConfiguration: |
| 64 void SetInitialConfiguration(bool is_incognito_process) override; |
| 65 |
| 66 void OnRendererInterfaceRequest( |
| 67 chrome::mojom::RendererConfigurationAssociatedRequest request); |
| 68 |
57 void OnSetContentSettingRules(const RendererContentSettingRules& rules); | 69 void OnSetContentSettingRules(const RendererContentSettingRules& rules); |
58 void OnSetFieldTrialGroup(const std::string& trial_name, | 70 void OnSetFieldTrialGroup(const std::string& trial_name, |
59 const std::string& group_name); | 71 const std::string& group_name); |
60 | 72 |
61 static bool is_incognito_process_; | 73 static bool is_incognito_process_; |
62 std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_; | 74 std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_; |
63 RendererContentSettingRules content_setting_rules_; | 75 RendererContentSettingRules content_setting_rules_; |
64 variations::ChildProcessFieldTrialSyncer field_trial_syncer_; | 76 variations::ChildProcessFieldTrialSyncer field_trial_syncer_; |
65 | 77 |
66 std::unique_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_; | 78 std::unique_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_; |
67 | 79 |
| 80 mojo::AssociatedBinding<chrome::mojom::RendererConfiguration> |
| 81 renderer_configuration_binding_; |
| 82 |
68 base::WeakPtrFactory<ChromeRenderThreadObserver> weak_factory_; | 83 base::WeakPtrFactory<ChromeRenderThreadObserver> weak_factory_; |
69 | 84 |
70 DISALLOW_COPY_AND_ASSIGN(ChromeRenderThreadObserver); | 85 DISALLOW_COPY_AND_ASSIGN(ChromeRenderThreadObserver); |
71 }; | 86 }; |
72 | 87 |
73 #endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ | 88 #endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ |
OLD | NEW |