| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chrome_security_state_model_client.h" | 5 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 6 | 6 |
| 7 #include <openssl/ssl.h> | 7 #include <openssl/ssl.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 SecurityStateModel::SecurityLevel GetSecurityLevelForSecurityStyle( | 48 SecurityStateModel::SecurityLevel GetSecurityLevelForSecurityStyle( |
| 49 content::SecurityStyle style) { | 49 content::SecurityStyle style) { |
| 50 switch (style) { | 50 switch (style) { |
| 51 case content::SECURITY_STYLE_UNKNOWN: | 51 case content::SECURITY_STYLE_UNKNOWN: |
| 52 NOTREACHED(); | 52 NOTREACHED(); |
| 53 return SecurityStateModel::NONE; | 53 return SecurityStateModel::NONE; |
| 54 case content::SECURITY_STYLE_UNAUTHENTICATED: | 54 case content::SECURITY_STYLE_UNAUTHENTICATED: |
| 55 return SecurityStateModel::NONE; | 55 return SecurityStateModel::NONE; |
| 56 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN: | 56 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN: |
| 57 return SecurityStateModel::SECURITY_ERROR; | 57 return SecurityStateModel::SECURITY_ERROR; |
| 58 case content::SECURITY_STYLE_WARNING: | |
| 59 // content currently doesn't use this style. | |
| 60 NOTREACHED(); | |
| 61 return SecurityStateModel::SECURITY_WARNING; | |
| 62 case content::SECURITY_STYLE_AUTHENTICATED: | 58 case content::SECURITY_STYLE_AUTHENTICATED: |
| 63 return SecurityStateModel::SECURE; | 59 return SecurityStateModel::SECURE; |
| 64 } | 60 } |
| 65 return SecurityStateModel::NONE; | 61 return SecurityStateModel::NONE; |
| 66 } | 62 } |
| 67 | 63 |
| 68 // Note: This is a lossy operation. Not all of the policies that can be | 64 // Note: This is a lossy operation. Not all of the policies that can be |
| 69 // expressed by a SecurityLevel (a //chrome concept) can be expressed by | 65 // expressed by a SecurityLevel (a //chrome concept) can be expressed by |
| 70 // a content::SecurityStyle. | 66 // a content::SecurityStyle. |
| 71 content::SecurityStyle SecurityLevelToSecurityStyle( | 67 content::SecurityStyle SecurityLevelToSecurityStyle( |
| 72 SecurityStateModel::SecurityLevel security_level) { | 68 SecurityStateModel::SecurityLevel security_level) { |
| 73 switch (security_level) { | 69 switch (security_level) { |
| 74 case SecurityStateModel::NONE: | 70 case SecurityStateModel::NONE: |
| 71 case SecurityStateModel::SECURITY_POLICY_WARNING: |
| 75 return content::SECURITY_STYLE_UNAUTHENTICATED; | 72 return content::SECURITY_STYLE_UNAUTHENTICATED; |
| 76 case SecurityStateModel::SECURITY_WARNING: | |
| 77 case SecurityStateModel::SECURITY_POLICY_WARNING: | |
| 78 return content::SECURITY_STYLE_WARNING; | |
| 79 case SecurityStateModel::EV_SECURE: | 73 case SecurityStateModel::EV_SECURE: |
| 80 case SecurityStateModel::SECURE: | 74 case SecurityStateModel::SECURE: |
| 81 return content::SECURITY_STYLE_AUTHENTICATED; | 75 return content::SECURITY_STYLE_AUTHENTICATED; |
| 82 case SecurityStateModel::SECURITY_ERROR: | 76 case SecurityStateModel::SECURITY_ERROR: |
| 83 return content::SECURITY_STYLE_AUTHENTICATION_BROKEN; | 77 return content::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
| 84 } | 78 } |
| 85 | 79 |
| 86 NOTREACHED(); | 80 NOTREACHED(); |
| 87 return content::SECURITY_STYLE_UNKNOWN; | 81 return content::SECURITY_STYLE_UNKNOWN; |
| 88 } | 82 } |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 state->ran_mixed_content = | 380 state->ran_mixed_content = |
| 387 !!(ssl.content_status & content::SSLStatus::RAN_INSECURE_CONTENT); | 381 !!(ssl.content_status & content::SSLStatus::RAN_INSECURE_CONTENT); |
| 388 state->displayed_content_with_cert_errors = | 382 state->displayed_content_with_cert_errors = |
| 389 !!(ssl.content_status & | 383 !!(ssl.content_status & |
| 390 content::SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS); | 384 content::SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS); |
| 391 state->ran_content_with_cert_errors = | 385 state->ran_content_with_cert_errors = |
| 392 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS); | 386 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS); |
| 393 | 387 |
| 394 CheckSafeBrowsingStatus(entry, web_contents_, state); | 388 CheckSafeBrowsingStatus(entry, web_contents_, state); |
| 395 } | 389 } |
| OLD | NEW |