Chromium Code Reviews| 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 "content/browser/ssl/ssl_manager.h" | 5 #include "content/browser/ssl/ssl_manager.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 if (!entry) | 364 if (!entry) |
| 365 return; | 365 return; |
| 366 | 366 |
| 367 SSLStatus original_ssl_status = entry->GetSSL(); // Copy! | 367 SSLStatus original_ssl_status = entry->GetSSL(); // Copy! |
| 368 entry->GetSSL().initialized = true; | 368 entry->GetSSL().initialized = true; |
| 369 entry->GetSSL().content_status |= additional_content_status_flags; | 369 entry->GetSSL().content_status |= additional_content_status_flags; |
| 370 | 370 |
| 371 SiteInstance* site_instance = entry->site_instance(); | 371 SiteInstance* site_instance = entry->site_instance(); |
| 372 // Note that |site_instance| can be NULL here because NavigationEntries don't | 372 // Note that |site_instance| can be NULL here because NavigationEntries don't |
| 373 // necessarily have site instances. Without a process, the entry can't | 373 // necessarily have site instances. Without a process, the entry can't |
| 374 // possibly have insecure content. See bug http://crbug.com/12423. | 374 // possibly have insecure content. See bug https://crbug.com/12423. |
|
nasko
2016/10/12 23:45:53
Nice!
| |
| 375 if (site_instance && ssl_host_state_delegate_ && | 375 if (site_instance && ssl_host_state_delegate_) { |
| 376 ssl_host_state_delegate_->DidHostRunInsecureContent( | 376 std::string host = entry->GetURL().host(); |
| 377 entry->GetURL().host(), site_instance->GetProcess()->GetID(), | 377 int process_id = site_instance->GetProcess()->GetID(); |
| 378 SSLHostStateDelegate::MIXED_CONTENT)) { | 378 if (ssl_host_state_delegate_->DidHostRunInsecureContent( |
| 379 entry->GetSSL().content_status |= SSLStatus::RAN_INSECURE_CONTENT; | 379 host, process_id, SSLHostStateDelegate::MIXED_CONTENT)) { |
| 380 } | 380 entry->GetSSL().content_status |= SSLStatus::RAN_INSECURE_CONTENT; |
| 381 } | |
| 381 | 382 |
| 382 // Only record information about subresources with cert errors if the | 383 // Only record information about subresources with cert errors if the |
| 383 // main page is HTTPS with a certificate. | 384 // main page is HTTPS with a certificate. |
| 384 if (entry->GetURL().SchemeIsCryptographic() && entry->GetSSL().certificate && | 385 if (entry->GetURL().SchemeIsCryptographic() && |
| 385 site_instance && ssl_host_state_delegate_ && | 386 entry->GetSSL().certificate && |
| 386 ssl_host_state_delegate_->DidHostRunInsecureContent( | 387 ssl_host_state_delegate_->DidHostRunInsecureContent( |
| 387 entry->GetURL().host(), site_instance->GetProcess()->GetID(), | 388 host, process_id, SSLHostStateDelegate::CERT_ERRORS_CONTENT)) { |
| 388 SSLHostStateDelegate::CERT_ERRORS_CONTENT)) { | 389 entry->GetSSL().content_status |= SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS; |
| 389 entry->GetSSL().content_status |= SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS; | 390 } |
| 390 } | 391 } |
| 391 | 392 |
| 392 if (!entry->GetSSL().Equals(original_ssl_status)) | 393 if (!entry->GetSSL().Equals(original_ssl_status)) |
| 393 NotifyDidChangeVisibleSSLState(); | 394 NotifyDidChangeVisibleSSLState(); |
| 394 } | 395 } |
| 395 | 396 |
| 396 void SSLManager::UpdateLastCommittedEntry(int additional_content_status_flags) { | 397 void SSLManager::UpdateLastCommittedEntry(int additional_content_status_flags) { |
| 397 NavigationEntryImpl* entry = controller_->GetLastCommittedEntry(); | 398 NavigationEntryImpl* entry = controller_->GetLastCommittedEntry(); |
| 398 if (!entry) | 399 if (!entry) |
| 399 return; | 400 return; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 411 SSLManagerSet* managers = | 412 SSLManagerSet* managers = |
| 412 static_cast<SSLManagerSet*>(context->GetUserData(kSSLManagerKeyName)); | 413 static_cast<SSLManagerSet*>(context->GetUserData(kSSLManagerKeyName)); |
| 413 | 414 |
| 414 for (std::set<SSLManager*>::iterator i = managers->get().begin(); | 415 for (std::set<SSLManager*>::iterator i = managers->get().begin(); |
| 415 i != managers->get().end(); ++i) { | 416 i != managers->get().end(); ++i) { |
| 416 (*i)->UpdateEntry((*i)->controller()->GetLastCommittedEntry(), 0); | 417 (*i)->UpdateEntry((*i)->controller()->GetLastCommittedEntry(), 0); |
| 417 } | 418 } |
| 418 } | 419 } |
| 419 | 420 |
| 420 } // namespace content | 421 } // namespace content |
| OLD | NEW |