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 #include "chrome/browser/resource_message_filter.h" | 5 #include "chrome/browser/resource_message_filter.h" |
6 | 6 |
7 #include "base/clipboard.h" | 7 #include "base/clipboard.h" |
8 #include "base/gfx/native_widget_types.h" | 8 #include "base/gfx/native_widget_types.h" |
9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
10 #include "base/thread.h" | 10 #include "base/thread.h" |
11 #include "chrome/browser/chrome_plugin_browsing_context.h" | 11 #include "chrome/browser/chrome_plugin_browsing_context.h" |
12 #include "chrome/browser/chrome_thread.h" | 12 #include "chrome/browser/chrome_thread.h" |
13 #include "chrome/browser/net/dns_global.h" | 13 #include "chrome/browser/net/dns_global.h" |
14 #include "chrome/browser/printing/print_job_manager.h" | 14 #include "chrome/browser/printing/print_job_manager.h" |
15 #include "chrome/browser/printing/printer_query.h" | 15 #include "chrome/browser/printing/printer_query.h" |
16 #include "chrome/browser/profile.h" | 16 #include "chrome/browser/profile.h" |
17 #include "chrome/browser/plugin_service.h" | 17 #include "chrome/browser/plugin_service.h" |
18 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 18 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
19 #include "chrome/browser/renderer_host/render_widget_helper.h" | 19 #include "chrome/browser/renderer_host/render_widget_helper.h" |
20 #include "chrome/browser/spellchecker.h" | 20 #include "chrome/browser/spellchecker.h" |
21 #include "chrome/common/chrome_plugin_lib.h" | 21 #include "chrome/common/chrome_plugin_lib.h" |
22 #include "chrome/common/chrome_plugin_util.h" | 22 #include "chrome/common/chrome_plugin_util.h" |
23 #include "chrome/common/clipboard_service.h" | 23 #include "chrome/common/clipboard_service.h" |
24 #include "chrome/common/notification_service.h" | 24 #include "chrome/common/notification_service.h" |
25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
26 #include "chrome/common/pref_service.h" | 26 #include "chrome/common/pref_service.h" |
| 27 #include "chrome/common/ipc_message_macros.h" |
27 #include "chrome/common/render_messages.h" | 28 #include "chrome/common/render_messages.h" |
28 #include "net/base/cookie_monster.h" | 29 #include "net/base/cookie_monster.h" |
29 #include "net/base/mime_util.h" | 30 #include "net/base/mime_util.h" |
30 #include "webkit/glue/webkit_glue.h" | 31 #include "webkit/glue/webkit_glue.h" |
31 #include "webkit/glue/webplugin.h" | 32 #include "webkit/glue/webplugin.h" |
32 | 33 |
33 namespace { | 34 namespace { |
34 | 35 |
35 // Context menus are somewhat complicated. We need to intercept them here on | 36 // Context menus are somewhat complicated. We need to intercept them here on |
36 // the I/O thread to add any spelling suggestions to them. After that's done, | 37 // the I/O thread to add any spelling suggestions to them. After that's done, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 BrowserRenderProcessHost::BadMessageTerminateProcess(message.type(), | 226 BrowserRenderProcessHost::BadMessageTerminateProcess(message.type(), |
226 render_handle_); | 227 render_handle_); |
227 } | 228 } |
228 | 229 |
229 return handled; | 230 return handled; |
230 } | 231 } |
231 | 232 |
232 void ResourceMessageFilter::OnReceiveContextMenuMsg(const IPC::Message& msg) { | 233 void ResourceMessageFilter::OnReceiveContextMenuMsg(const IPC::Message& msg) { |
233 void* iter = NULL; | 234 void* iter = NULL; |
234 ViewHostMsg_ContextMenu_Params params; | 235 ViewHostMsg_ContextMenu_Params params; |
235 if (!ParamTraits<ViewHostMsg_ContextMenu_Params>:: | 236 if (!IPC::ParamTraits<ViewHostMsg_ContextMenu_Params>:: |
236 Read(&msg, &iter, ¶ms)) | 237 Read(&msg, &iter, ¶ms)) |
237 return; | 238 return; |
238 | 239 |
239 // Fill in the dictionary suggestions if required. | 240 // Fill in the dictionary suggestions if required. |
240 if (!params.misspelled_word.empty() && | 241 if (!params.misspelled_word.empty() && |
241 spellchecker_ != NULL && params.spellcheck_enabled) { | 242 spellchecker_ != NULL && params.spellcheck_enabled) { |
242 int misspell_location, misspell_length; | 243 int misspell_location, misspell_length; |
243 bool is_misspelled = !spellchecker_->SpellCheckWord( | 244 bool is_misspelled = !spellchecker_->SpellCheckWord( |
244 params.misspelled_word.c_str(), | 245 params.misspelled_word.c_str(), |
245 static_cast<int>(params.misspelled_word.length()), | 246 static_cast<int>(params.misspelled_word.length()), |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 if (type == NotificationType::SPELLCHECKER_REINITIALIZED) { | 732 if (type == NotificationType::SPELLCHECKER_REINITIALIZED) { |
732 spellchecker_ = Details<SpellcheckerReinitializedDetails> | 733 spellchecker_ = Details<SpellcheckerReinitializedDetails> |
733 (details).ptr()->spellchecker; | 734 (details).ptr()->spellchecker; |
734 } | 735 } |
735 } | 736 } |
736 | 737 |
737 void ResourceMessageFilter::OnDnsPrefetch( | 738 void ResourceMessageFilter::OnDnsPrefetch( |
738 const std::vector<std::string>& hostnames) { | 739 const std::vector<std::string>& hostnames) { |
739 chrome_browser_net::DnsPrefetchList(hostnames); | 740 chrome_browser_net::DnsPrefetchList(hostnames); |
740 } | 741 } |
OLD | NEW |