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

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

Issue 2531133002: Convert SetIsIncognitoProcess to use mojo. (Closed)
Patch Set: 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
« no previous file with comments | « chrome/common/renderer.mojom ('k') | chrome/renderer/chrome_render_thread_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.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::Renderer {
nigeltao1 2016/11/27 01:15:49 Should this be NON_EXPORTED_BASE(public chrome::m
Ken Rockot(use gerrit already) 2016/11/29 23:20:09 That's only relevant if the inheriting class is ex
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;
52 bool OnControlMessageReceived(const IPC::Message& message) override; 57 bool OnControlMessageReceived(const IPC::Message& message) override;
53 void OnRenderProcessShutdown() override; 58 void OnRenderProcessShutdown() override;
54 59
55 // base::FieldTrialList::Observer: 60 // base::FieldTrialList::Observer:
56 void OnFieldTrialGroupFinalized(const std::string& trial_name, 61 void OnFieldTrialGroupFinalized(const std::string& trial_name,
57 const std::string& group_name) override; 62 const std::string& group_name) override;
58 63
59 void OnSetIsIncognitoProcess(bool is_incognito_process); 64 // chrome::mojom::Renderer:
65 void InitialConfiguration(
66 chrome::mojom::InitialConfigurationParamsPtr params) override;
67
68 void OnRendererInterfaceRequest(
69 chrome::mojom::RendererAssociatedRequest request);
70
60 void OnSetContentSettingsForCurrentURL( 71 void OnSetContentSettingsForCurrentURL(
61 const GURL& url, const ContentSettings& content_settings); 72 const GURL& url, const ContentSettings& content_settings);
62 void OnSetContentSettingRules(const RendererContentSettingRules& rules); 73 void OnSetContentSettingRules(const RendererContentSettingRules& rules);
63 void OnGetCacheResourceStats(); 74 void OnGetCacheResourceStats();
64 void OnSetFieldTrialGroup(const std::string& trial_name, 75 void OnSetFieldTrialGroup(const std::string& trial_name,
65 const std::string& group_name); 76 const std::string& group_name);
66 77
67 static bool is_incognito_process_; 78 static bool is_incognito_process_;
68 std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_; 79 std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_;
69 RendererContentSettingRules content_setting_rules_; 80 RendererContentSettingRules content_setting_rules_;
70 variations::ChildProcessFieldTrialSyncer field_trial_syncer_; 81 variations::ChildProcessFieldTrialSyncer field_trial_syncer_;
71 82
72 std::unique_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_; 83 std::unique_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_;
73 84
85 mojo::AssociatedBinding<chrome::mojom::Renderer> renderer_binding_;
86
74 base::WeakPtrFactory<ChromeRenderThreadObserver> weak_factory_; 87 base::WeakPtrFactory<ChromeRenderThreadObserver> weak_factory_;
75 88
76 DISALLOW_COPY_AND_ASSIGN(ChromeRenderThreadObserver); 89 DISALLOW_COPY_AND_ASSIGN(ChromeRenderThreadObserver);
77 }; 90 };
78 91
79 #endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ 92 #endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/common/renderer.mojom ('k') | chrome/renderer/chrome_render_thread_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698