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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 // Initialize the entry with an initial SecurityStyle if needed. | 347 // Initialize the entry with an initial SecurityStyle if needed. |
348 if (entry->GetSSL().security_style == SECURITY_STYLE_UNKNOWN) { | 348 if (entry->GetSSL().security_style == SECURITY_STYLE_UNKNOWN) { |
349 entry->GetSSL().security_style = GetSecurityStyleForResource( | 349 entry->GetSSL().security_style = GetSecurityStyleForResource( |
350 entry->GetURL(), !!entry->GetSSL().certificate, | 350 entry->GetURL(), !!entry->GetSSL().certificate, |
351 entry->GetSSL().cert_status); | 351 entry->GetSSL().cert_status); |
352 } | 352 } |
353 | 353 |
354 WebContentsImpl* web_contents_impl = | 354 WebContentsImpl* web_contents_impl = |
355 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); | 355 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); |
| 356 |
| 357 // For sensitive inputs (password, credit card) on HTTP, do not clear |
| 358 // the |content_status| flag when the WebContents no longer has the |
| 359 // flag set. This is different from how DISPLAYED_INSECURE_CONTENT and |
| 360 // DISPLAYED_CONTENT_WITH_CERT_ERRORS are handled below. For sensitive |
| 361 // inputs on HTTP, once the NavigationEntry has been marked as having |
| 362 // displayed a sensitive input, it stays that way, even if the |
| 363 // sensitive input is subsequently removed from the page. |
| 364 if (web_contents_impl->DisplayedPasswordFieldOnHttp()) { |
| 365 entry->GetSSL().content_status |= |
| 366 SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP; |
| 367 } |
| 368 |
| 369 if (web_contents_impl->DisplayedCreditCardFieldOnHttp()) { |
| 370 entry->GetSSL().content_status |= |
| 371 SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP; |
| 372 } |
| 373 |
356 if (entry->GetSSL().security_style == SECURITY_STYLE_UNAUTHENTICATED) | 374 if (entry->GetSSL().security_style == SECURITY_STYLE_UNAUTHENTICATED) |
357 return; | 375 return; |
358 | 376 |
359 // Update the entry's flags for insecure content. | 377 // Update the entry's flags for insecure content. |
360 if (!web_contents_impl->DisplayedInsecureContent()) | 378 if (!web_contents_impl->DisplayedInsecureContent()) |
361 entry->GetSSL().content_status &= ~SSLStatus::DISPLAYED_INSECURE_CONTENT; | 379 entry->GetSSL().content_status &= ~SSLStatus::DISPLAYED_INSECURE_CONTENT; |
362 if (web_contents_impl->DisplayedInsecureContent()) | 380 if (web_contents_impl->DisplayedInsecureContent()) |
363 entry->GetSSL().content_status |= SSLStatus::DISPLAYED_INSECURE_CONTENT; | 381 entry->GetSSL().content_status |= SSLStatus::DISPLAYED_INSECURE_CONTENT; |
364 if (!web_contents_impl->DisplayedContentWithCertErrors()) | 382 if (!web_contents_impl->DisplayedContentWithCertErrors()) { |
365 entry->GetSSL().content_status &= | 383 entry->GetSSL().content_status &= |
366 ~SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS; | 384 ~SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS; |
367 if (web_contents_impl->DisplayedContentWithCertErrors()) | 385 } |
| 386 if (web_contents_impl->DisplayedContentWithCertErrors()) { |
368 entry->GetSSL().content_status |= | 387 entry->GetSSL().content_status |= |
369 SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS; | 388 SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS; |
| 389 } |
370 | 390 |
371 SiteInstance* site_instance = entry->site_instance(); | 391 SiteInstance* site_instance = entry->site_instance(); |
372 // Note that |site_instance| can be NULL here because NavigationEntries don't | 392 // Note that |site_instance| can be NULL here because NavigationEntries don't |
373 // necessarily have site instances. Without a process, the entry can't | 393 // necessarily have site instances. Without a process, the entry can't |
374 // possibly have insecure content. See bug http://crbug.com/12423. | 394 // possibly have insecure content. See bug http://crbug.com/12423. |
375 if (site_instance && ssl_host_state_delegate_ && | 395 if (site_instance && ssl_host_state_delegate_ && |
376 ssl_host_state_delegate_->DidHostRunInsecureContent( | 396 ssl_host_state_delegate_->DidHostRunInsecureContent( |
377 entry->GetURL().host(), site_instance->GetProcess()->GetID(), | 397 entry->GetURL().host(), site_instance->GetProcess()->GetID(), |
378 SSLHostStateDelegate::MIXED_CONTENT)) { | 398 SSLHostStateDelegate::MIXED_CONTENT)) { |
379 entry->GetSSL().security_style = SECURITY_STYLE_AUTHENTICATION_BROKEN; | 399 entry->GetSSL().security_style = SECURITY_STYLE_AUTHENTICATION_BROKEN; |
(...skipping 12 matching lines...) Expand all Loading... |
392 NotifyDidChangeVisibleSSLState(); | 412 NotifyDidChangeVisibleSSLState(); |
393 } | 413 } |
394 | 414 |
395 void SSLManager::NotifyDidChangeVisibleSSLState() { | 415 void SSLManager::NotifyDidChangeVisibleSSLState() { |
396 WebContentsImpl* contents = | 416 WebContentsImpl* contents = |
397 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); | 417 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); |
398 contents->DidChangeVisibleSSLState(); | 418 contents->DidChangeVisibleSSLState(); |
399 } | 419 } |
400 | 420 |
401 } // namespace content | 421 } // namespace content |
OLD | NEW |