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

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

Issue 700953002: Send all field trials from the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@finch4
Patch Set: Responded to comments. Created 6 years, 1 month 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_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 "components/content_settings/core/common/content_settings.h" 14 #include "components/content_settings/core/common/content_settings.h"
14 #include "content/public/renderer/render_process_observer.h" 15 #include "content/public/renderer/render_process_observer.h"
15 16
16 class ChromeContentRendererClient; 17 class ChromeContentRendererClient;
17 class GURL; 18 class GURL;
18 struct ContentSettings; 19 struct ContentSettings;
19 20
20 namespace content { 21 namespace content {
21 class ResourceDispatcherDelegate; 22 class ResourceDispatcherDelegate;
22 } 23 }
23 24
24 // This class filters the incoming control messages (i.e. ones not destined for 25 // 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 // 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 27 // happen. If a few messages are related, they should probably have their own
27 // observer. 28 // observer.
28 class ChromeRenderProcessObserver : public content::RenderProcessObserver { 29 class ChromeRenderProcessObserver : public content::RenderProcessObserver,
30 public base::FieldTrialList::Observer {
29 public: 31 public:
30 explicit ChromeRenderProcessObserver( 32 explicit ChromeRenderProcessObserver(
31 ChromeContentRendererClient* client); 33 ChromeContentRendererClient* client);
32 ~ChromeRenderProcessObserver() override; 34 ~ChromeRenderProcessObserver() override;
33 35
34 static bool is_incognito_process() { return is_incognito_process_; } 36 static bool is_incognito_process() { return is_incognito_process_; }
35 37
36 // Returns a pointer to the content setting rules owned by 38 // Returns a pointer to the content setting rules owned by
37 // |ChromeRenderProcessObserver|. 39 // |ChromeRenderProcessObserver|.
38 const RendererContentSettingRules* content_setting_rules() const; 40 const RendererContentSettingRules* content_setting_rules() const;
39 41
40 private: 42 private:
41 // RenderProcessObserver implementation. 43 // RenderProcessObserver implementation.
42 bool OnControlMessageReceived(const IPC::Message& message) override; 44 bool OnControlMessageReceived(const IPC::Message& message) override;
43 void WebKitInitialized() override; 45 void WebKitInitialized() override;
44 void OnRenderProcessShutdown() override; 46 void OnRenderProcessShutdown() override;
45 47
46 void OnSetIsIncognitoProcess(bool is_incognito_process); 48 void OnSetIsIncognitoProcess(bool is_incognito_process);
47 void OnSetContentSettingsForCurrentURL( 49 void OnSetContentSettingsForCurrentURL(
48 const GURL& url, const ContentSettings& content_settings); 50 const GURL& url, const ContentSettings& content_settings);
49 void OnSetContentSettingRules(const RendererContentSettingRules& rules); 51 void OnSetContentSettingRules(const RendererContentSettingRules& rules);
50 void OnGetCacheResourceStats(); 52 void OnGetCacheResourceStats();
51 void OnSetFieldTrialGroup(const std::string& fiel_trial_name, 53 void OnSetFieldTrialGroup(const std::string& fiel_trial_name,
52 const std::string& group_name); 54 const std::string& group_name);
53 void OnGetV8HeapStats(); 55 void OnGetV8HeapStats();
56 void OnFieldTrialGroupFinalized(const std::string& trial_name,
Alexei Svitkine (slow) 2014/11/07 15:51:02 This is implementing base::FieldTrialList::Observe
Georges Khalil 2014/11/07 16:44:23 Done.
57 const std::string& group_name) override;
54 58
55 static bool is_incognito_process_; 59 static bool is_incognito_process_;
56 scoped_ptr<content::ResourceDispatcherDelegate> resource_delegate_; 60 scoped_ptr<content::ResourceDispatcherDelegate> resource_delegate_;
57 ChromeContentRendererClient* client_; 61 ChromeContentRendererClient* client_;
58 // If true, the web cache shall be cleared before the next navigation event. 62 // If true, the web cache shall be cleared before the next navigation event.
59 bool clear_cache_pending_; 63 bool clear_cache_pending_;
60 RendererContentSettingRules content_setting_rules_; 64 RendererContentSettingRules content_setting_rules_;
61 65
62 bool webkit_initialized_; 66 bool webkit_initialized_;
63 67
64 DISALLOW_COPY_AND_ASSIGN(ChromeRenderProcessObserver); 68 DISALLOW_COPY_AND_ASSIGN(ChromeRenderProcessObserver);
65 }; 69 };
66 70
67 #endif // CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ 71 #endif // CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698