| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ |
| 6 #define CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ | 6 #define COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ |
| 7 | |
| 8 #include <string> | |
| 9 | 7 |
| 10 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 11 #include "base/files/file_path.h" | 9 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "chrome/common/content_settings.h" | |
| 14 #include "content/public/renderer/render_process_observer.h" | 10 #include "content/public/renderer/render_process_observer.h" |
| 15 | 11 |
| 16 class ChromeContentRendererClient; | 12 namespace web_cache { |
| 17 class GURL; | |
| 18 struct ContentSettings; | |
| 19 | 13 |
| 20 namespace content { | 14 // This class filters the incoming cache related control messages. |
| 21 class ResourceDispatcherDelegate; | 15 class WebCacheRenderProcessObserver : public content::RenderProcessObserver { |
| 22 } | |
| 23 | |
| 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 | |
| 27 // observer. | |
| 28 class ChromeRenderProcessObserver : public content::RenderProcessObserver { | |
| 29 public: | 16 public: |
| 30 explicit ChromeRenderProcessObserver( | 17 WebCacheRenderProcessObserver(); |
| 31 ChromeContentRendererClient* client); | 18 virtual ~WebCacheRenderProcessObserver(); |
| 32 virtual ~ChromeRenderProcessObserver(); | |
| 33 | |
| 34 static bool is_incognito_process() { return is_incognito_process_; } | |
| 35 | 19 |
| 36 // Needs to be called by RenderViews in case of navigations to execute | 20 // Needs to be called by RenderViews in case of navigations to execute |
| 37 // any 'clear cache' commands that were delayed until the next navigation. | 21 // any 'clear cache' commands that were delayed until the next navigation. |
| 38 void ExecutePendingClearCache(); | 22 void ExecutePendingClearCache(); |
| 39 | 23 |
| 40 // Returns a pointer to the content setting rules owned by | |
| 41 // |ChromeRenderProcessObserver|. | |
| 42 const RendererContentSettingRules* content_setting_rules() const; | |
| 43 | |
| 44 private: | 24 private: |
| 45 // RenderProcessObserver implementation. | 25 // RenderProcessObserver implementation. |
| 46 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | 26 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
| 47 virtual void WebKitInitialized() OVERRIDE; | 27 virtual void WebKitInitialized() OVERRIDE; |
| 48 virtual void OnRenderProcessShutdown() OVERRIDE; | 28 virtual void OnRenderProcessShutdown() OVERRIDE; |
| 49 | 29 |
| 50 void OnSetIsIncognitoProcess(bool is_incognito_process); | 30 // Message handlers. |
| 51 void OnSetContentSettingsForCurrentURL( | |
| 52 const GURL& url, const ContentSettings& content_settings); | |
| 53 void OnSetContentSettingRules(const RendererContentSettingRules& rules); | |
| 54 void OnSetCacheCapacities(size_t min_dead_capacity, | 31 void OnSetCacheCapacities(size_t min_dead_capacity, |
| 55 size_t max_dead_capacity, | 32 size_t max_dead_capacity, |
| 56 size_t capacity); | 33 size_t capacity); |
| 57 // If |on_navigation| is true, the clearing is delayed until the next | 34 // If |on_navigation| is true, the clearing is delayed until the next |
| 58 // navigation event. | 35 // navigation event. |
| 59 void OnClearCache(bool on_navigation); | 36 void OnClearCache(bool on_navigation); |
| 60 void OnGetCacheResourceStats(); | |
| 61 void OnSetFieldTrialGroup(const std::string& fiel_trial_name, | |
| 62 const std::string& group_name); | |
| 63 void OnGetV8HeapStats(); | |
| 64 | 37 |
| 65 static bool is_incognito_process_; | |
| 66 scoped_ptr<content::ResourceDispatcherDelegate> resource_delegate_; | |
| 67 ChromeContentRendererClient* client_; | |
| 68 // If true, the web cache shall be cleared before the next navigation event. | 38 // If true, the web cache shall be cleared before the next navigation event. |
| 69 bool clear_cache_pending_; | 39 bool clear_cache_pending_; |
| 70 RendererContentSettingRules content_setting_rules_; | |
| 71 | |
| 72 bool webkit_initialized_; | 40 bool webkit_initialized_; |
| 73 size_t pending_cache_min_dead_capacity_; | 41 size_t pending_cache_min_dead_capacity_; |
| 74 size_t pending_cache_max_dead_capacity_; | 42 size_t pending_cache_max_dead_capacity_; |
| 75 size_t pending_cache_capacity_; | 43 size_t pending_cache_capacity_; |
| 76 | 44 |
| 77 DISALLOW_COPY_AND_ASSIGN(ChromeRenderProcessObserver); | 45 DISALLOW_COPY_AND_ASSIGN(WebCacheRenderProcessObserver); |
| 78 }; | 46 }; |
| 79 | 47 |
| 80 #endif // CHROME_RENDERER_CHROME_RENDER_PROCESS_OBSERVER_H_ | 48 } // namespace web_cache |
| 49 |
| 50 #endif // COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ |
| 51 |
| OLD | NEW |