| 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/security_state_tab_helper.h" | 5 #include "chrome/browser/ssl/security_state_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 return security_state::MALICIOUS_CONTENT_STATUS_NONE; | 157 return security_state::MALICIOUS_CONTENT_STATUS_NONE; |
| 158 scoped_refptr<SafeBrowsingUIManager> sb_ui_manager = sb_service->ui_manager(); | 158 scoped_refptr<SafeBrowsingUIManager> sb_ui_manager = sb_service->ui_manager(); |
| 159 safe_browsing::SBThreatType threat_type; | 159 safe_browsing::SBThreatType threat_type; |
| 160 if (sb_ui_manager->IsUrlWhitelistedOrPendingForWebContents( | 160 if (sb_ui_manager->IsUrlWhitelistedOrPendingForWebContents( |
| 161 entry->GetURL(), false, entry, web_contents(), false, &threat_type)) { | 161 entry->GetURL(), false, entry, web_contents(), false, &threat_type)) { |
| 162 switch (threat_type) { | 162 switch (threat_type) { |
| 163 case safe_browsing::SB_THREAT_TYPE_UNUSED: | 163 case safe_browsing::SB_THREAT_TYPE_UNUSED: |
| 164 case safe_browsing::SB_THREAT_TYPE_SAFE: | 164 case safe_browsing::SB_THREAT_TYPE_SAFE: |
| 165 break; | 165 break; |
| 166 case safe_browsing::SB_THREAT_TYPE_URL_PHISHING: | 166 case safe_browsing::SB_THREAT_TYPE_URL_PHISHING: |
| 167 case safe_browsing::SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL: | 167 case safe_browsing::SB_THREAT_TYPE_URL_CLIENT_SIDE_PHISHING: |
| 168 case safe_browsing::SB_THREAT_TYPE_PASSWORD_PROTECTION_PHISHING_URL: | 168 case safe_browsing::SB_THREAT_TYPE_URL_PASSWORD_PROTECTION_PHISHING: |
| 169 return security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING; | 169 return security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING; |
| 170 break; | 170 break; |
| 171 case safe_browsing::SB_THREAT_TYPE_URL_MALWARE: | 171 case safe_browsing::SB_THREAT_TYPE_URL_MALWARE: |
| 172 case safe_browsing::SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL: | 172 case safe_browsing::SB_THREAT_TYPE_URL_CLIENT_SIDE_MALWARE: |
| 173 return security_state::MALICIOUS_CONTENT_STATUS_MALWARE; | 173 return security_state::MALICIOUS_CONTENT_STATUS_MALWARE; |
| 174 break; | 174 break; |
| 175 case safe_browsing::SB_THREAT_TYPE_URL_UNWANTED: | 175 case safe_browsing::SB_THREAT_TYPE_URL_UNWANTED: |
| 176 return security_state::MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE; | 176 return security_state::MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE; |
| 177 break; | 177 break; |
| 178 case safe_browsing::SB_THREAT_TYPE_BINARY_MALWARE_URL: | 178 case safe_browsing::SB_THREAT_TYPE_URL_BINARY_MALWARE: |
| 179 case safe_browsing::SB_THREAT_TYPE_EXTENSION: | 179 case safe_browsing::SB_THREAT_TYPE_EXTENSION: |
| 180 case safe_browsing::SB_THREAT_TYPE_BLACKLISTED_RESOURCE: | 180 case safe_browsing::SB_THREAT_TYPE_BLACKLISTED_RESOURCE: |
| 181 case safe_browsing::SB_THREAT_TYPE_API_ABUSE: | 181 case safe_browsing::SB_THREAT_TYPE_API_ABUSE: |
| 182 case safe_browsing::SB_THREAT_TYPE_SUBRESOURCE_FILTER: | 182 case safe_browsing::SB_THREAT_TYPE_SUBRESOURCE_FILTER: |
| 183 case safe_browsing::SB_THREAT_TYPE_CSD_WHITELIST: | 183 case safe_browsing::SB_THREAT_TYPE_CSD_WHITELIST: |
| 184 // These threat types are not currently associated with | 184 // These threat types are not currently associated with |
| 185 // interstitials, and thus resources with these threat types are | 185 // interstitials, and thus resources with these threat types are |
| 186 // not ever whitelisted or pending whitelisting. | 186 // not ever whitelisted or pending whitelisting. |
| 187 NOTREACHED(); | 187 NOTREACHED(); |
| 188 break; | 188 break; |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 return security_state::MALICIOUS_CONTENT_STATUS_NONE; | 191 return security_state::MALICIOUS_CONTENT_STATUS_NONE; |
| 192 } | 192 } |
| 193 | 193 |
| 194 std::unique_ptr<security_state::VisibleSecurityState> | 194 std::unique_ptr<security_state::VisibleSecurityState> |
| 195 SecurityStateTabHelper::GetVisibleSecurityState() const { | 195 SecurityStateTabHelper::GetVisibleSecurityState() const { |
| 196 auto state = security_state::GetVisibleSecurityState(web_contents()); | 196 auto state = security_state::GetVisibleSecurityState(web_contents()); |
| 197 | 197 |
| 198 // Malware status might already be known even if connection security | 198 // Malware status might already be known even if connection security |
| 199 // information is still being initialized, thus no need to check for that. | 199 // information is still being initialized, thus no need to check for that. |
| 200 state->malicious_content_status = GetMaliciousContentStatus(); | 200 state->malicious_content_status = GetMaliciousContentStatus(); |
| 201 | 201 |
| 202 return state; | 202 return state; |
| 203 } | 203 } |
| OLD | NEW |