Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/renderer/chrome_render_thread_observer.h

Issue 2531133002: Convert SetIsIncognitoProcess to use mojo. (Closed)
Patch Set: Convert SetIsIncognitoProcess to use mojo. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 class GURL; 21 class GURL;
20 struct ContentSettings; 22 struct ContentSettings;
21 23
22 namespace content { 24 namespace content {
23 class ResourceDispatcherDelegate; 25 class ResourceDispatcherDelegate;
24 } 26 }
25 27
26 namespace visitedlink { 28 namespace visitedlink {
27 class VisitedLinkSlave; 29 class VisitedLinkSlave;
28 } 30 }
29 31
30 // This class filters the incoming control messages (i.e. ones not destined for 32 // This class filters the incoming control messages (i.e. ones not destined for
31 // a RenderView) for Chrome specific messages that the content layer doesn't 33 // a RenderView) for Chrome specific messages that the content layer doesn't
32 // happen. If a few messages are related, they should probably have their own 34 // happen. If a few messages are related, they should probably have their own
33 // observer. 35 // observer.
34 class ChromeRenderThreadObserver : public content::RenderThreadObserver, 36 class ChromeRenderThreadObserver : public content::RenderThreadObserver,
35 public base::FieldTrialList::Observer { 37 public base::FieldTrialList::Observer,
38 public chrome::mojom::RendererConfiguration {
36 public: 39 public:
37 ChromeRenderThreadObserver(); 40 ChromeRenderThreadObserver();
38 ~ChromeRenderThreadObserver() override; 41 ~ChromeRenderThreadObserver() override;
39 42
40 static bool is_incognito_process() { return is_incognito_process_; } 43 static bool is_incognito_process() { return is_incognito_process_; }
41 44
42 // Returns a pointer to the content setting rules owned by 45 // Returns a pointer to the content setting rules owned by
43 // |ChromeRenderThreadObserver|. 46 // |ChromeRenderThreadObserver|.
44 const RendererContentSettingRules* content_setting_rules() const; 47 const RendererContentSettingRules* content_setting_rules() const;
45 48
46 visitedlink::VisitedLinkSlave* visited_link_slave() { 49 visitedlink::VisitedLinkSlave* visited_link_slave() {
47 return visited_link_slave_.get(); 50 return visited_link_slave_.get();
48 } 51 }
49 52
50 private: 53 private:
51 // content::RenderThreadObserver: 54 // content::RenderThreadObserver:
55 void RegisterMojoInterfaces(
56 content::AssociatedInterfaceRegistry* associated_interfaces) override;
57 void UnregisterMojoInterfaces(
58 content::AssociatedInterfaceRegistry* associated_interfaces) override;
52 bool OnControlMessageReceived(const IPC::Message& message) override; 59 bool OnControlMessageReceived(const IPC::Message& message) override;
53 void OnRenderProcessShutdown() override; 60 void OnRenderProcessShutdown() override;
54 61
55 // base::FieldTrialList::Observer: 62 // base::FieldTrialList::Observer:
56 void OnFieldTrialGroupFinalized(const std::string& trial_name, 63 void OnFieldTrialGroupFinalized(const std::string& trial_name,
57 const std::string& group_name) override; 64 const std::string& group_name) override;
58 65
59 void OnSetIsIncognitoProcess(bool is_incognito_process); 66 // chrome::mojom::RendererConfiguration:
67 void SetInitialConfiguration(bool is_incognito_process) override;
68
69 void OnRendererInterfaceRequest(
70 chrome::mojom::RendererConfigurationAssociatedRequest request);
71
60 void OnSetContentSettingsForCurrentURL( 72 void OnSetContentSettingsForCurrentURL(
61 const GURL& url, const ContentSettings& content_settings); 73 const GURL& url,
74 const ContentSettings& content_settings);
62 void OnSetContentSettingRules(const RendererContentSettingRules& rules); 75 void OnSetContentSettingRules(const RendererContentSettingRules& rules);
63 void OnGetCacheResourceStats(); 76 void OnGetCacheResourceStats();
64 void OnSetFieldTrialGroup(const std::string& trial_name, 77 void OnSetFieldTrialGroup(const std::string& trial_name,
65 const std::string& group_name); 78 const std::string& group_name);
66 79
67 static bool is_incognito_process_; 80 static bool is_incognito_process_;
68 std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_; 81 std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_;
69 RendererContentSettingRules content_setting_rules_; 82 RendererContentSettingRules content_setting_rules_;
70 variations::ChildProcessFieldTrialSyncer field_trial_syncer_; 83 variations::ChildProcessFieldTrialSyncer field_trial_syncer_;
71 84
72 std::unique_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_; 85 std::unique_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_;
73 86
87 mojo::AssociatedBinding<chrome::mojom::RendererConfiguration>
88 renderer_configuration_binding_;
89
74 base::WeakPtrFactory<ChromeRenderThreadObserver> weak_factory_; 90 base::WeakPtrFactory<ChromeRenderThreadObserver> weak_factory_;
75 91
76 DISALLOW_COPY_AND_ASSIGN(ChromeRenderThreadObserver); 92 DISALLOW_COPY_AND_ASSIGN(ChromeRenderThreadObserver);
77 }; 93 };
78 94
79 #endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ 95 #endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698