| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_RESOURCE_MSG_FILTER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_RESOURCE_MSG_FILTER_H_ |
| 6 #define CHROME_BROWSER_RENDERER_RESOURCE_MSG_FILTER_H_ | 6 #define CHROME_BROWSER_RENDERER_RESOURCE_MSG_FILTER_H_ |
| 7 | 7 |
| 8 #include "base/clipboard.h" | 8 #include "base/clipboard.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/gfx/rect.h" | 10 #include "base/gfx/rect.h" |
| 11 #include "base/gfx/native_widget_types.h" | 11 #include "base/gfx/native_widget_types.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/browser/net/resolve_proxy_msg_helper.h" |
| 14 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 15 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 15 #include "chrome/common/ipc_channel_proxy.h" | 16 #include "chrome/common/ipc_channel_proxy.h" |
| 16 #include "chrome/common/notification_service.h" | 17 #include "chrome/common/notification_service.h" |
| 17 #include "webkit/glue/cache_manager.h" | 18 #include "webkit/glue/cache_manager.h" |
| 18 | 19 |
| 19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 20 #include <windows.h> | 21 #include <windows.h> |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 class ClipboardService; | 24 class ClipboardService; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 } | 37 } |
| 37 | 38 |
| 38 // This class filters out incoming IPC messages for network requests and | 39 // This class filters out incoming IPC messages for network requests and |
| 39 // processes them on the IPC thread. As a result, network requests are not | 40 // processes them on the IPC thread. As a result, network requests are not |
| 40 // delayed by costly UI processing that may be occuring on the main thread of | 41 // delayed by costly UI processing that may be occuring on the main thread of |
| 41 // the browser. It also means that any hangs in starting a network request | 42 // the browser. It also means that any hangs in starting a network request |
| 42 // will not interfere with browser UI. | 43 // will not interfere with browser UI. |
| 43 | 44 |
| 44 class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, | 45 class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, |
| 45 public ResourceDispatcherHost::Receiver, | 46 public ResourceDispatcherHost::Receiver, |
| 46 public NotificationObserver { | 47 public NotificationObserver, |
| 48 public ResolveProxyMsgHelper::Delegate { |
| 47 public: | 49 public: |
| 48 // Create the filter. | 50 // Create the filter. |
| 49 // Note: because the lifecycle of the ResourceMessageFilter is not | 51 // Note: because the lifecycle of the ResourceMessageFilter is not |
| 50 // tied to the lifecycle of the object which created it, the | 52 // tied to the lifecycle of the object which created it, the |
| 51 // ResourceMessageFilter is 'given' ownership of the spellchecker | 53 // ResourceMessageFilter is 'given' ownership of the spellchecker |
| 52 // object and must clean it up on exit. | 54 // object and must clean it up on exit. |
| 53 ResourceMessageFilter(ResourceDispatcherHost* resource_dispatcher_host, | 55 ResourceMessageFilter(ResourceDispatcherHost* resource_dispatcher_host, |
| 54 PluginService* plugin_service, | 56 PluginService* plugin_service, |
| 55 printing::PrintJobManager* print_job_manager, | 57 printing::PrintJobManager* print_job_manager, |
| 56 int render_process_host_id, | 58 int render_process_host_id, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 std::string* mime_type); | 152 std::string* mime_type); |
| 151 void OnGetMimeTypeFromFile(const std::wstring& file_path, | 153 void OnGetMimeTypeFromFile(const std::wstring& file_path, |
| 152 std::string* mime_type); | 154 std::string* mime_type); |
| 153 void OnGetPreferredExtensionForMimeType(const std::string& mime_type, | 155 void OnGetPreferredExtensionForMimeType(const std::string& mime_type, |
| 154 std::wstring* ext); | 156 std::wstring* ext); |
| 155 void OnGetCPBrowsingContext(uint32* context); | 157 void OnGetCPBrowsingContext(uint32* context); |
| 156 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, | 158 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, |
| 157 base::SharedMemoryHandle* browser_handle); | 159 base::SharedMemoryHandle* browser_handle); |
| 158 void OnResourceTypeStats(const CacheManager::ResourceTypeStats& stats); | 160 void OnResourceTypeStats(const CacheManager::ResourceTypeStats& stats); |
| 159 | 161 |
| 162 void OnResolveProxy(const GURL& url, IPC::Message* reply_msg); |
| 163 |
| 164 // ResolveProxyMsgHelper::Delegate implementation: |
| 165 virtual void OnResolveProxyCompleted(IPC::Message* reply_msg, |
| 166 int result, |
| 167 const std::string& proxy_list); |
| 168 |
| 160 // A javascript code requested to print the current page. This is done in two | 169 // A javascript code requested to print the current page. This is done in two |
| 161 // steps and this is the first step. Get the print setting right here | 170 // steps and this is the first step. Get the print setting right here |
| 162 // synchronously. It will hang the I/O completely. | 171 // synchronously. It will hang the I/O completely. |
| 163 void OnGetDefaultPrintSettings(IPC::Message* reply_msg); | 172 void OnGetDefaultPrintSettings(IPC::Message* reply_msg); |
| 164 void OnGetDefaultPrintSettingsReply( | 173 void OnGetDefaultPrintSettingsReply( |
| 165 scoped_refptr<printing::PrinterQuery> printer_query, | 174 scoped_refptr<printing::PrinterQuery> printer_query, |
| 166 IPC::Message* reply_msg); | 175 IPC::Message* reply_msg); |
| 167 #if defined(OS_WIN) | 176 #if defined(OS_WIN) |
| 168 // A javascript code requested to print the current page. The renderer host | 177 // A javascript code requested to print the current page. The renderer host |
| 169 // have to show to the user the print dialog and returns the selected print | 178 // have to show to the user the print dialog and returns the selected print |
| (...skipping 27 matching lines...) Expand all Loading... |
| 197 | 206 |
| 198 // ID for the RenderProcessHost that corresponds to this channel. This is | 207 // ID for the RenderProcessHost that corresponds to this channel. This is |
| 199 // used by the ResourceDispatcherHost to look up the TabContents that | 208 // used by the ResourceDispatcherHost to look up the TabContents that |
| 200 // originated URLRequest. Since the RenderProcessHost can be destroyed | 209 // originated URLRequest. Since the RenderProcessHost can be destroyed |
| 201 // before this object, we only hold an ID for lookup. | 210 // before this object, we only hold an ID for lookup. |
| 202 int render_process_host_id_; | 211 int render_process_host_id_; |
| 203 | 212 |
| 204 // Our spellchecker object. | 213 // Our spellchecker object. |
| 205 scoped_refptr<SpellChecker> spellchecker_; | 214 scoped_refptr<SpellChecker> spellchecker_; |
| 206 | 215 |
| 216 // Helper class for handling PluginProcessHost_ResolveProxy messages (manages |
| 217 // the requests to the proxy service). |
| 218 ResolveProxyMsgHelper resolve_proxy_msg_helper_; |
| 219 |
| 207 // Process handle of the renderer process. | 220 // Process handle of the renderer process. |
| 208 base::ProcessHandle render_handle_; | 221 base::ProcessHandle render_handle_; |
| 209 | 222 |
| 210 // Contextual information to be used for requests created here. | 223 // Contextual information to be used for requests created here. |
| 211 scoped_refptr<URLRequestContext> request_context_; | 224 scoped_refptr<URLRequestContext> request_context_; |
| 212 | 225 |
| 213 // A pointer to the profile associated with this filter. | 226 // A pointer to the profile associated with this filter. |
| 214 // | 227 // |
| 215 // DANGER! Do not dereference this pointer! This class lives on the I/O thread | 228 // DANGER! Do not dereference this pointer! This class lives on the I/O thread |
| 216 // and the profile may only be used on the UI thread. It is used only for | 229 // and the profile may only be used on the UI thread. It is used only for |
| 217 // determining which notifications to watch for. | 230 // determining which notifications to watch for. |
| 218 // | 231 // |
| 219 // This is void* to prevent people from accidentally dereferencing it. | 232 // This is void* to prevent people from accidentally dereferencing it. |
| 220 // When registering for observers, cast to Profile*. | 233 // When registering for observers, cast to Profile*. |
| 221 void* profile_; | 234 void* profile_; |
| 222 | 235 |
| 223 scoped_refptr<RenderWidgetHelper> render_widget_helper_; | 236 scoped_refptr<RenderWidgetHelper> render_widget_helper_; |
| 224 | 237 |
| 225 DISALLOW_COPY_AND_ASSIGN(ResourceMessageFilter); | 238 DISALLOW_COPY_AND_ASSIGN(ResourceMessageFilter); |
| 226 }; | 239 }; |
| 227 | 240 |
| 228 #endif // CHROME_BROWSER_RENDERER_RESOURCE_MSG_FILTER_H_ | 241 #endif // CHROME_BROWSER_RENDERER_RESOURCE_MSG_FILTER_H_ |
| OLD | NEW |