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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/google/google_util.h" | 22 #include "chrome/browser/google/google_util.h" |
23 #include "chrome/browser/metrics/variations/variations_http_header_provider.h" | 23 #include "chrome/browser/metrics/variations/variations_http_header_provider.h" |
24 #include "chrome/browser/prefetch/prefetch_field_trial.h" | 24 #include "chrome/browser/prefetch/prefetch_field_trial.h" |
25 #include "chrome/browser/prerender/prerender_manager.h" | 25 #include "chrome/browser/prerender/prerender_manager.h" |
26 #include "chrome/browser/prerender/prerender_pending_swap_throttle.h" | 26 #include "chrome/browser/prerender/prerender_pending_swap_throttle.h" |
27 #include "chrome/browser/prerender/prerender_resource_throttle.h" | 27 #include "chrome/browser/prerender/prerender_resource_throttle.h" |
28 #include "chrome/browser/prerender/prerender_tracker.h" | 28 #include "chrome/browser/prerender/prerender_tracker.h" |
29 #include "chrome/browser/prerender/prerender_util.h" | 29 #include "chrome/browser/prerender/prerender_util.h" |
30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/browser/profiles/profile_io_data.h" | 31 #include "chrome/browser/profiles/profile_io_data.h" |
32 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h" | |
33 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h
" | 32 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h
" |
34 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 33 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
35 #include "chrome/browser/signin/signin_header_helper.h" | 34 #include "chrome/browser/signin/signin_header_helper.h" |
36 #include "chrome/browser/ui/auto_login_prompter.h" | 35 #include "chrome/browser/ui/auto_login_prompter.h" |
37 #include "chrome/browser/ui/login/login_prompt.h" | 36 #include "chrome/browser/ui/login/login_prompt.h" |
38 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 37 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
39 #include "chrome/common/extensions/extension_constants.h" | 38 #include "chrome/common/extensions/extension_constants.h" |
40 #include "chrome/common/extensions/mime_types_handler.h" | 39 #include "chrome/common/extensions/mime_types_handler.h" |
41 #include "chrome/common/render_messages.h" | 40 #include "chrome/common/render_messages.h" |
42 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 } | 239 } |
241 | 240 |
242 void ChromeResourceDispatcherHostDelegate::RequestBeginning( | 241 void ChromeResourceDispatcherHostDelegate::RequestBeginning( |
243 net::URLRequest* request, | 242 net::URLRequest* request, |
244 content::ResourceContext* resource_context, | 243 content::ResourceContext* resource_context, |
245 appcache::AppCacheService* appcache_service, | 244 appcache::AppCacheService* appcache_service, |
246 ResourceType::Type resource_type, | 245 ResourceType::Type resource_type, |
247 int child_id, | 246 int child_id, |
248 int route_id, | 247 int route_id, |
249 ScopedVector<content::ResourceThrottle>* throttles) { | 248 ScopedVector<content::ResourceThrottle>* throttles) { |
250 ChromeURLRequestUserData* user_data = | |
251 ChromeURLRequestUserData::Create(request); | |
252 bool is_prerendering = prerender_tracker_->IsPrerenderingOnIOThread( | 249 bool is_prerendering = prerender_tracker_->IsPrerenderingOnIOThread( |
253 child_id, route_id); | 250 child_id, route_id); |
254 if (is_prerendering) { | 251 if (is_prerendering) { |
255 user_data->set_is_prerender(true); | |
256 // Requests with the IGNORE_LIMITS flag set (i.e., sync XHRs) | 252 // Requests with the IGNORE_LIMITS flag set (i.e., sync XHRs) |
257 // should remain at MAXIMUM_PRIORITY. | 253 // should remain at MAXIMUM_PRIORITY. |
258 if (request->load_flags() & net::LOAD_IGNORE_LIMITS) { | 254 if (request->load_flags() & net::LOAD_IGNORE_LIMITS) { |
259 DCHECK_EQ(request->priority(), net::MAXIMUM_PRIORITY); | 255 DCHECK_EQ(request->priority(), net::MAXIMUM_PRIORITY); |
260 } else { | 256 } else { |
261 request->SetPriority(net::IDLE); | 257 request->SetPriority(net::IDLE); |
262 } | 258 } |
263 } | 259 } |
264 | 260 |
265 ProfileIOData* io_data = ProfileIOData::FromResourceContext( | 261 ProfileIOData* io_data = ProfileIOData::FromResourceContext( |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 #endif | 610 #endif |
615 | 611 |
616 // In the Mirror world, Chrome should append a X-Chrome-Connected header to | 612 // In the Mirror world, Chrome should append a X-Chrome-Connected header to |
617 // all Gaia requests from a connected profile so Gaia could return a 204 | 613 // all Gaia requests from a connected profile so Gaia could return a 204 |
618 // response and let Chrome handle the action with native UI. The only | 614 // response and let Chrome handle the action with native UI. The only |
619 // exception is requests from gaia webview, since the native profile | 615 // exception is requests from gaia webview, since the native profile |
620 // management UI is built on top of it. | 616 // management UI is built on top of it. |
621 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, | 617 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, |
622 info->GetChildID(), info->GetRouteID()); | 618 info->GetChildID(), info->GetRouteID()); |
623 } | 619 } |
OLD | NEW |