Chromium Code Reviews| 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_BINARY_MALWARE_URL: | |
| 174 case safe_browsing::SB_THREAT_TYPE_EXTENSION: | |
|
Nathan Parker
2016/11/10 00:13:03
nit: I think _EXTENSION and _BINARY_MALWARE_URL wo
estark
2016/11/11 20:28:13
Done.
| |
| 175 case safe_browsing::SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL: | |
| 176 state->malicious_content_status = security_state::SecurityStateModel:: | |
| 177 MALICIOUS_CONTENT_STATUS_MALWARE; | |
| 178 break; | |
| 179 case safe_browsing::SB_THREAT_TYPE_URL_UNWANTED: | |
| 180 state->malicious_content_status = security_state::SecurityStateModel:: | |
| 181 MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE; | |
| 182 break; | |
| 183 case safe_browsing::SB_THREAT_TYPE_BLACKLISTED_RESOURCE: | |
|
Nathan Parker
2016/11/10 00:13:03
Maybe add a comment that these are not associated
estark
2016/11/11 20:28:14
Done.
| |
| 184 case safe_browsing::SB_THREAT_TYPE_API_ABUSE: | |
| 185 NOTREACHED(); | |
| 186 break; | |
| 187 } | |
| 164 } | 188 } |
| 165 } | 189 } |
| 166 | 190 |
| 167 } // namespace | 191 } // namespace |
| 168 | 192 |
| 169 ChromeSecurityStateModelClient::ChromeSecurityStateModelClient( | 193 ChromeSecurityStateModelClient::ChromeSecurityStateModelClient( |
| 170 content::WebContents* web_contents) | 194 content::WebContents* web_contents) |
| 171 : content::WebContentsObserver(web_contents), | 195 : content::WebContentsObserver(web_contents), |
| 172 web_contents_(web_contents), | 196 web_contents_(web_contents), |
| 173 security_state_model_(new SecurityStateModel()), | 197 security_state_model_(new SecurityStateModel()), |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 429 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS); | 453 !!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS); |
| 430 state->displayed_password_field_on_http = | 454 state->displayed_password_field_on_http = |
| 431 !!(ssl.content_status & | 455 !!(ssl.content_status & |
| 432 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); | 456 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
| 433 state->displayed_credit_card_field_on_http = | 457 state->displayed_credit_card_field_on_http = |
| 434 !!(ssl.content_status & | 458 !!(ssl.content_status & |
| 435 content::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP); | 459 content::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP); |
| 436 | 460 |
| 437 CheckSafeBrowsingStatus(entry, web_contents_, state); | 461 CheckSafeBrowsingStatus(entry, web_contents_, state); |
| 438 } | 462 } |
| OLD | NEW |