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" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/content_settings/host_content_settings_map.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map.h" |
13 #include "chrome/browser/download/download_request_limiter.h" | 13 #include "chrome/browser/download/download_request_limiter.h" |
14 #include "chrome/browser/download/download_resource_throttle.h" | 14 #include "chrome/browser/download/download_resource_throttle.h" |
15 #include "chrome/browser/download/download_util.h" | 15 #include "chrome/browser/download/download_util.h" |
16 #include "chrome/browser/extensions/user_script_listener.h" | 16 #include "chrome/browser/extensions/user_script_listener.h" |
17 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 17 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
18 #include "chrome/browser/google/google_util.h" | 18 #include "chrome/browser/google/google_util.h" |
19 #include "chrome/browser/instant/instant_loader.h" | |
20 #include "chrome/browser/net/load_timing_observer.h" | 19 #include "chrome/browser/net/load_timing_observer.h" |
21 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" | 20 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
22 #include "chrome/browser/prerender/prerender_manager.h" | 21 #include "chrome/browser/prerender/prerender_manager.h" |
23 #include "chrome/browser/prerender/prerender_tracker.h" | 22 #include "chrome/browser/prerender/prerender_tracker.h" |
24 #include "chrome/browser/profiles/profile_io_data.h" | 23 #include "chrome/browser/profiles/profile_io_data.h" |
25 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h" | 24 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h" |
26 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" | 25 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" |
27 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 26 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
28 #include "chrome/browser/ui/auto_login_prompter.h" | 27 #include "chrome/browser/ui/auto_login_prompter.h" |
29 #include "chrome/browser/ui/login/login_prompt.h" | 28 #include "chrome/browser/ui/login/login_prompt.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 child_id, route_id, prerender::FINAL_STATUS_AUTH_NEEDED)) { | 226 child_id, route_id, prerender::FINAL_STATUS_AUTH_NEEDED)) { |
228 return true; | 227 return true; |
229 } | 228 } |
230 | 229 |
231 return false; | 230 return false; |
232 } | 231 } |
233 | 232 |
234 ResourceDispatcherHostLoginDelegate* | 233 ResourceDispatcherHostLoginDelegate* |
235 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( | 234 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( |
236 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { | 235 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { |
237 std::string instant_header_value; | |
238 // For instant, return a NULL delegate. Auth navigations don't commit the load | |
239 // (the load remains pending) until the user cancels or succeeds in | |
240 // authorizing. Since we don't allow merging of WebContents with pending loads | |
241 // we disallow auth dialogs from showing during instant. Returning NULL does | |
242 // that. | |
243 // TODO: see if we can handle this case more robustly. | |
244 if (request->extra_request_headers().GetHeader( | |
245 InstantLoader::kInstantHeader, &instant_header_value) && | |
246 instant_header_value == InstantLoader::kInstantHeaderValue) | |
247 return NULL; | |
248 return CreateLoginPrompt(auth_info, request); | 236 return CreateLoginPrompt(auth_info, request); |
249 } | 237 } |
250 | 238 |
251 void ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( | 239 void ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( |
252 const GURL& url, int child_id, int route_id) { | 240 const GURL& url, int child_id, int route_id) { |
253 BrowserThread::PostTask( | 241 BrowserThread::PostTask( |
254 BrowserThread::UI, FROM_HERE, | 242 BrowserThread::UI, FROM_HERE, |
255 base::Bind(&ExternalProtocolHandler::LaunchUrl, url, child_id, route_id)); | 243 base::Bind(&ExternalProtocolHandler::LaunchUrl, url, child_id, route_id)); |
256 } | 244 } |
257 | 245 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 if (base::Base64Encode(serialized, &hashed)) { | 421 if (base::Base64Encode(serialized, &hashed)) { |
434 // If successful, swap the header value with the new one. | 422 // If successful, swap the header value with the new one. |
435 // Note that the list of IDs and the header could be temporarily out of sync | 423 // Note that the list of IDs and the header could be temporarily out of sync |
436 // if IDs are added as we are recreating the header, but we're OK with those | 424 // if IDs are added as we are recreating the header, but we're OK with those |
437 // descrepancies. | 425 // descrepancies. |
438 variation_ids_header_ = hashed; | 426 variation_ids_header_ = hashed; |
439 } else { | 427 } else { |
440 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; | 428 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; |
441 } | 429 } |
442 } | 430 } |
OLD | NEW |