| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Check to see whether the security state should be downgraded to reflect | 151 // Check to see whether the security state should be downgraded to reflect |
| 152 // a Safe Browsing verdict. | 152 // a Safe Browsing verdict. |
| 153 void CheckSafeBrowsingStatus(content::NavigationEntry* entry, | 153 void CheckSafeBrowsingStatus(content::NavigationEntry* entry, |
| 154 content::WebContents* web_contents, | 154 content::WebContents* web_contents, |
| 155 SecurityStateModel::VisibleSecurityState* state) { | 155 SecurityStateModel::VisibleSecurityState* state) { |
| 156 safe_browsing::SafeBrowsingService* sb_service = | 156 safe_browsing::SafeBrowsingService* sb_service = |
| 157 g_browser_process->safe_browsing_service(); | 157 g_browser_process->safe_browsing_service(); |
| 158 if (!sb_service) | 158 if (!sb_service) |
| 159 return; | 159 return; |
| 160 scoped_refptr<SafeBrowsingUIManager> sb_ui_manager = sb_service->ui_manager(); | 160 scoped_refptr<SafeBrowsingUIManager> sb_ui_manager = sb_service->ui_manager(); |
| 161 safe_browsing::SBThreatType threat_type; |
| 161 if (sb_ui_manager->IsUrlWhitelistedOrPendingForWebContents( | 162 if (sb_ui_manager->IsUrlWhitelistedOrPendingForWebContents( |
| 162 entry->GetURL(), false, entry, web_contents, false)) { | 163 entry->GetURL(), false, entry, web_contents, false, &threat_type)) { |
| 163 state->fails_malware_check = true; | 164 switch (threat_type) { |
| 165 case safe_browsing::SB_THREAT_TYPE_SAFE: |
| 166 break; |
| 167 case safe_browsing::SB_THREAT_TYPE_URL_PHISHING: |
| 168 case safe_browsing::SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL: |
| 169 state->malicious_content_status = security_state::SecurityStateModel:: |
| 170 MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING; |
| 171 break; |
| 172 case safe_browsing::SB_THREAT_TYPE_URL_MALWARE: |
| 173 case safe_browsing::SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL: |
| 174 state->malicious_content_status = security_state::SecurityStateModel:: |
| 175 MALICIOUS_CONTENT_STATUS_MALWARE; |
| 176 break; |
| 177 case safe_browsing::SB_THREAT_TYPE_URL_UNWANTED: |
| 178 state->malicious_content_status = security_state::SecurityStateModel:: |
| 179 MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE; |
| 180 break; |
| 181 case safe_browsing::SB_THREAT_TYPE_BINARY_MALWARE_URL: |
| 182 case safe_browsing::SB_THREAT_TYPE_EXTENSION: |
| 183 case safe_browsing::SB_THREAT_TYPE_BLACKLISTED_RESOURCE: |
| 184 case safe_browsing::SB_THREAT_TYPE_API_ABUSE: |
| 185 // These threat types are not currently associated with |
| 186 // interstitials, and thus resources with these threat types are |
| 187 // not ever whitelisted or pending whitelisting. |
| 188 NOTREACHED(); |
| 189 break; |
| 190 } |
| 164 } | 191 } |
| 165 } | 192 } |
| 166 | 193 |
| 167 } // namespace | 194 } // namespace |
| 168 | 195 |
| 169 ChromeSecurityStateModelClient::ChromeSecurityStateModelClient( | 196 ChromeSecurityStateModelClient::ChromeSecurityStateModelClient( |
| 170 content::WebContents* web_contents) | 197 content::WebContents* web_contents) |
| 171 : content::WebContentsObserver(web_contents), | 198 : content::WebContentsObserver(web_contents), |
| 172 web_contents_(web_contents), | 199 web_contents_(web_contents), |
| 173 security_state_model_(new SecurityStateModel()), | 200 security_state_model_(new SecurityStateModel()), |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS); | 468 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS); |
| 442 state->displayed_password_field_on_http = | 469 state->displayed_password_field_on_http = |
| 443 !!(ssl.content_status & | 470 !!(ssl.content_status & |
| 444 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); | 471 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
| 445 state->displayed_credit_card_field_on_http = | 472 state->displayed_credit_card_field_on_http = |
| 446 !!(ssl.content_status & | 473 !!(ssl.content_status & |
| 447 content::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP); | 474 content::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP); |
| 448 | 475 |
| 449 CheckSafeBrowsingStatus(entry, web_contents_, state); | 476 CheckSafeBrowsingStatus(entry, web_contents_, state); |
| 450 } | 477 } |
| OLD | NEW |