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

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

Issue 2144533002: Convert network hints to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add untracked dependency on mojom Created 4 years, 5 months 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/variations/child_process_field_trial_syncer.h" 15 #include "chrome/common/variations/child_process_field_trial_syncer.h"
16 #include "components/content_settings/core/common/content_settings.h" 16 #include "components/content_settings/core/common/content_settings.h"
17 #include "content/public/renderer/render_thread_observer.h" 17 #include "content/public/renderer/render_thread_observer.h"
18 18
19 class GURL; 19 class GURL;
20 struct ContentSettings; 20 struct ContentSettings;
21 21
22 namespace base { 22 namespace base {
23 class CommandLine; 23 class CommandLine;
24 } 24 }
25 25
26 namespace content { 26 namespace content {
27 class ResourceDispatcherDelegate; 27 class ResourceDispatcherDelegate;
28 } 28 }
29 29
30 namespace network_hints {
31 class PrescientNetworkingDispatcher;
32 }
33
30 // This class filters the incoming control messages (i.e. ones not destined for 34 // 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 35 // 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 36 // happen. If a few messages are related, they should probably have their own
33 // observer. 37 // observer.
34 class ChromeRenderThreadObserver : public content::RenderThreadObserver, 38 class ChromeRenderThreadObserver : public content::RenderThreadObserver,
35 public base::FieldTrialList::Observer { 39 public base::FieldTrialList::Observer {
36 public: 40 public:
37 ChromeRenderThreadObserver(); 41 ChromeRenderThreadObserver();
38 ~ChromeRenderThreadObserver() override; 42 ~ChromeRenderThreadObserver() override;
39 43
40 static bool is_incognito_process() { return is_incognito_process_; } 44 static bool is_incognito_process() { return is_incognito_process_; }
41 45
42 // Returns a pointer to the content setting rules owned by 46 // Returns a pointer to the content setting rules owned by
43 // |ChromeRenderThreadObserver|. 47 // |ChromeRenderThreadObserver|.
44 const RendererContentSettingRules* content_setting_rules() const; 48 const RendererContentSettingRules* content_setting_rules() const;
45 49
50 network_hints::PrescientNetworkingDispatcher*
51 prescient_networking_dispatcher() {
52 return prescient_networking_dispatcher_.get();
53 }
54
46 private: 55 private:
47 // Initializes field trial state change observation and notifies the browser 56 // Initializes field trial state change observation and notifies the browser
48 // of any field trials that might have already been activated. 57 // of any field trials that might have already been activated.
49 void InitFieldTrialObserving(const base::CommandLine& command_line); 58 void InitFieldTrialObserving(const base::CommandLine& command_line);
50 59
51 // content::RenderThreadObserver: 60 // content::RenderThreadObserver:
52 bool OnControlMessageReceived(const IPC::Message& message) override; 61 bool OnControlMessageReceived(const IPC::Message& message) override;
62 void OnRenderProcessShutdown() override;
53 63
54 // base::FieldTrialList::Observer: 64 // base::FieldTrialList::Observer:
55 void OnFieldTrialGroupFinalized(const std::string& trial_name, 65 void OnFieldTrialGroupFinalized(const std::string& trial_name,
56 const std::string& group_name) override; 66 const std::string& group_name) override;
57 67
58 void OnSetIsIncognitoProcess(bool is_incognito_process); 68 void OnSetIsIncognitoProcess(bool is_incognito_process);
59 void OnSetContentSettingsForCurrentURL( 69 void OnSetContentSettingsForCurrentURL(
60 const GURL& url, const ContentSettings& content_settings); 70 const GURL& url, const ContentSettings& content_settings);
61 void OnSetContentSettingRules(const RendererContentSettingRules& rules); 71 void OnSetContentSettingRules(const RendererContentSettingRules& rules);
62 void OnGetCacheResourceStats(); 72 void OnGetCacheResourceStats();
63 void OnSetFieldTrialGroup(const std::string& trial_name, 73 void OnSetFieldTrialGroup(const std::string& trial_name,
64 const std::string& group_name); 74 const std::string& group_name);
65 75
66 static bool is_incognito_process_; 76 static bool is_incognito_process_;
67 std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_; 77 std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_;
68 RendererContentSettingRules content_setting_rules_; 78 RendererContentSettingRules content_setting_rules_;
69 chrome_variations::ChildProcessFieldTrialSyncer field_trial_syncer_; 79 chrome_variations::ChildProcessFieldTrialSyncer field_trial_syncer_;
70 80
81 std::unique_ptr<network_hints::PrescientNetworkingDispatcher>
82 prescient_networking_dispatcher_;
83
71 base::WeakPtrFactory<ChromeRenderThreadObserver> weak_factory_; 84 base::WeakPtrFactory<ChromeRenderThreadObserver> weak_factory_;
72 85
73 DISALLOW_COPY_AND_ASSIGN(ChromeRenderThreadObserver); 86 DISALLOW_COPY_AND_ASSIGN(ChromeRenderThreadObserver);
74 }; 87 };
75 88
76 #endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ 89 #endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698