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 |
(...skipping 12 matching lines...) Expand all Loading... | |
23 } | 23 } |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 class ResourceDispatcherDelegate; | 26 class ResourceDispatcherDelegate; |
27 } | 27 } |
28 | 28 |
29 // 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 |
30 // 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 |
31 // 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 |
32 // observer. | 32 // observer. |
33 class ChromeRenderThreadObserver : public content::RenderThreadObserver { | 33 class ChromeRenderThreadObserver : public content::RenderThreadObserver, |
34 public base::FieldTrialList::Observer { | |
Lei Zhang
2016/06/06 23:18:20
IWYU: #include "base/metrics/field_trial.h"
Alexei Svitkine (slow)
2016/06/07 14:48:42
Done.
| |
34 public: | 35 public: |
35 ChromeRenderThreadObserver(); | 36 ChromeRenderThreadObserver(); |
36 ~ChromeRenderThreadObserver() override; | 37 ~ChromeRenderThreadObserver() override; |
37 | 38 |
38 static bool is_incognito_process() { return is_incognito_process_; } | 39 static bool is_incognito_process() { return is_incognito_process_; } |
39 | 40 |
40 // Returns a pointer to the content setting rules owned by | 41 // Returns a pointer to the content setting rules owned by |
41 // |ChromeRenderThreadObserver|. | 42 // |ChromeRenderThreadObserver|. |
42 const RendererContentSettingRules* content_setting_rules() const; | 43 const RendererContentSettingRules* content_setting_rules() const; |
43 | 44 |
44 private: | 45 private: |
45 // Initializes field trial state change observation and notifies the browser | 46 // Initializes field trial state change observation and notifies the browser |
46 // of any field trials that might have already been activated. | 47 // of any field trials that might have already been activated. |
47 void InitFieldTrialObserving(const base::CommandLine& command_line); | 48 void InitFieldTrialObserving(const base::CommandLine& command_line); |
48 | 49 |
49 // content::RenderThreadObserver: | 50 // content::RenderThreadObserver: |
50 bool OnControlMessageReceived(const IPC::Message& message) override; | 51 bool OnControlMessageReceived(const IPC::Message& message) override; |
51 | 52 |
53 // base::FieldTrialList::Observer: | |
54 void OnFieldTrialGroupFinalized(const std::string& trial_name, | |
55 const std::string& group_name) override; | |
56 | |
52 void OnSetIsIncognitoProcess(bool is_incognito_process); | 57 void OnSetIsIncognitoProcess(bool is_incognito_process); |
53 void OnSetContentSettingsForCurrentURL( | 58 void OnSetContentSettingsForCurrentURL( |
54 const GURL& url, const ContentSettings& content_settings); | 59 const GURL& url, const ContentSettings& content_settings); |
55 void OnSetContentSettingRules(const RendererContentSettingRules& rules); | 60 void OnSetContentSettingRules(const RendererContentSettingRules& rules); |
56 void OnGetCacheResourceStats(); | 61 void OnGetCacheResourceStats(); |
57 void OnSetFieldTrialGroup(const std::string& trial_name, | 62 void OnSetFieldTrialGroup(const std::string& trial_name, |
58 const std::string& group_name); | 63 const std::string& group_name); |
59 | 64 |
60 static bool is_incognito_process_; | 65 static bool is_incognito_process_; |
61 std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_; | 66 std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_; |
62 RendererContentSettingRules content_setting_rules_; | 67 RendererContentSettingRules content_setting_rules_; |
63 chrome_variations::ChildProcessFieldTrialSyncer field_trial_syncer_; | 68 chrome_variations::ChildProcessFieldTrialSyncer field_trial_syncer_; |
64 | 69 |
65 base::WeakPtrFactory<ChromeRenderThreadObserver> weak_factory_; | 70 base::WeakPtrFactory<ChromeRenderThreadObserver> weak_factory_; |
66 | 71 |
67 DISALLOW_COPY_AND_ASSIGN(ChromeRenderThreadObserver); | 72 DISALLOW_COPY_AND_ASSIGN(ChromeRenderThreadObserver); |
68 }; | 73 }; |
69 | 74 |
70 #endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ | 75 #endif // CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ |
OLD | NEW |