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 // 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 "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/browser/renderer_host/resource_request_details.h" | 44 #include "chrome/browser/renderer_host/resource_request_details.h" |
45 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h" | 45 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h" |
46 #include "chrome/browser/renderer_host/save_file_resource_handler.h" | 46 #include "chrome/browser/renderer_host/save_file_resource_handler.h" |
47 #include "chrome/browser/renderer_host/socket_stream_dispatcher_host.h" | 47 #include "chrome/browser/renderer_host/socket_stream_dispatcher_host.h" |
48 #include "chrome/browser/renderer_host/sync_resource_handler.h" | 48 #include "chrome/browser/renderer_host/sync_resource_handler.h" |
49 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 49 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
50 #include "chrome/browser/ssl/ssl_client_auth_handler.h" | 50 #include "chrome/browser/ssl/ssl_client_auth_handler.h" |
51 #include "chrome/browser/ssl/ssl_manager.h" | 51 #include "chrome/browser/ssl/ssl_manager.h" |
52 #include "chrome/browser/worker_host/worker_service.h" | 52 #include "chrome/browser/worker_host/worker_service.h" |
53 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
54 #include "chrome/common/extensions/extension_l10n_util.h" | |
55 #include "chrome/common/notification_service.h" | 54 #include "chrome/common/notification_service.h" |
56 #include "chrome/common/render_messages.h" | 55 #include "chrome/common/render_messages.h" |
| 56 #include "chrome/common/url_constants.h" |
57 #include "net/base/auth.h" | 57 #include "net/base/auth.h" |
58 #include "net/base/cert_status_flags.h" | 58 #include "net/base/cert_status_flags.h" |
59 #include "net/base/load_flags.h" | 59 #include "net/base/load_flags.h" |
60 #include "net/base/mime_util.h" | 60 #include "net/base/mime_util.h" |
61 #include "net/base/net_errors.h" | 61 #include "net/base/net_errors.h" |
62 #include "net/base/ssl_cert_request_info.h" | 62 #include "net/base/ssl_cert_request_info.h" |
63 #include "net/url_request/url_request.h" | 63 #include "net/url_request/url_request.h" |
64 #include "net/url_request/url_request_context.h" | 64 #include "net/url_request/url_request_context.h" |
65 #include "webkit/appcache/appcache_interceptor.h" | 65 #include "webkit/appcache/appcache_interceptor.h" |
66 #include "webkit/appcache/appcache_interfaces.h" | 66 #include "webkit/appcache/appcache_interfaces.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 route_id, | 460 route_id, |
461 request_id, | 461 request_id, |
462 request_data.frame_origin, | 462 request_data.frame_origin, |
463 request_data.main_frame_origin, | 463 request_data.main_frame_origin, |
464 request_data.resource_type, | 464 request_data.resource_type, |
465 upload_size, | 465 upload_size, |
466 false, // is download | 466 false, // is download |
467 ResourceType::IsFrame(request_data.resource_type), // allow_download | 467 ResourceType::IsFrame(request_data.resource_type), // allow_download |
468 request_data.host_renderer_id, | 468 request_data.host_renderer_id, |
469 request_data.host_render_view_id); | 469 request_data.host_render_view_id); |
470 extension_l10n_util::ApplyMessageFilterPolicy( | 470 ApplyExtensionMessageFilterPolicy(request_data.url, |
471 request_data.url, request_data.resource_type, extra_info); | 471 request_data.resource_type, |
| 472 extra_info); |
472 SetRequestInfo(request, extra_info); // Request takes ownership. | 473 SetRequestInfo(request, extra_info); // Request takes ownership. |
473 chrome_browser_net::SetOriginProcessUniqueIDForRequest( | 474 chrome_browser_net::SetOriginProcessUniqueIDForRequest( |
474 request_data.origin_child_id, request); | 475 request_data.origin_child_id, request); |
475 | 476 |
476 // Have the appcache associate its extra info with the request. | 477 // Have the appcache associate its extra info with the request. |
477 appcache::AppCacheInterceptor::SetExtraRequestInfo( | 478 appcache::AppCacheInterceptor::SetExtraRequestInfo( |
478 request, context ? context->appcache_service() : NULL, child_id, | 479 request, context ? context->appcache_service() : NULL, child_id, |
479 request_data.appcache_host_id, request_data.resource_type); | 480 request_data.appcache_host_id, request_data.resource_type); |
480 | 481 |
481 // Associate Privacy Blacklist information with the request. | 482 // Associate Privacy Blacklist information with the request. |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 info->child_id()); | 1732 info->child_id()); |
1732 if (cancel_requests) | 1733 if (cancel_requests) |
1733 delete request; | 1734 delete request; |
1734 else | 1735 else |
1735 BeginRequestInternal(request); | 1736 BeginRequestInternal(request); |
1736 } | 1737 } |
1737 | 1738 |
1738 delete requests; | 1739 delete requests; |
1739 } | 1740 } |
1740 | 1741 |
| 1742 // static |
1741 bool ResourceDispatcherHost::IsResourceDispatcherHostMessage( | 1743 bool ResourceDispatcherHost::IsResourceDispatcherHostMessage( |
1742 const IPC::Message& message) { | 1744 const IPC::Message& message) { |
1743 switch (message.type()) { | 1745 switch (message.type()) { |
1744 case ViewHostMsg_RequestResource::ID: | 1746 case ViewHostMsg_RequestResource::ID: |
1745 case ViewHostMsg_CancelRequest::ID: | 1747 case ViewHostMsg_CancelRequest::ID: |
1746 case ViewHostMsg_FollowRedirect::ID: | 1748 case ViewHostMsg_FollowRedirect::ID: |
1747 case ViewHostMsg_ClosePage_ACK::ID: | 1749 case ViewHostMsg_ClosePage_ACK::ID: |
1748 case ViewHostMsg_DataReceived_ACK::ID: | 1750 case ViewHostMsg_DataReceived_ACK::ID: |
1749 case ViewHostMsg_DownloadProgress_ACK::ID: | 1751 case ViewHostMsg_DownloadProgress_ACK::ID: |
1750 case ViewHostMsg_UploadProgress_ACK::ID: | 1752 case ViewHostMsg_UploadProgress_ACK::ID: |
1751 case ViewHostMsg_SyncLoad::ID: | 1753 case ViewHostMsg_SyncLoad::ID: |
1752 return true; | 1754 return true; |
1753 | 1755 |
1754 default: | 1756 default: |
1755 break; | 1757 break; |
1756 } | 1758 } |
1757 | 1759 |
1758 return false; | 1760 return false; |
1759 } | 1761 } |
| 1762 |
| 1763 // static |
| 1764 void ResourceDispatcherHost::ApplyExtensionMessageFilterPolicy( |
| 1765 const GURL& url, |
| 1766 const ResourceType::Type& resource_type, |
| 1767 ResourceDispatcherHostRequestInfo* request_info) { |
| 1768 // Apply filter only to chrome extension css files that don't have |
| 1769 // security filter already set. |
| 1770 if (url.SchemeIs(chrome::kExtensionScheme) && |
| 1771 request_info->filter_policy() == FilterPolicy::DONT_FILTER && |
| 1772 resource_type == ResourceType::STYLESHEET) { |
| 1773 request_info->set_filter_policy(FilterPolicy::FILTER_EXTENSION_MESSAGES); |
| 1774 } |
| 1775 } |
OLD | NEW |