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

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

Issue 7222023: Forward handling of low-mem message to the content renderer client. Add APIs to handle this case. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix constructor Created 9 years, 5 months 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 | Annotate | Revision Log
OLDNEW
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_CONTENT_RENDERER_CLIENT_H_ 5 #ifndef CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_
6 #define CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ 6 #define CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "content/common/notification_observer.h"
12 #include "content/common/notification_registrar.h"
11 #include "content/renderer/content_renderer_client.h" 13 #include "content/renderer/content_renderer_client.h"
12 14
13 class ChromeRenderProcessObserver; 15 class ChromeRenderProcessObserver;
14 class ExtensionDispatcher; 16 class ExtensionDispatcher;
15 class RendererHistogramSnapshots; 17 class RendererHistogramSnapshots;
16 class RendererNetPredictor; 18 class RendererNetPredictor;
17 class SpellCheck; 19 class SpellCheck;
20 class SpellCheckProvider;
18 class VisitedLinkSlave; 21 class VisitedLinkSlave;
19 22
20 namespace safe_browsing { 23 namespace safe_browsing {
21 class PhishingClassifierFilter; 24 class PhishingClassifierFilter;
22 } 25 }
23 26
24 namespace webkit { 27 namespace webkit {
25 namespace npapi { 28 namespace npapi {
26 class PluginGroup; 29 class PluginGroup;
27 } 30 }
28 } 31 }
29 32
30 namespace chrome { 33 namespace chrome {
31 34
32 class ChromeContentRendererClient : public content::ContentRendererClient { 35 class ChromeContentRendererClient : public content::ContentRendererClient,
36 public NotificationObserver {
33 public: 37 public:
34 ChromeContentRendererClient(); 38 ChromeContentRendererClient();
35 virtual ~ChromeContentRendererClient(); 39 virtual ~ChromeContentRendererClient();
36 40
37 virtual void RenderThreadStarted() OVERRIDE; 41 virtual void RenderThreadStarted() OVERRIDE;
38 virtual void RenderViewCreated(RenderView* render_view) OVERRIDE; 42 virtual void RenderViewCreated(RenderView* render_view) OVERRIDE;
39 virtual void SetNumberOfViews(int number_of_views) OVERRIDE; 43 virtual void SetNumberOfViews(int number_of_views) OVERRIDE;
40 virtual SkBitmap* GetSadPluginBitmap() OVERRIDE; 44 virtual SkBitmap* GetSadPluginBitmap() OVERRIDE;
41 virtual std::string GetDefaultEncoding() OVERRIDE; 45 virtual std::string GetDefaultEncoding() OVERRIDE;
42 virtual WebKit::WebPlugin* CreatePlugin( 46 virtual WebKit::WebPlugin* CreatePlugin(
(...skipping 23 matching lines...) Expand all
66 size_t length) OVERRIDE; 70 size_t length) OVERRIDE;
67 virtual bool IsLinkVisited(unsigned long long link_hash) OVERRIDE; 71 virtual bool IsLinkVisited(unsigned long long link_hash) OVERRIDE;
68 virtual void PrefetchHostName(const char* hostname, size_t length) OVERRIDE; 72 virtual void PrefetchHostName(const char* hostname, size_t length) OVERRIDE;
69 virtual bool ShouldOverridePageVisibilityState( 73 virtual bool ShouldOverridePageVisibilityState(
70 const RenderView* render_view, 74 const RenderView* render_view,
71 WebKit::WebPageVisibilityState* override_state) const OVERRIDE; 75 WebKit::WebPageVisibilityState* override_state) const OVERRIDE;
72 76
73 // For testing. 77 // For testing.
74 void SetExtensionDispatcher(ExtensionDispatcher* extension_dispatcher); 78 void SetExtensionDispatcher(ExtensionDispatcher* extension_dispatcher);
75 79
80 // NotificationObserver
81 void Observe(int type,
82 const NotificationSource& source,
83 const NotificationDetails& details) OVERRIDE;
84
85 // Called in low-memory conditions to dump the memory used by the spellchecker
86 // and start over.
87 void ResetSpellCheck();
88
76 private: 89 private:
77 WebKit::WebPlugin* CreatePluginPlaceholder( 90 WebKit::WebPlugin* CreatePluginPlaceholder(
78 RenderView* render_view, 91 RenderView* render_view,
79 WebKit::WebFrame* frame, 92 WebKit::WebFrame* frame,
80 const WebKit::WebPluginParams& params, 93 const WebKit::WebPluginParams& params,
81 const webkit::npapi::PluginGroup& group, 94 const webkit::npapi::PluginGroup& group,
82 int resource_id, 95 int resource_id,
83 int message_id, 96 int message_id,
84 bool is_blocked_for_prerendering, 97 bool is_blocked_for_prerendering,
85 bool allow_loading); 98 bool allow_loading);
86 99
87 // Returns true if the frame is navigating to an URL either into or out of an 100 // Returns true if the frame is navigating to an URL either into or out of an
88 // extension app's extent. 101 // extension app's extent.
89 bool CrossesExtensionExtents(WebKit::WebFrame* frame, const GURL& new_url); 102 bool CrossesExtensionExtents(WebKit::WebFrame* frame, const GURL& new_url);
90 103
91 scoped_ptr<ChromeRenderProcessObserver> chrome_observer_; 104 scoped_ptr<ChromeRenderProcessObserver> chrome_observer_;
92 scoped_ptr<ExtensionDispatcher> extension_dispatcher_; 105 scoped_ptr<ExtensionDispatcher> extension_dispatcher_;
93 scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_; 106 scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_;
94 scoped_ptr<RendererNetPredictor> net_predictor_; 107 scoped_ptr<RendererNetPredictor> net_predictor_;
95 scoped_ptr<SpellCheck> spellcheck_; 108 scoped_ptr<SpellCheck> spellcheck_;
109 scoped_ptr<SpellCheckProvider> spellcheck_provider_;
96 scoped_ptr<VisitedLinkSlave> visited_link_slave_; 110 scoped_ptr<VisitedLinkSlave> visited_link_slave_;
97 scoped_ptr<safe_browsing::PhishingClassifierFilter> phishing_classifier_; 111 scoped_ptr<safe_browsing::PhishingClassifierFilter> phishing_classifier_;
112
113 NotificationRegistrar registrar_;
98 }; 114 };
99 115
100 } // namespace chrome 116 } // namespace chrome
101 117
102 #endif // CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ 118 #endif // CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698