| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "net/base/load_flags.h" | 57 #include "net/base/load_flags.h" |
| 58 #include "net/base/mime_util.h" | 58 #include "net/base/mime_util.h" |
| 59 #include "net/base/net_errors.h" | 59 #include "net/base/net_errors.h" |
| 60 #include "net/base/request_priority.h" | 60 #include "net/base/request_priority.h" |
| 61 #include "net/base/ssl_cert_request_info.h" | 61 #include "net/base/ssl_cert_request_info.h" |
| 62 #include "net/url_request/url_request.h" | 62 #include "net/url_request/url_request.h" |
| 63 #include "net/url_request/url_request_context.h" | 63 #include "net/url_request/url_request_context.h" |
| 64 #include "webkit/appcache/appcache_interceptor.h" | 64 #include "webkit/appcache/appcache_interceptor.h" |
| 65 #include "webkit/appcache/appcache_interfaces.h" | 65 #include "webkit/appcache/appcache_interfaces.h" |
| 66 | 66 |
| 67 // TODO(oshima): Enable this for other platforms. |
| 68 #if defined(OS_CHROMEOS) |
| 69 #include "chrome/browser/renderer_host/offline_resource_handler.h" |
| 70 #endif |
| 71 |
| 67 // Uncomment to enable logging of request traffic. | 72 // Uncomment to enable logging of request traffic. |
| 68 // #define LOG_RESOURCE_DISPATCHER_REQUESTS | 73 // #define LOG_RESOURCE_DISPATCHER_REQUESTS |
| 69 | 74 |
| 70 #ifdef LOG_RESOURCE_DISPATCHER_REQUESTS | 75 #ifdef LOG_RESOURCE_DISPATCHER_REQUESTS |
| 71 # define RESOURCE_LOG(stuff) LOG(INFO) << stuff | 76 # define RESOURCE_LOG(stuff) LOG(INFO) << stuff |
| 72 #else | 77 #else |
| 73 # define RESOURCE_LOG(stuff) | 78 # define RESOURCE_LOG(stuff) |
| 74 #endif | 79 #endif |
| 75 | 80 |
| 76 using base::Time; | 81 using base::Time; |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 // Insert a buffered event handler before the actual one. | 445 // Insert a buffered event handler before the actual one. |
| 441 handler = new BufferedResourceHandler(handler, this, request); | 446 handler = new BufferedResourceHandler(handler, this, request); |
| 442 | 447 |
| 443 // Insert safe browsing at the front of the chain, so it gets to decide | 448 // Insert safe browsing at the front of the chain, so it gets to decide |
| 444 // on policies first. | 449 // on policies first. |
| 445 if (safe_browsing_->enabled()) { | 450 if (safe_browsing_->enabled()) { |
| 446 handler = CreateSafeBrowsingResourceHandler(handler, child_id, route_id, | 451 handler = CreateSafeBrowsingResourceHandler(handler, child_id, route_id, |
| 447 request_data.resource_type); | 452 request_data.resource_type); |
| 448 } | 453 } |
| 449 | 454 |
| 455 #if defined(OS_CHROMEOS) |
| 456 // We check offline first, then check safe browsing so that we still can block |
| 457 // unsafe site after we remove offline page. |
| 458 handler = |
| 459 new OfflineResourceHandler(handler, child_id, route_id, this, request); |
| 460 #endif |
| 461 |
| 450 // Make extra info and read footer (contains request ID). | 462 // Make extra info and read footer (contains request ID). |
| 451 ResourceDispatcherHostRequestInfo* extra_info = | 463 ResourceDispatcherHostRequestInfo* extra_info = |
| 452 new ResourceDispatcherHostRequestInfo( | 464 new ResourceDispatcherHostRequestInfo( |
| 453 handler, | 465 handler, |
| 454 process_type, | 466 process_type, |
| 455 child_id, | 467 child_id, |
| 456 route_id, | 468 route_id, |
| 457 request_id, | 469 request_id, |
| 458 request_data.frame_origin, | 470 request_data.frame_origin, |
| 459 request_data.main_frame_origin, | 471 request_data.main_frame_origin, |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 // them. | 1821 // them. |
| 1810 case ResourceType::IMAGE: | 1822 case ResourceType::IMAGE: |
| 1811 return net::LOWEST; | 1823 return net::LOWEST; |
| 1812 | 1824 |
| 1813 default: | 1825 default: |
| 1814 // When new resource types are added, their priority must be considered. | 1826 // When new resource types are added, their priority must be considered. |
| 1815 NOTREACHED(); | 1827 NOTREACHED(); |
| 1816 return net::LOW; | 1828 return net::LOW; |
| 1817 } | 1829 } |
| 1818 } | 1830 } |
| OLD | NEW |