Componentize ShortcutsBackend
[chromium-blink-merge.git] / chrome / renderer / chrome_render_process_observer.h
blob369de6f6900dca85214e81664c060c81dc5f965c
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_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/metrics/field_trial.h"
15 #include "components/content_settings/core/common/content_settings.h"
16 #include "content/public/renderer/render_process_observer.h"
18 class GURL;
19 struct ContentSettings;
21 namespace content {
22 class ResourceDispatcherDelegate;
25 // 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
27 // happen. If a few messages are related, they should probably have their own
28 // observer.
29 class ChromeRenderProcessObserver : public content::RenderProcessObserver,
30 public base::FieldTrialList::Observer {
31 public:
32 ChromeRenderProcessObserver();
33 ~ChromeRenderProcessObserver() override;
35 static bool is_incognito_process() { return is_incognito_process_; }
37 bool webkit_initialized() const { return webkit_initialized_; }
39 // Returns a pointer to the content setting rules owned by
40 // |ChromeRenderProcessObserver|.
41 const RendererContentSettingRules* content_setting_rules() const;
43 private:
44 // RenderProcessObserver implementation.
45 bool OnControlMessageReceived(const IPC::Message& message) override;
46 void WebKitInitialized() override;
47 void OnRenderProcessShutdown() override;
49 // Observer implementation.
50 void OnFieldTrialGroupFinalized(const std::string& trial_name,
51 const std::string& group_name) override;
53 void OnSetIsIncognitoProcess(bool is_incognito_process);
54 void OnSetContentSettingsForCurrentURL(
55 const GURL& url, const ContentSettings& content_settings);
56 void OnSetContentSettingRules(const RendererContentSettingRules& rules);
57 void OnGetCacheResourceStats();
58 void OnSetFieldTrialGroup(const std::string& fiel_trial_name,
59 const std::string& group_name);
61 static bool is_incognito_process_;
62 scoped_ptr<content::ResourceDispatcherDelegate> resource_delegate_;
63 RendererContentSettingRules content_setting_rules_;
65 bool webkit_initialized_;
67 base::WeakPtrFactory<ChromeRenderProcessObserver> weak_factory_;
69 DISALLOW_COPY_AND_ASSIGN(ChromeRenderProcessObserver);
72 #endif // CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_