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
3 // found in the LICENSE file.
5 #ifndef CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_
6 #define CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_
10 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/metrics/field_trial.h"
14 #include "components/content_settings/core/common/content_settings.h"
15 #include "content/public/renderer/render_process_observer.h"
18 struct ContentSettings
;
21 class ResourceDispatcherDelegate
;
24 // This class filters the incoming control messages (i.e. ones not destined for
25 // a RenderView) for Chrome specific messages that the content layer doesn't
26 // happen. If a few messages are related, they should probably have their own
28 class ChromeRenderProcessObserver
: public content::RenderProcessObserver
,
29 public base::FieldTrialList::Observer
{
31 ChromeRenderProcessObserver();
32 ~ChromeRenderProcessObserver() override
;
34 static bool is_incognito_process() { return is_incognito_process_
; }
36 // Returns a pointer to the content setting rules owned by
37 // |ChromeRenderProcessObserver|.
38 const RendererContentSettingRules
* content_setting_rules() const;
41 // RenderProcessObserver implementation.
42 bool OnControlMessageReceived(const IPC::Message
& message
) override
;
43 void WebKitInitialized() override
;
44 void OnRenderProcessShutdown() override
;
46 // Observer implementation.
47 void OnFieldTrialGroupFinalized(const std::string
& trial_name
,
48 const std::string
& group_name
) override
;
50 void OnSetIsIncognitoProcess(bool is_incognito_process
);
51 void OnSetContentSettingsForCurrentURL(
52 const GURL
& url
, const ContentSettings
& content_settings
);
53 void OnSetContentSettingRules(const RendererContentSettingRules
& rules
);
54 void OnGetCacheResourceStats();
55 void OnSetFieldTrialGroup(const std::string
& fiel_trial_name
,
56 const std::string
& group_name
);
57 void OnGetV8HeapStats();
59 static bool is_incognito_process_
;
60 scoped_ptr
<content::ResourceDispatcherDelegate
> resource_delegate_
;
61 RendererContentSettingRules content_setting_rules_
;
63 bool webkit_initialized_
;
65 DISALLOW_COPY_AND_ASSIGN(ChromeRenderProcessObserver
);
68 #endif // CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_