| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 child_id, route_id, prerender::FINAL_STATUS_AUTH_NEEDED)) { | 227 child_id, route_id, prerender::FINAL_STATUS_AUTH_NEEDED)) { |
| 228 return true; | 228 return true; |
| 229 } | 229 } |
| 230 | 230 |
| 231 return false; | 231 return false; |
| 232 } | 232 } |
| 233 | 233 |
| 234 ResourceDispatcherHostLoginDelegate* | 234 ResourceDispatcherHostLoginDelegate* |
| 235 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( | 235 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( |
| 236 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { | 236 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); | 237 return CreateLoginPrompt(auth_info, request); |
| 249 } | 238 } |
| 250 | 239 |
| 251 void ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( | 240 void ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( |
| 252 const GURL& url, int child_id, int route_id) { | 241 const GURL& url, int child_id, int route_id) { |
| 253 BrowserThread::PostTask( | 242 BrowserThread::PostTask( |
| 254 BrowserThread::UI, FROM_HERE, | 243 BrowserThread::UI, FROM_HERE, |
| 255 base::Bind(&ExternalProtocolHandler::LaunchUrl, url, child_id, route_id)); | 244 base::Bind(&ExternalProtocolHandler::LaunchUrl, url, child_id, route_id)); |
| 256 } | 245 } |
| 257 | 246 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 if (base::Base64Encode(serialized, &hashed)) { | 422 if (base::Base64Encode(serialized, &hashed)) { |
| 434 // If successful, swap the header value with the new one. | 423 // 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 | 424 // 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 | 425 // if IDs are added as we are recreating the header, but we're OK with those |
| 437 // descrepancies. | 426 // descrepancies. |
| 438 variation_ids_header_ = hashed; | 427 variation_ids_header_ = hashed; |
| 439 } else { | 428 } else { |
| 440 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; | 429 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; |
| 441 } | 430 } |
| 442 } | 431 } |
| OLD | NEW |