OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) | 1648 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) |
1649 return; | 1649 return; |
1650 | 1650 |
1651 // Notify the observers on the UI thread. | 1651 // Notify the observers on the UI thread. |
1652 ResourceRequestDetails* detail = new ResourceRequestDetails( | 1652 ResourceRequestDetails* detail = new ResourceRequestDetails( |
1653 request, GetCertID(request, child_id)); | 1653 request, GetCertID(request, child_id)); |
1654 BrowserThread::PostTask( | 1654 BrowserThread::PostTask( |
1655 BrowserThread::UI, FROM_HERE, | 1655 BrowserThread::UI, FROM_HERE, |
1656 NewRunnableFunction( | 1656 NewRunnableFunction( |
1657 &ResourceDispatcherHost::NotifyOnUI<ResourceRequestDetails>, | 1657 &ResourceDispatcherHost::NotifyOnUI<ResourceRequestDetails>, |
1658 NotificationType::RESOURCE_RESPONSE_STARTED, | 1658 content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, |
1659 render_process_id, render_view_id, detail)); | 1659 render_process_id, render_view_id, detail)); |
1660 } | 1660 } |
1661 | 1661 |
1662 void ResourceDispatcherHost::NotifyReceivedRedirect(net::URLRequest* request, | 1662 void ResourceDispatcherHost::NotifyReceivedRedirect(net::URLRequest* request, |
1663 int child_id, | 1663 int child_id, |
1664 const GURL& new_url) { | 1664 const GURL& new_url) { |
1665 int render_process_id, render_view_id; | 1665 int render_process_id, render_view_id; |
1666 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) | 1666 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) |
1667 return; | 1667 return; |
1668 | 1668 |
1669 // Notify the observers on the UI thread. | 1669 // Notify the observers on the UI thread. |
1670 ResourceRedirectDetails* detail = new ResourceRedirectDetails( | 1670 ResourceRedirectDetails* detail = new ResourceRedirectDetails( |
1671 request, GetCertID(request, child_id), new_url); | 1671 request, GetCertID(request, child_id), new_url); |
1672 BrowserThread::PostTask( | 1672 BrowserThread::PostTask( |
1673 BrowserThread::UI, FROM_HERE, | 1673 BrowserThread::UI, FROM_HERE, |
1674 NewRunnableFunction( | 1674 NewRunnableFunction( |
1675 &ResourceDispatcherHost::NotifyOnUI<ResourceRedirectDetails>, | 1675 &ResourceDispatcherHost::NotifyOnUI<ResourceRedirectDetails>, |
1676 NotificationType::RESOURCE_RECEIVED_REDIRECT, | 1676 content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, |
1677 render_process_id, render_view_id, detail)); | 1677 render_process_id, render_view_id, detail)); |
1678 } | 1678 } |
1679 | 1679 |
1680 template <class T> | 1680 template <class T> |
1681 void ResourceDispatcherHost::NotifyOnUI(NotificationType type, | 1681 void ResourceDispatcherHost::NotifyOnUI(int type, |
1682 int render_process_id, | 1682 int render_process_id, |
1683 int render_view_id, | 1683 int render_view_id, |
1684 T* detail) { | 1684 T* detail) { |
1685 RenderViewHost* rvh = | 1685 RenderViewHost* rvh = |
1686 RenderViewHost::FromID(render_process_id, render_view_id); | 1686 RenderViewHost::FromID(render_process_id, render_view_id); |
1687 if (rvh) { | 1687 if (rvh) { |
1688 RenderViewHostDelegate* rvhd = rvh->delegate(); | 1688 RenderViewHostDelegate* rvhd = rvh->delegate(); |
1689 NotificationService::current()->Notify( | 1689 NotificationService::current()->Notify( |
1690 type, Source<RenderViewHostDelegate>(rvhd), Details<T>(detail)); | 1690 type, Source<RenderViewHostDelegate>(rvhd), Details<T>(detail)); |
1691 } | 1691 } |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2004 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
2005 } | 2005 } |
2006 | 2006 |
2007 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2007 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
2008 return allow_cross_origin_auth_prompt_; | 2008 return allow_cross_origin_auth_prompt_; |
2009 } | 2009 } |
2010 | 2010 |
2011 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2011 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
2012 allow_cross_origin_auth_prompt_ = value; | 2012 allow_cross_origin_auth_prompt_ = value; |
2013 } | 2013 } |
OLD | NEW |