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" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 SpellChecker* spellchecker) | 74 SpellChecker* spellchecker) |
75 : channel_(NULL), | 75 : channel_(NULL), |
76 resource_dispatcher_host_(resource_dispatcher_host), | 76 resource_dispatcher_host_(resource_dispatcher_host), |
77 plugin_service_(plugin_service), | 77 plugin_service_(plugin_service), |
78 print_job_manager_(print_job_manager), | 78 print_job_manager_(print_job_manager), |
79 render_process_host_id_(render_process_host_id), | 79 render_process_host_id_(render_process_host_id), |
80 render_handle_(NULL), | 80 render_handle_(NULL), |
81 request_context_(profile->GetRequestContext()), | 81 request_context_(profile->GetRequestContext()), |
82 profile_(profile), | 82 profile_(profile), |
83 render_widget_helper_(render_widget_helper), | 83 render_widget_helper_(render_widget_helper), |
84 spellchecker_(spellchecker) { | 84 spellchecker_(spellchecker), |
| 85 ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)) { |
85 | 86 |
86 DCHECK(request_context_.get()); | 87 DCHECK(request_context_.get()); |
87 DCHECK(request_context_->cookie_store()); | 88 DCHECK(request_context_->cookie_store()); |
88 } | 89 } |
89 | 90 |
90 ResourceMessageFilter::~ResourceMessageFilter() { | 91 ResourceMessageFilter::~ResourceMessageFilter() { |
91 if (render_handle_) | 92 if (render_handle_) |
92 CloseHandle(render_handle_); | 93 CloseHandle(render_handle_); |
93 | 94 |
94 // This function should be called on the IO thread. | 95 // This function should be called on the IO thread. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 IPC_MESSAGE_HANDLER(ViewHostMsg_GetMimeTypeFromExtension, | 182 IPC_MESSAGE_HANDLER(ViewHostMsg_GetMimeTypeFromExtension, |
182 OnGetMimeTypeFromExtension) | 183 OnGetMimeTypeFromExtension) |
183 IPC_MESSAGE_HANDLER(ViewHostMsg_GetMimeTypeFromFile, | 184 IPC_MESSAGE_HANDLER(ViewHostMsg_GetMimeTypeFromFile, |
184 OnGetMimeTypeFromFile) | 185 OnGetMimeTypeFromFile) |
185 IPC_MESSAGE_HANDLER(ViewHostMsg_GetPreferredExtensionForMimeType, | 186 IPC_MESSAGE_HANDLER(ViewHostMsg_GetPreferredExtensionForMimeType, |
186 OnGetPreferredExtensionForMimeType) | 187 OnGetPreferredExtensionForMimeType) |
187 IPC_MESSAGE_HANDLER(ViewHostMsg_GetCPBrowsingContext, | 188 IPC_MESSAGE_HANDLER(ViewHostMsg_GetCPBrowsingContext, |
188 OnGetCPBrowsingContext) | 189 OnGetCPBrowsingContext) |
189 IPC_MESSAGE_HANDLER(ViewHostMsg_DuplicateSection, OnDuplicateSection) | 190 IPC_MESSAGE_HANDLER(ViewHostMsg_DuplicateSection, OnDuplicateSection) |
190 IPC_MESSAGE_HANDLER(ViewHostMsg_ResourceTypeStats, OnResourceTypeStats) | 191 IPC_MESSAGE_HANDLER(ViewHostMsg_ResourceTypeStats, OnResourceTypeStats) |
| 192 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ResolveProxy, OnResolveProxy) |
191 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetDefaultPrintSettings, | 193 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetDefaultPrintSettings, |
192 OnGetDefaultPrintSettings) | 194 OnGetDefaultPrintSettings) |
193 #if defined(OS_WIN) | 195 #if defined(OS_WIN) |
194 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ScriptedPrint, | 196 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ScriptedPrint, |
195 OnScriptedPrint) | 197 OnScriptedPrint) |
196 #endif | 198 #endif |
197 IPC_MESSAGE_UNHANDLED( | 199 IPC_MESSAGE_UNHANDLED( |
198 handled = false) | 200 handled = false) |
199 IPC_END_MESSAGE_MAP_EX() | 201 IPC_END_MESSAGE_MAP_EX() |
200 | 202 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 HISTOGRAM_COUNTS(L"WebCoreCache.CSSStylesheetsSizeKB", | 539 HISTOGRAM_COUNTS(L"WebCoreCache.CSSStylesheetsSizeKB", |
538 static_cast<int>(stats.css_stylesheets.size / 1024)); | 540 static_cast<int>(stats.css_stylesheets.size / 1024)); |
539 HISTOGRAM_COUNTS(L"WebCoreCache.ScriptsSizeKB", | 541 HISTOGRAM_COUNTS(L"WebCoreCache.ScriptsSizeKB", |
540 static_cast<int>(stats.scripts.size / 1024)); | 542 static_cast<int>(stats.scripts.size / 1024)); |
541 HISTOGRAM_COUNTS(L"WebCoreCache.XSLStylesheetsSizeKB", | 543 HISTOGRAM_COUNTS(L"WebCoreCache.XSLStylesheetsSizeKB", |
542 static_cast<int>(stats.xsl_stylesheets.size / 1024)); | 544 static_cast<int>(stats.xsl_stylesheets.size / 1024)); |
543 HISTOGRAM_COUNTS(L"WebCoreCache.FontsSizeKB", | 545 HISTOGRAM_COUNTS(L"WebCoreCache.FontsSizeKB", |
544 static_cast<int>(stats.fonts.size / 1024)); | 546 static_cast<int>(stats.fonts.size / 1024)); |
545 } | 547 } |
546 | 548 |
| 549 void ResourceMessageFilter::OnResolveProxy(const GURL& url, |
| 550 IPC::Message* reply_msg) { |
| 551 resolve_proxy_msg_helper_.Start(url, reply_msg); |
| 552 } |
| 553 |
| 554 void ResourceMessageFilter::OnResolveProxyCompleted(IPC::Message* reply_msg, |
| 555 int result, |
| 556 const std::string& proxy_list) { |
| 557 ViewHostMsg_ResolveProxy::WriteReplyParams(reply_msg, result, proxy_list); |
| 558 Send(reply_msg); |
| 559 } |
| 560 |
547 void ResourceMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { | 561 void ResourceMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { |
548 scoped_refptr<printing::PrinterQuery> printer_query; | 562 scoped_refptr<printing::PrinterQuery> printer_query; |
549 print_job_manager_->PopPrinterQuery(0, &printer_query); | 563 print_job_manager_->PopPrinterQuery(0, &printer_query); |
550 if (!printer_query.get()) { | 564 if (!printer_query.get()) { |
551 printer_query = new printing::PrinterQuery; | 565 printer_query = new printing::PrinterQuery; |
552 } | 566 } |
553 | 567 |
554 CancelableTask* task = NewRunnableMethod( | 568 CancelableTask* task = NewRunnableMethod( |
555 this, | 569 this, |
556 &ResourceMessageFilter::OnGetDefaultPrintSettingsReply, | 570 &ResourceMessageFilter::OnGetDefaultPrintSettingsReply, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 if (type == NOTIFY_SPELLCHECKER_REINITIALIZED) { | 700 if (type == NOTIFY_SPELLCHECKER_REINITIALIZED) { |
687 spellchecker_ = Details<SpellcheckerReinitializedDetails> | 701 spellchecker_ = Details<SpellcheckerReinitializedDetails> |
688 (details).ptr()->spellchecker; | 702 (details).ptr()->spellchecker; |
689 } | 703 } |
690 } | 704 } |
691 | 705 |
692 void ResourceMessageFilter::OnDnsPrefetch( | 706 void ResourceMessageFilter::OnDnsPrefetch( |
693 const std::vector<std::string>& hostnames) { | 707 const std::vector<std::string>& hostnames) { |
694 chrome_browser_net::DnsPrefetchList(hostnames); | 708 chrome_browser_net::DnsPrefetchList(hostnames); |
695 } | 709 } |
OLD | NEW |