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 // Implementation of the SafeBrowsingBlockingPage class. | 5 // Implementation of the SafeBrowsingBlockingPage class. |
6 | 6 |
7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 bool malware = false; | 166 bool malware = false; |
167 bool harmful = false; | 167 bool harmful = false; |
168 bool phishing = false; | 168 bool phishing = false; |
169 for (UnsafeResourceList::const_iterator iter = unsafe_resources_.begin(); | 169 for (UnsafeResourceList::const_iterator iter = unsafe_resources_.begin(); |
170 iter != unsafe_resources_.end(); ++iter) { | 170 iter != unsafe_resources_.end(); ++iter) { |
171 const UnsafeResource& resource = *iter; | 171 const UnsafeResource& resource = *iter; |
172 SBThreatType threat_type = resource.threat_type; | 172 SBThreatType threat_type = resource.threat_type; |
173 if (threat_type == SB_THREAT_TYPE_URL_MALWARE || | 173 if (threat_type == SB_THREAT_TYPE_URL_MALWARE || |
174 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL) { | 174 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL) { |
175 malware = true; | 175 malware = true; |
176 } else if (threat_type == SB_THREAT_TYPE_URL_HARMFUL) { | 176 } else if (threat_type == SB_THREAT_TYPE_URL_UNWANTED) { |
177 harmful = true; | 177 harmful = true; |
178 } else { | 178 } else { |
179 DCHECK(threat_type == SB_THREAT_TYPE_URL_PHISHING || | 179 DCHECK(threat_type == SB_THREAT_TYPE_URL_PHISHING || |
180 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL); | 180 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL); |
181 phishing = true; | 181 phishing = true; |
182 } | 182 } |
183 } | 183 } |
184 DCHECK(phishing || malware || harmful); | 184 DCHECK(phishing || malware || harmful); |
185 if (malware) | 185 if (malware) |
186 interstitial_type_ = TYPE_MALWARE; | 186 interstitial_type_ = TYPE_MALWARE; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 if (command == kShowDiagnosticCommand) { | 371 if (command == kShowDiagnosticCommand) { |
372 // We're going to take the user to Google's SafeBrowsing diagnostic page. | 372 // We're going to take the user to Google's SafeBrowsing diagnostic page. |
373 RecordUserInteraction(SHOW_DIAGNOSTIC); | 373 RecordUserInteraction(SHOW_DIAGNOSTIC); |
374 std::string diagnostic = | 374 std::string diagnostic = |
375 base::StringPrintf(kSbDiagnosticUrl, | 375 base::StringPrintf(kSbDiagnosticUrl, |
376 net::EscapeQueryParamValue(bad_url_spec, true).c_str()); | 376 net::EscapeQueryParamValue(bad_url_spec, true).c_str()); |
377 GURL diagnostic_url(diagnostic); | 377 GURL diagnostic_url(diagnostic); |
378 diagnostic_url = google_util::AppendGoogleLocaleParam( | 378 diagnostic_url = google_util::AppendGoogleLocaleParam( |
379 diagnostic_url, g_browser_process->GetApplicationLocale()); | 379 diagnostic_url, g_browser_process->GetApplicationLocale()); |
380 DCHECK(unsafe_resources_[element_index].threat_type == | 380 DCHECK(unsafe_resources_[element_index].threat_type == |
381 SB_THREAT_TYPE_URL_MALWARE || | 381 SB_THREAT_TYPE_URL_MALWARE || |
382 unsafe_resources_[element_index].threat_type == | 382 unsafe_resources_[element_index].threat_type == |
383 SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL); | 383 SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL || |
| 384 unsafe_resources_[element_index].threat_type == |
| 385 SB_THREAT_TYPE_URL_UNWANTED); |
384 OpenURLParams params( | 386 OpenURLParams params( |
385 diagnostic_url, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_LINK, | 387 diagnostic_url, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_LINK, |
386 false); | 388 false); |
387 web_contents_->OpenURL(params); | 389 web_contents_->OpenURL(params); |
388 return; | 390 return; |
389 } | 391 } |
390 | 392 |
391 if (command == kExpandedSeeMoreCommand) { | 393 if (command == kExpandedSeeMoreCommand) { |
392 RecordUserInteraction(SHOW_ADVANCED); | 394 RecordUserInteraction(SHOW_ADVANCED); |
393 return; | 395 return; |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 IDS_PHISHING_V3_PRIMARY_PARAGRAPH, | 815 IDS_PHISHING_V3_PRIMARY_PARAGRAPH, |
814 base::UTF8ToUTF16(url_.host()))); | 816 base::UTF8ToUTF16(url_.host()))); |
815 load_time_data->SetString( | 817 load_time_data->SetString( |
816 "explanationParagraph", | 818 "explanationParagraph", |
817 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH, | 819 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH, |
818 base::UTF8ToUTF16(url_.host()))); | 820 base::UTF8ToUTF16(url_.host()))); |
819 load_time_data->SetString( | 821 load_time_data->SetString( |
820 "finalParagraph", | 822 "finalParagraph", |
821 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); | 823 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); |
822 } | 824 } |
OLD | NEW |