OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_ |
7 | 7 |
8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif | 10 #endif |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/common/transport_dib.h" | 29 #include "chrome/common/transport_dib.h" |
30 #include "ipc/ipc_channel_proxy.h" | 30 #include "ipc/ipc_channel_proxy.h" |
31 #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" | 31 #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" |
32 | 32 |
33 class AppCacheDispatcherHost; | 33 class AppCacheDispatcherHost; |
34 class AudioRendererHost; | 34 class AudioRendererHost; |
35 class ChromeURLRequestContext; | 35 class ChromeURLRequestContext; |
36 class DatabaseDispatcherHost; | 36 class DatabaseDispatcherHost; |
37 class DOMStorageDispatcherHost; | 37 class DOMStorageDispatcherHost; |
38 class ExtensionMessageService; | 38 class ExtensionMessageService; |
| 39 class HostZoomMap; |
39 class NotificationsPrefsCache; | 40 class NotificationsPrefsCache; |
40 class Profile; | 41 class Profile; |
41 class RenderWidgetHelper; | 42 class RenderWidgetHelper; |
42 class SocketStreamDispatcherHost; | 43 class SocketStreamDispatcherHost; |
43 class SpellChecker; | |
44 class URLRequestContextGetter; | 44 class URLRequestContextGetter; |
45 struct ViewHostMsg_Audio_CreateStream; | 45 struct ViewHostMsg_Audio_CreateStream; |
46 struct WebPluginInfo; | 46 struct WebPluginInfo; |
47 | 47 |
48 namespace printing { | 48 namespace printing { |
49 class PrinterQuery; | 49 class PrinterQuery; |
50 class PrintJobManager; | 50 class PrintJobManager; |
51 } | 51 } |
52 | 52 |
53 namespace webkit_glue { | 53 namespace webkit_glue { |
(...skipping 14 matching lines...) Expand all Loading... |
68 // delayed by costly UI processing that may be occuring on the main thread of | 68 // delayed by costly UI processing that may be occuring on the main thread of |
69 // the browser. It also means that any hangs in starting a network request | 69 // the browser. It also means that any hangs in starting a network request |
70 // will not interfere with browser UI. | 70 // will not interfere with browser UI. |
71 | 71 |
72 class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, | 72 class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, |
73 public ResourceDispatcherHost::Receiver, | 73 public ResourceDispatcherHost::Receiver, |
74 public NotificationObserver, | 74 public NotificationObserver, |
75 public ResolveProxyMsgHelper::Delegate { | 75 public ResolveProxyMsgHelper::Delegate { |
76 public: | 76 public: |
77 // Create the filter. | 77 // Create the filter. |
78 // Note: because the lifecycle of the ResourceMessageFilter is not | |
79 // tied to the lifecycle of the object which created it, the | |
80 // ResourceMessageFilter is 'given' ownership of the spellchecker | |
81 // object and must clean it up on exit. | |
82 ResourceMessageFilter(ResourceDispatcherHost* resource_dispatcher_host, | 78 ResourceMessageFilter(ResourceDispatcherHost* resource_dispatcher_host, |
83 int child_id, | 79 int child_id, |
84 AudioRendererHost* audio_renderer_host, | 80 AudioRendererHost* audio_renderer_host, |
85 PluginService* plugin_service, | 81 PluginService* plugin_service, |
86 printing::PrintJobManager* print_job_manager, | 82 printing::PrintJobManager* print_job_manager, |
87 Profile* profile, | 83 Profile* profile, |
88 RenderWidgetHelper* render_widget_helper, | 84 RenderWidgetHelper* render_widget_helper, |
89 URLRequestContextGetter* request_context); | 85 URLRequestContextGetter* request_context); |
90 | 86 |
91 // IPC::ChannelProxy::MessageFilter methods: | 87 // IPC::ChannelProxy::MessageFilter methods: |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 240 |
245 void OnResourceTypeStats(const WebKit::WebCache::ResourceTypeStats& stats); | 241 void OnResourceTypeStats(const WebKit::WebCache::ResourceTypeStats& stats); |
246 static void OnResourceTypeStatsOnUIThread(WebKit::WebCache::ResourceTypeStats, | 242 static void OnResourceTypeStatsOnUIThread(WebKit::WebCache::ResourceTypeStats, |
247 base::ProcessId renderer_id); | 243 base::ProcessId renderer_id); |
248 | 244 |
249 void OnV8HeapStats(int v8_memory_allocated, int v8_memory_used); | 245 void OnV8HeapStats(int v8_memory_allocated, int v8_memory_used); |
250 static void OnV8HeapStatsOnUIThread(int v8_memory_allocated, | 246 static void OnV8HeapStatsOnUIThread(int v8_memory_allocated, |
251 int v8_memory_used, | 247 int v8_memory_used, |
252 base::ProcessId renderer_id); | 248 base::ProcessId renderer_id); |
253 | 249 |
| 250 void OnDidZoomHost(const std::string& host, int zoom_level); |
| 251 void UpdateHostZoomLevelsOnUIThread(const std::string& host, int zoom_level); |
| 252 |
254 void OnResolveProxy(const GURL& url, IPC::Message* reply_msg); | 253 void OnResolveProxy(const GURL& url, IPC::Message* reply_msg); |
255 | 254 |
256 // ResolveProxyMsgHelper::Delegate implementation: | 255 // ResolveProxyMsgHelper::Delegate implementation: |
257 virtual void OnResolveProxyCompleted(IPC::Message* reply_msg, | 256 virtual void OnResolveProxyCompleted(IPC::Message* reply_msg, |
258 int result, | 257 int result, |
259 const std::string& proxy_list); | 258 const std::string& proxy_list); |
260 | 259 |
261 // A javascript code requested to print the current page. This is done in two | 260 // A javascript code requested to print the current page. This is done in two |
262 // steps and this is the first step. Get the print setting right here | 261 // steps and this is the first step. Get the print setting right here |
263 // synchronously. It will hang the I/O completely. | 262 // synchronously. It will hang the I/O completely. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // owned by this class. | 328 // owned by this class. |
330 IPC::Channel* channel_; | 329 IPC::Channel* channel_; |
331 | 330 |
332 // Cached resource request dispatcher host and plugin service, guaranteed to | 331 // Cached resource request dispatcher host and plugin service, guaranteed to |
333 // be non-null if Init succeeds. We do not own the objects, they are managed | 332 // be non-null if Init succeeds. We do not own the objects, they are managed |
334 // by the BrowserProcess, which has a wider scope than we do. | 333 // by the BrowserProcess, which has a wider scope than we do. |
335 ResourceDispatcherHost* resource_dispatcher_host_; | 334 ResourceDispatcherHost* resource_dispatcher_host_; |
336 PluginService* plugin_service_; | 335 PluginService* plugin_service_; |
337 printing::PrintJobManager* print_job_manager_; | 336 printing::PrintJobManager* print_job_manager_; |
338 | 337 |
339 // ID for the RenderProcessHost that corresponds to this channel. This is | 338 // The Profile associated with our renderer process. This should only be |
340 // used by the ResourceDispatcherHost to look up the TabContents that | 339 // accessed on the UI thread! |
341 // originated URLRequest. Since the RenderProcessHost can be destroyed | 340 Profile* profile_; |
342 // before this object, we only hold an ID for lookup. | |
343 int child_id_; | |
344 | 341 |
345 // Helper class for handling PluginProcessHost_ResolveProxy messages (manages | 342 // Helper class for handling PluginProcessHost_ResolveProxy messages (manages |
346 // the requests to the proxy service). | 343 // the requests to the proxy service). |
347 ResolveProxyMsgHelper resolve_proxy_msg_helper_; | 344 ResolveProxyMsgHelper resolve_proxy_msg_helper_; |
348 | 345 |
349 // Contextual information to be used for requests created here. | 346 // Contextual information to be used for requests created here. |
350 scoped_refptr<URLRequestContextGetter> request_context_; | 347 scoped_refptr<URLRequestContextGetter> request_context_; |
351 | 348 |
352 // A request context specific for media resources. | 349 // A request context specific for media resources. |
353 scoped_refptr<URLRequestContextGetter> media_request_context_; | 350 scoped_refptr<URLRequestContextGetter> media_request_context_; |
354 | 351 |
355 // A request context that holds a cookie store for chrome-extension URLs. | 352 // A request context that holds a cookie store for chrome-extension URLs. |
356 scoped_refptr<URLRequestContextGetter> extensions_request_context_; | 353 scoped_refptr<URLRequestContextGetter> extensions_request_context_; |
357 | 354 |
358 // Used for routing extension messages. | 355 // Used for routing extension messages. |
359 scoped_refptr<ExtensionMessageService> extensions_message_service_; | 356 scoped_refptr<ExtensionMessageService> extensions_message_service_; |
360 | 357 |
361 // A pointer to the profile associated with this filter. | |
362 // | |
363 // DANGER! Do not dereference this pointer! This class lives on the I/O thread | |
364 // and the profile may only be used on the UI thread. It is used only for | |
365 // determining which notifications to watch for. | |
366 // | |
367 // This is void* to prevent people from accidentally dereferencing it. | |
368 // When registering for observers, cast to Profile*. | |
369 void* profile_; | |
370 | |
371 scoped_refptr<RenderWidgetHelper> render_widget_helper_; | 358 scoped_refptr<RenderWidgetHelper> render_widget_helper_; |
372 | 359 |
373 // Object that should take care of audio related resource requests. | 360 // Object that should take care of audio related resource requests. |
374 scoped_refptr<AudioRendererHost> audio_renderer_host_; | 361 scoped_refptr<AudioRendererHost> audio_renderer_host_; |
375 | 362 |
376 // Handles AppCache related messages. | 363 // Handles AppCache related messages. |
377 scoped_ptr<AppCacheDispatcherHost> appcache_dispatcher_host_; | 364 scoped_ptr<AppCacheDispatcherHost> appcache_dispatcher_host_; |
378 | 365 |
379 // Handles DOM Storage related messages. | 366 // Handles DOM Storage related messages. |
380 scoped_refptr<DOMStorageDispatcherHost> dom_storage_dispatcher_host_; | 367 scoped_refptr<DOMStorageDispatcherHost> dom_storage_dispatcher_host_; |
381 | 368 |
382 // Handles HTML5 DB related messages | 369 // Handles HTML5 DB related messages |
383 scoped_refptr<DatabaseDispatcherHost> db_dispatcher_host_; | 370 scoped_refptr<DatabaseDispatcherHost> db_dispatcher_host_; |
384 | 371 |
385 // A cache of notifications preferences which is used to handle | 372 // A cache of notifications preferences which is used to handle |
386 // Desktop Notifications permission messages. | 373 // Desktop Notifications permission messages. |
387 scoped_refptr<NotificationsPrefsCache> notification_prefs_; | 374 scoped_refptr<NotificationsPrefsCache> notification_prefs_; |
388 | 375 |
389 // Handles Socket Stream related messages. | 376 // Handles Socket Stream related messages. |
390 scoped_ptr<SocketStreamDispatcherHost> socket_stream_dispatcher_host_; | 377 scoped_ptr<SocketStreamDispatcherHost> socket_stream_dispatcher_host_; |
391 | 378 |
| 379 // Handles zoom-related messages. |
| 380 scoped_refptr<HostZoomMap> host_zoom_map_; |
| 381 |
392 // Whether this process is used for off the record tabs. | 382 // Whether this process is used for off the record tabs. |
393 bool off_the_record_; | 383 bool off_the_record_; |
394 | 384 |
395 // A callback to create a routing id for the associated renderer process. | 385 // A callback to create a routing id for the associated renderer process. |
396 scoped_ptr<CallbackWithReturnValue<int>::Type> next_route_id_callback_; | 386 scoped_ptr<CallbackWithReturnValue<int>::Type> next_route_id_callback_; |
397 | 387 |
398 DISALLOW_COPY_AND_ASSIGN(ResourceMessageFilter); | 388 DISALLOW_COPY_AND_ASSIGN(ResourceMessageFilter); |
399 }; | 389 }; |
400 | 390 |
401 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_ | 391 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_ |
OLD | NEW |