OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/renderer_host/resource_message_filter.h" | 5 #include "chrome/browser/renderer_host/resource_message_filter.h" |
6 | 6 |
7 #include "app/clipboard/clipboard.h" | 7 #include "app/clipboard/clipboard.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/chrome_thread.h" | 28 #include "chrome/browser/chrome_thread.h" |
29 #include "chrome/browser/clipboard_dispatcher.h" | 29 #include "chrome/browser/clipboard_dispatcher.h" |
30 #include "chrome/browser/device_orientation/dispatcher_host.h" | 30 #include "chrome/browser/device_orientation/dispatcher_host.h" |
31 #include "chrome/browser/download/download_file.h" | 31 #include "chrome/browser/download/download_file.h" |
32 #include "chrome/browser/extensions/extension_message_service.h" | 32 #include "chrome/browser/extensions/extension_message_service.h" |
33 #include "chrome/browser/file_system/file_system_dispatcher_host.h" | 33 #include "chrome/browser/file_system/file_system_dispatcher_host.h" |
34 #include "chrome/browser/file_system/file_system_host_context.h" | 34 #include "chrome/browser/file_system/file_system_host_context.h" |
35 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 35 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
36 #include "chrome/browser/geolocation/geolocation_dispatcher_host.h" | 36 #include "chrome/browser/geolocation/geolocation_dispatcher_host.h" |
37 #include "chrome/browser/gpu_process_host.h" | 37 #include "chrome/browser/gpu_process_host.h" |
| 38 #if defined(USE_NSS) && defined(TOOLKIT_USES_GTK) |
| 39 #include "chrome/browser/gtk/pk11_password_dialog.h" |
| 40 #endif // defined(USE_NSS) && defined(TOOLKIT_USES_GTK) |
38 #include "chrome/browser/host_zoom_map.h" | 41 #include "chrome/browser/host_zoom_map.h" |
39 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" | 42 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" |
40 #include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 43 #include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
41 #include "chrome/browser/metrics/histogram_synchronizer.h" | 44 #include "chrome/browser/metrics/histogram_synchronizer.h" |
42 #include "chrome/browser/nacl_host/nacl_process_host.h" | 45 #include "chrome/browser/nacl_host/nacl_process_host.h" |
43 #include "chrome/browser/net/chrome_url_request_context.h" | 46 #include "chrome/browser/net/chrome_url_request_context.h" |
44 #include "chrome/browser/net/predictor_api.h" | 47 #include "chrome/browser/net/predictor_api.h" |
45 #include "chrome/browser/notifications/desktop_notification_service.h" | 48 #include "chrome/browser/notifications/desktop_notification_service.h" |
46 #include "chrome/browser/notifications/notifications_prefs_cache.h" | 49 #include "chrome/browser/notifications/notifications_prefs_cache.h" |
47 #include "chrome/browser/plugin_service.h" | 50 #include "chrome/browser/plugin_service.h" |
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 FROM_HERE, | 1608 FROM_HERE, |
1606 NewRunnableMethod( | 1609 NewRunnableMethod( |
1607 this, &ResourceMessageFilter::OnKeygenOnWorkerThread, | 1610 this, &ResourceMessageFilter::OnKeygenOnWorkerThread, |
1608 key_size_in_bits, challenge_string, url, reply_msg), | 1611 key_size_in_bits, challenge_string, url, reply_msg), |
1609 true)) { | 1612 true)) { |
1610 NOTREACHED() << "Failed to dispatch keygen task to worker pool"; | 1613 NOTREACHED() << "Failed to dispatch keygen task to worker pool"; |
1611 ViewHostMsg_Keygen::WriteReplyParams(reply_msg, std::string()); | 1614 ViewHostMsg_Keygen::WriteReplyParams(reply_msg, std::string()); |
1612 Send(reply_msg); | 1615 Send(reply_msg); |
1613 return; | 1616 return; |
1614 } | 1617 } |
| 1618 |
| 1619 // Disable the hang monitor while we generate a key. There may also |
| 1620 // be a dialog with NSS and GTK. |
| 1621 // |
| 1622 // TODO(davidben): This won't work until we figure out the render |
| 1623 // view id. |
| 1624 CallRenderViewHost(id(), FIXME, &RenderViewHost::StopHangMonitorTimeout); |
1615 } | 1625 } |
1616 | 1626 |
1617 void ResourceMessageFilter::OnKeygenOnWorkerThread( | 1627 void ResourceMessageFilter::OnKeygenOnWorkerThread( |
1618 int key_size_in_bits, | 1628 int key_size_in_bits, |
1619 const std::string& challenge_string, | 1629 const std::string& challenge_string, |
1620 const GURL& url, | 1630 const GURL& url, |
1621 IPC::Message* reply_msg) { | 1631 IPC::Message* reply_msg) { |
1622 DCHECK(reply_msg); | 1632 DCHECK(reply_msg); |
1623 // Verify we are on a worker thread. | 1633 // Verify we are on a worker thread. |
1624 DCHECK(!MessageLoop::current()); | 1634 DCHECK(!MessageLoop::current()); |
1625 | 1635 |
1626 // Generate a signed public key and challenge, then send it back. | 1636 // Generate a signed public key and challenge, then send it back. |
1627 net::KeygenHandler keygen_handler(key_size_in_bits, challenge_string, url); | 1637 net::KeygenHandler keygen_handler(key_size_in_bits, challenge_string, url); |
1628 | 1638 |
| 1639 #if defined(USE_NSS) && defined(TOOLKIT_USES_GTK) |
| 1640 // Attach a password delegate so we can authenticate. |
| 1641 keygen_handler.set_pk11_password_delegate( |
| 1642 browser::NewPK11BlockingDialogDelegate(browser::kPK11PasswordKeygen, |
| 1643 url)); |
| 1644 #endif // defined(USE_NSS) && defined(TOOLKIT_USES_GTK) |
| 1645 |
1629 ViewHostMsg_Keygen::WriteReplyParams( | 1646 ViewHostMsg_Keygen::WriteReplyParams( |
1630 reply_msg, | 1647 reply_msg, |
1631 keygen_handler.GenKeyAndSignChallenge()); | 1648 keygen_handler.GenKeyAndSignChallenge()); |
1632 | 1649 |
1633 ChromeThread::PostTask( | 1650 ChromeThread::PostTask( |
1634 ChromeThread::IO, FROM_HERE, | 1651 ChromeThread::IO, FROM_HERE, |
1635 NewRunnableMethod(this, &ResourceMessageFilter::Send, reply_msg)); | 1652 NewRunnableMethod(this, &ResourceMessageFilter::Send, reply_msg)); |
| 1653 |
| 1654 // Okay, the hang monitor can be enabled again. |
| 1655 // |
| 1656 // TODO(davidben): This won't work until we figure out the render |
| 1657 // view id. |
| 1658 CallRenderViewHost(id(), FIXME, &RenderViewHost::RestartHangMonitorTimeout); |
1636 } | 1659 } |
1637 | 1660 |
1638 #if defined(USE_TCMALLOC) | 1661 #if defined(USE_TCMALLOC) |
1639 void ResourceMessageFilter::OnRendererTcmalloc(base::ProcessId pid, | 1662 void ResourceMessageFilter::OnRendererTcmalloc(base::ProcessId pid, |
1640 const std::string& output) { | 1663 const std::string& output) { |
1641 ChromeThread::PostTask( | 1664 ChromeThread::PostTask( |
1642 ChromeThread::UI, FROM_HERE, | 1665 ChromeThread::UI, FROM_HERE, |
1643 NewRunnableFunction(AboutTcmallocRendererCallback, pid, output)); | 1666 NewRunnableFunction(AboutTcmallocRendererCallback, pid, output)); |
1644 } | 1667 } |
1645 #endif | 1668 #endif |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 | 1841 |
1819 ViewHostMsg_GetRawCookies::WriteReplyParams(reply_msg_, cookies); | 1842 ViewHostMsg_GetRawCookies::WriteReplyParams(reply_msg_, cookies); |
1820 filter_->Send(reply_msg_); | 1843 filter_->Send(reply_msg_); |
1821 delete this; | 1844 delete this; |
1822 } | 1845 } |
1823 } | 1846 } |
1824 | 1847 |
1825 void GetCookiesCompletion::set_cookie_store(CookieStore* cookie_store) { | 1848 void GetCookiesCompletion::set_cookie_store(CookieStore* cookie_store) { |
1826 cookie_store_ = cookie_store; | 1849 cookie_store_ = cookie_store; |
1827 } | 1850 } |
OLD | NEW |