OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_resource_dispatcher_host_delegate.
h" | 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 child_id, route_id, prerender::FINAL_STATUS_INVALID_HTTP_METHOD); | 110 child_id, route_id, prerender::FINAL_STATUS_INVALID_HTTP_METHOD); |
111 return false; | 111 return false; |
112 } | 112 } |
113 | 113 |
114 return true; | 114 return true; |
115 } | 115 } |
116 | 116 |
117 void ChromeResourceDispatcherHostDelegate::RequestBeginning( | 117 void ChromeResourceDispatcherHostDelegate::RequestBeginning( |
118 net::URLRequest* request, | 118 net::URLRequest* request, |
119 content::ResourceContext* resource_context, | 119 content::ResourceContext* resource_context, |
| 120 appcache::AppCacheService* appcache_service, |
120 ResourceType::Type resource_type, | 121 ResourceType::Type resource_type, |
121 int child_id, | 122 int child_id, |
122 int route_id, | 123 int route_id, |
123 bool is_continuation_of_transferred_request, | 124 bool is_continuation_of_transferred_request, |
124 ScopedVector<content::ResourceThrottle>* throttles) { | 125 ScopedVector<content::ResourceThrottle>* throttles) { |
125 if (is_continuation_of_transferred_request) | 126 if (is_continuation_of_transferred_request) |
126 ChromeURLRequestUserData::Delete(request); | 127 ChromeURLRequestUserData::Delete(request); |
127 | 128 |
128 ChromeURLRequestUserData* user_data = | 129 ChromeURLRequestUserData* user_data = |
129 ChromeURLRequestUserData::Create(request); | 130 ChromeURLRequestUserData::Create(request); |
130 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { | 131 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { |
131 user_data->set_is_prerender(true); | 132 user_data->set_is_prerender(true); |
132 request->set_priority(net::IDLE); | 133 request->set_priority(net::IDLE); |
133 } | 134 } |
134 | 135 |
135 #if defined(OS_CHROMEOS) | 136 #if defined(OS_CHROMEOS) |
136 if (resource_type == ResourceType::MAIN_FRAME) { | 137 if (resource_type == ResourceType::MAIN_FRAME) { |
137 // We check offline first, then check safe browsing so that we still can | 138 // We check offline first, then check safe browsing so that we still can |
138 // block unsafe site after we remove offline page. | 139 // block unsafe site after we remove offline page. |
139 throttles->push_back(new OfflineResourceThrottle( | 140 throttles->push_back(new OfflineResourceThrottle( |
140 child_id, route_id, request, resource_context)); | 141 child_id, route_id, request, appcache_service)); |
141 } | 142 } |
142 #endif | 143 #endif |
143 | 144 |
144 AppendChromeMetricsHeaders(request, resource_context, resource_type); | 145 AppendChromeMetricsHeaders(request, resource_context, resource_type); |
145 | 146 |
146 AppendStandardResourceThrottles(request, | 147 AppendStandardResourceThrottles(request, |
147 resource_context, | 148 resource_context, |
148 child_id, | 149 child_id, |
149 route_id, | 150 route_id, |
150 resource_type, | 151 resource_type, |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 if (base::Base64Encode(serialized, &hashed)) { | 444 if (base::Base64Encode(serialized, &hashed)) { |
444 // If successful, swap the header value with the new one. | 445 // If successful, swap the header value with the new one. |
445 // Note that the list of IDs and the header could be temporarily out of sync | 446 // Note that the list of IDs and the header could be temporarily out of sync |
446 // if IDs are added as the header is recreated. The receiving servers are OK | 447 // if IDs are added as the header is recreated. The receiving servers are OK |
447 // with such descrepancies. | 448 // with such descrepancies. |
448 variation_ids_header_ = hashed; | 449 variation_ids_header_ = hashed; |
449 } else { | 450 } else { |
450 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; | 451 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; |
451 } | 452 } |
452 } | 453 } |
OLD | NEW |