| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/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 GURL; | 17 class GURL; |
| 17 struct ContentSettings; | 18 struct ContentSettings; |
| 18 | 19 |
| 19 namespace chrome { | 20 namespace chrome { |
| 20 class ChromeContentRendererClient; | 21 class ChromeContentRendererClient; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 class ResourceDispatcherDelegate; | 25 class ResourceDispatcherDelegate; |
| 25 } | 26 } |
| 26 | 27 |
| 27 // This class filters the incoming control messages (i.e. ones not destined for | 28 // This class filters the incoming control messages (i.e. ones not destined for |
| 28 // a RenderView) for Chrome specific messages that the content layer doesn't | 29 // a RenderView) for Chrome specific messages that the content layer doesn't |
| 29 // happen. If a few messages are related, they should probably have their own | 30 // happen. If a few messages are related, they should probably have their own |
| 30 // observer. | 31 // observer. |
| 31 class ChromeRenderProcessObserver : public content::RenderProcessObserver { | 32 class ChromeRenderProcessObserver : public content::RenderProcessObserver { |
| 32 public: | 33 public: |
| 33 explicit ChromeRenderProcessObserver( | 34 explicit ChromeRenderProcessObserver( |
| 34 chrome::ChromeContentRendererClient* client); | 35 chrome::ChromeContentRendererClient* client); |
| 35 virtual ~ChromeRenderProcessObserver(); | 36 virtual ~ChromeRenderProcessObserver(); |
| 36 | 37 |
| 37 static bool is_incognito_process() { return is_incognito_process_; } | 38 static bool is_incognito_process() { return is_incognito_process_; } |
| 38 | 39 |
| 39 // Needs to be called by RenderViews in case of navigations to execute | 40 // Needs to be called by RenderViews in case of navigations to execute |
| 40 // any 'clear cache' commands that were delayed until the next navigation. | 41 // any 'clear cache' commands that were delayed until the next navigation. |
| 41 void ExecutePendingClearCache(); | 42 void ExecutePendingClearCache(); |
| 42 | 43 |
| 44 // Returns a pointer to the image setting rules owned by |
| 45 // |ChromeRenderProcessObserver|. |
| 46 const ContentSettingsForOneType* image_setting_rules() const; |
| 47 |
| 43 private: | 48 private: |
| 44 // RenderProcessObserver implementation. | 49 // RenderProcessObserver implementation. |
| 45 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | 50 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
| 46 virtual void WebKitInitialized() OVERRIDE; | 51 virtual void WebKitInitialized() OVERRIDE; |
| 47 | 52 |
| 48 void OnSetIsIncognitoProcess(bool is_incognito_process); | 53 void OnSetIsIncognitoProcess(bool is_incognito_process); |
| 49 void OnSetContentSettingsForCurrentURL( | 54 void OnSetContentSettingsForCurrentURL( |
| 50 const GURL& url, const ContentSettings& content_settings); | 55 const GURL& url, const ContentSettings& content_settings); |
| 51 void OnSetDefaultContentSettings(const ContentSettings& content_settings); | 56 void OnSetDefaultContentSettings(const ContentSettings& content_settings); |
| 57 void OnSetImageSettingRules(const ContentSettingsForOneType& settings); |
| 52 void OnSetCacheCapacities(size_t min_dead_capacity, | 58 void OnSetCacheCapacities(size_t min_dead_capacity, |
| 53 size_t max_dead_capacity, | 59 size_t max_dead_capacity, |
| 54 size_t capacity); | 60 size_t capacity); |
| 55 // If |on_navigation| is true, the clearing is delayed until the next | 61 // If |on_navigation| is true, the clearing is delayed until the next |
| 56 // navigation event. | 62 // navigation event. |
| 57 void OnClearCache(bool on_navigation); | 63 void OnClearCache(bool on_navigation); |
| 58 void OnGetCacheResourceStats(); | 64 void OnGetCacheResourceStats(); |
| 59 void OnSetFieldTrialGroup(const std::string& fiel_trial_name, | 65 void OnSetFieldTrialGroup(const std::string& fiel_trial_name, |
| 60 const std::string& group_name); | 66 const std::string& group_name); |
| 61 void OnGetRendererTcmalloc(); | 67 void OnGetRendererTcmalloc(); |
| 62 void OnSetTcmallocHeapProfiling(bool profiling, const std::string& prefix); | 68 void OnSetTcmallocHeapProfiling(bool profiling, const std::string& prefix); |
| 63 void OnWriteTcmallocHeapProfile(const FilePath::StringType& filename); | 69 void OnWriteTcmallocHeapProfile(const FilePath::StringType& filename); |
| 64 void OnGetV8HeapStats(); | 70 void OnGetV8HeapStats(); |
| 65 void OnPurgeMemory(); | 71 void OnPurgeMemory(); |
| 66 | 72 |
| 67 static bool is_incognito_process_; | 73 static bool is_incognito_process_; |
| 68 scoped_ptr<content::ResourceDispatcherDelegate> resource_delegate_; | 74 scoped_ptr<content::ResourceDispatcherDelegate> resource_delegate_; |
| 69 chrome::ChromeContentRendererClient* client_; | 75 chrome::ChromeContentRendererClient* client_; |
| 70 // If true, the web cache shall be cleared before the next navigation event. | 76 // If true, the web cache shall be cleared before the next navigation event. |
| 71 bool clear_cache_pending_; | 77 bool clear_cache_pending_; |
| 78 ContentSettingsForOneType image_setting_rules_; |
| 72 | 79 |
| 73 DISALLOW_COPY_AND_ASSIGN(ChromeRenderProcessObserver); | 80 DISALLOW_COPY_AND_ASSIGN(ChromeRenderProcessObserver); |
| 74 }; | 81 }; |
| 75 | 82 |
| 76 #endif // CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ | 83 #endif // CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ |
| OLD | NEW |