| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/ssl/ssl_manager.h" | 5 #include "chrome/browser/ssl/ssl_manager.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/load_from_memory_cache_details.h" | 10 #include "chrome/browser/load_from_memory_cache_details.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 457 |
| 458 // A certificate error occurred. Construct a CertError object and hand it | 458 // A certificate error occurred. Construct a CertError object and hand it |
| 459 // over to the UI thread for processing. | 459 // over to the UI thread for processing. |
| 460 ui_loop->PostTask(FROM_HERE, | 460 ui_loop->PostTask(FROM_HERE, |
| 461 NewRunnableMethod(new CertError(rdh, request, info->resource_type, | 461 NewRunnableMethod(new CertError(rdh, request, info->resource_type, |
| 462 cert_error, cert, ui_loop), | 462 cert_error, cert, ui_loop), |
| 463 &CertError::Dispatch)); | 463 &CertError::Dispatch)); |
| 464 } | 464 } |
| 465 | 465 |
| 466 // static | 466 // static |
| 467 void SSLManager::OnMixedContentRequest(ResourceDispatcherHost* rdh, | 467 bool SSLManager::ShouldStartRequest(ResourceDispatcherHost* rdh, |
| 468 URLRequest* request, | 468 URLRequest* request, |
| 469 MessageLoop* ui_loop) { | 469 MessageLoop* ui_loop) { |
| 470 ResourceDispatcherHost::ExtraRequestInfo* info = |
| 471 ResourceDispatcherHost::ExtraInfoForRequest(request); |
| 472 DCHECK(info); |
| 473 |
| 474 // We cheat here and talk to the SSLPolicy on the IO thread because we need |
| 475 // to respond synchronously to avoid delaying all network requests... |
| 476 if (!SSLPolicy::IsMixedContent(request->url(), |
| 477 info->resource_type, |
| 478 info->main_frame_origin)) |
| 479 return true; |
| 480 |
| 481 |
| 470 ui_loop->PostTask(FROM_HERE, | 482 ui_loop->PostTask(FROM_HERE, |
| 471 NewRunnableMethod(new MixedContentHandler(rdh, request, ui_loop), | 483 NewRunnableMethod(new MixedContentHandler(rdh, request, ui_loop), |
| 472 &MixedContentHandler::Dispatch)); | 484 &MixedContentHandler::Dispatch)); |
| 485 return false; |
| 473 } | 486 } |
| 474 | 487 |
| 475 void SSLManager::OnCertError(CertError* error) { | 488 void SSLManager::OnCertError(CertError* error) { |
| 476 // Ask our delegate to deal with the error. | 489 // Ask our delegate to deal with the error. |
| 477 NavigationEntry* entry = controller_->GetActiveEntry(); | 490 NavigationEntry* entry = controller_->GetActiveEntry(); |
| 478 // We might not have a navigation entry in some cases (e.g. when a | 491 // We might not have a navigation entry in some cases (e.g. when a |
| 479 // HTTPS page opens a popup with no URL and then populate it with | 492 // HTTPS page opens a popup with no URL and then populate it with |
| 480 // document.write()). See bug http://crbug.com/3845. | 493 // document.write()). See bug http://crbug.com/3845. |
| 481 if (!entry) | 494 if (!entry) |
| 482 return; | 495 return; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 } | 736 } |
| 724 | 737 |
| 725 if (ca_name) { | 738 if (ca_name) { |
| 726 // TODO(wtc): should we show the root CA's name instead? | 739 // TODO(wtc): should we show the root CA's name instead? |
| 727 *ca_name = l10n_util::GetStringF( | 740 *ca_name = l10n_util::GetStringF( |
| 728 IDS_SECURE_CONNECTION_EV_CA, | 741 IDS_SECURE_CONNECTION_EV_CA, |
| 729 UTF8ToWide(cert.issuer().organization_names[0])); | 742 UTF8ToWide(cert.issuer().organization_names[0])); |
| 730 } | 743 } |
| 731 return true; | 744 return true; |
| 732 } | 745 } |
| OLD | NEW |