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" | |
28 #include "chrome/common/render_messages.h" | 27 #include "chrome/common/render_messages.h" |
29 #include "net/base/cookie_monster.h" | 28 #include "net/base/cookie_monster.h" |
30 #include "net/base/mime_util.h" | 29 #include "net/base/mime_util.h" |
31 #include "webkit/glue/webkit_glue.h" | 30 #include "webkit/glue/webkit_glue.h" |
32 #include "webkit/glue/webplugin.h" | 31 #include "webkit/glue/webplugin.h" |
33 | 32 |
34 namespace { | 33 namespace { |
35 | 34 |
36 // Context menus are somewhat complicated. We need to intercept them here on | 35 // Context menus are somewhat complicated. We need to intercept them here on |
37 // the I/O thread to add any spelling suggestions to them. After that's done, | 36 // 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... |
226 BrowserRenderProcessHost::BadMessageTerminateProcess(message.type(), | 225 BrowserRenderProcessHost::BadMessageTerminateProcess(message.type(), |
227 render_handle_); | 226 render_handle_); |
228 } | 227 } |
229 | 228 |
230 return handled; | 229 return handled; |
231 } | 230 } |
232 | 231 |
233 void ResourceMessageFilter::OnReceiveContextMenuMsg(const IPC::Message& msg) { | 232 void ResourceMessageFilter::OnReceiveContextMenuMsg(const IPC::Message& msg) { |
234 void* iter = NULL; | 233 void* iter = NULL; |
235 ViewHostMsg_ContextMenu_Params params; | 234 ViewHostMsg_ContextMenu_Params params; |
236 if (!IPC::ParamTraits<ViewHostMsg_ContextMenu_Params>:: | 235 if (!ParamTraits<ViewHostMsg_ContextMenu_Params>:: |
237 Read(&msg, &iter, ¶ms)) | 236 Read(&msg, &iter, ¶ms)) |
238 return; | 237 return; |
239 | 238 |
240 // Fill in the dictionary suggestions if required. | 239 // Fill in the dictionary suggestions if required. |
241 if (!params.misspelled_word.empty() && | 240 if (!params.misspelled_word.empty() && |
242 spellchecker_ != NULL && params.spellcheck_enabled) { | 241 spellchecker_ != NULL && params.spellcheck_enabled) { |
243 int misspell_location, misspell_length; | 242 int misspell_location, misspell_length; |
244 bool is_misspelled = !spellchecker_->SpellCheckWord( | 243 bool is_misspelled = !spellchecker_->SpellCheckWord( |
245 params.misspelled_word.c_str(), | 244 params.misspelled_word.c_str(), |
246 static_cast<int>(params.misspelled_word.length()), | 245 static_cast<int>(params.misspelled_word.length()), |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 if (type == NotificationType::SPELLCHECKER_REINITIALIZED) { | 731 if (type == NotificationType::SPELLCHECKER_REINITIALIZED) { |
733 spellchecker_ = Details<SpellcheckerReinitializedDetails> | 732 spellchecker_ = Details<SpellcheckerReinitializedDetails> |
734 (details).ptr()->spellchecker; | 733 (details).ptr()->spellchecker; |
735 } | 734 } |
736 } | 735 } |
737 | 736 |
738 void ResourceMessageFilter::OnDnsPrefetch( | 737 void ResourceMessageFilter::OnDnsPrefetch( |
739 const std::vector<std::string>& hostnames) { | 738 const std::vector<std::string>& hostnames) { |
740 chrome_browser_net::DnsPrefetchList(hostnames); | 739 chrome_browser_net::DnsPrefetchList(hostnames); |
741 } | 740 } |
OLD | NEW |