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_PROCESS_OBSERVER_H_ | 5 #ifndef CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ |
6 #define CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ | 6 #define CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
14 #include "components/content_settings/core/common/content_settings.h" | 14 #include "components/content_settings/core/common/content_settings.h" |
15 #include "content/public/renderer/render_process_observer.h" | 15 #include "content/public/renderer/render_process_observer.h" |
16 | 16 |
17 class ChromeContentRendererClient; | |
18 class GURL; | 17 class GURL; |
19 struct ContentSettings; | 18 struct ContentSettings; |
20 | 19 |
21 namespace content { | 20 namespace content { |
22 class ResourceDispatcherDelegate; | 21 class ResourceDispatcherDelegate; |
23 } | 22 } |
24 | 23 |
25 // This class filters the incoming control messages (i.e. ones not destined for | 24 // This class filters the incoming control messages (i.e. ones not destined for |
26 // a RenderView) for Chrome specific messages that the content layer doesn't | 25 // a RenderView) for Chrome specific messages that the content layer doesn't |
27 // happen. If a few messages are related, they should probably have their own | 26 // happen. If a few messages are related, they should probably have their own |
28 // observer. | 27 // observer. |
29 class ChromeRenderProcessObserver : public content::RenderProcessObserver, | 28 class ChromeRenderProcessObserver : public content::RenderProcessObserver, |
30 public base::FieldTrialList::Observer { | 29 public base::FieldTrialList::Observer { |
31 public: | 30 public: |
32 explicit ChromeRenderProcessObserver( | 31 ChromeRenderProcessObserver(); |
33 ChromeContentRendererClient* client); | |
34 ~ChromeRenderProcessObserver() override; | 32 ~ChromeRenderProcessObserver() override; |
35 | 33 |
36 static bool is_incognito_process() { return is_incognito_process_; } | 34 static bool is_incognito_process() { return is_incognito_process_; } |
37 | 35 |
38 // Returns a pointer to the content setting rules owned by | 36 // Returns a pointer to the content setting rules owned by |
39 // |ChromeRenderProcessObserver|. | 37 // |ChromeRenderProcessObserver|. |
40 const RendererContentSettingRules* content_setting_rules() const; | 38 const RendererContentSettingRules* content_setting_rules() const; |
41 | 39 |
42 private: | 40 private: |
43 // RenderProcessObserver implementation. | 41 // RenderProcessObserver implementation. |
44 bool OnControlMessageReceived(const IPC::Message& message) override; | 42 bool OnControlMessageReceived(const IPC::Message& message) override; |
45 void WebKitInitialized() override; | 43 void WebKitInitialized() override; |
46 void OnRenderProcessShutdown() override; | 44 void OnRenderProcessShutdown() override; |
47 | 45 |
48 // Observer implementation. | 46 // Observer implementation. |
49 void OnFieldTrialGroupFinalized(const std::string& trial_name, | 47 void OnFieldTrialGroupFinalized(const std::string& trial_name, |
50 const std::string& group_name) override; | 48 const std::string& group_name) override; |
51 | 49 |
52 void OnSetIsIncognitoProcess(bool is_incognito_process); | 50 void OnSetIsIncognitoProcess(bool is_incognito_process); |
53 void OnSetContentSettingsForCurrentURL( | 51 void OnSetContentSettingsForCurrentURL( |
54 const GURL& url, const ContentSettings& content_settings); | 52 const GURL& url, const ContentSettings& content_settings); |
55 void OnSetContentSettingRules(const RendererContentSettingRules& rules); | 53 void OnSetContentSettingRules(const RendererContentSettingRules& rules); |
56 void OnGetCacheResourceStats(); | 54 void OnGetCacheResourceStats(); |
57 void OnSetFieldTrialGroup(const std::string& fiel_trial_name, | 55 void OnSetFieldTrialGroup(const std::string& fiel_trial_name, |
58 const std::string& group_name); | 56 const std::string& group_name); |
59 void OnGetV8HeapStats(); | 57 void OnGetV8HeapStats(); |
60 | 58 |
61 static bool is_incognito_process_; | 59 static bool is_incognito_process_; |
62 scoped_ptr<content::ResourceDispatcherDelegate> resource_delegate_; | 60 scoped_ptr<content::ResourceDispatcherDelegate> resource_delegate_; |
63 ChromeContentRendererClient* client_; | |
64 // If true, the web cache shall be cleared before the next navigation event. | |
65 bool clear_cache_pending_; | |
66 RendererContentSettingRules content_setting_rules_; | 61 RendererContentSettingRules content_setting_rules_; |
67 | 62 |
68 bool webkit_initialized_; | 63 bool webkit_initialized_; |
69 | 64 |
70 DISALLOW_COPY_AND_ASSIGN(ChromeRenderProcessObserver); | 65 DISALLOW_COPY_AND_ASSIGN(ChromeRenderProcessObserver); |
71 }; | 66 }; |
72 | 67 |
73 #endif // CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ | 68 #endif // CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ |
OLD | NEW |