| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/app/locales/locale_settings.h" | 9 #include "chrome/app/locales/locale_settings.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if (command == "2") { | 143 if (command == "2") { |
| 144 // User pressed "Learn more". | 144 // User pressed "Learn more". |
| 145 GURL url; | 145 GURL url; |
| 146 if (result_ == SafeBrowsingService::URL_MALWARE) { | 146 if (result_ == SafeBrowsingService::URL_MALWARE) { |
| 147 url = GURL(l10n_util::GetString(IDS_LEARN_MORE_MALWARE_URL)); | 147 url = GURL(l10n_util::GetString(IDS_LEARN_MORE_MALWARE_URL)); |
| 148 } else if (result_ == SafeBrowsingService::URL_PHISHING) { | 148 } else if (result_ == SafeBrowsingService::URL_PHISHING) { |
| 149 url = GURL(l10n_util::GetString(IDS_LEARN_MORE_PHISHING_URL)); | 149 url = GURL(l10n_util::GetString(IDS_LEARN_MORE_PHISHING_URL)); |
| 150 } else { | 150 } else { |
| 151 NOTREACHED(); | 151 NOTREACHED(); |
| 152 } | 152 } |
| 153 web->OpenURL(url, CURRENT_TAB, PageTransition::LINK); | 153 web->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::LINK); |
| 154 return; | 154 return; |
| 155 } | 155 } |
| 156 if (command == "3") { | 156 if (command == "3") { |
| 157 // User pressed "Report error" for a phishing site. | 157 // User pressed "Report error" for a phishing site. |
| 158 // Note that we cannot just put a link in the interstitial at this point. | 158 // Note that we cannot just put a link in the interstitial at this point. |
| 159 // It is not OK to navigate in the context of an interstitial page. | 159 // It is not OK to navigate in the context of an interstitial page. |
| 160 DCHECK(result_ == SafeBrowsingService::URL_PHISHING); | 160 DCHECK(result_ == SafeBrowsingService::URL_PHISHING); |
| 161 GURL report_url = | 161 GURL report_url = |
| 162 safe_browsing_util::GeneratePhishingReportUrl(kSbReportPhishingUrl, | 162 safe_browsing_util::GeneratePhishingReportUrl(kSbReportPhishingUrl, |
| 163 url().spec()); | 163 url().spec()); |
| 164 web->HideInterstitialPage(false, false); | 164 web->HideInterstitialPage(false, false); |
| 165 web->OpenURL(report_url, CURRENT_TAB, PageTransition::LINK); | 165 web->OpenURL(report_url, GURL(), CURRENT_TAB, PageTransition::LINK); |
| 166 return; | 166 return; |
| 167 } | 167 } |
| 168 if (command == "4") { | 168 if (command == "4") { |
| 169 // We're going to take the user to Google's SafeBrowsing diagnostic page. | 169 // We're going to take the user to Google's SafeBrowsing diagnostic page. |
| 170 std::string diagnostic = | 170 std::string diagnostic = |
| 171 StringPrintf(kSbDiagnosticUrl, | 171 StringPrintf(kSbDiagnosticUrl, |
| 172 EscapeQueryParamValue(url().spec()).c_str()); | 172 EscapeQueryParamValue(url().spec()).c_str()); |
| 173 GURL diagnostic_url(diagnostic); | 173 GURL diagnostic_url(diagnostic); |
| 174 diagnostic_url = google_util::AppendGoogleLocaleParam(diagnostic_url); | 174 diagnostic_url = google_util::AppendGoogleLocaleParam(diagnostic_url); |
| 175 DCHECK(result_ == SafeBrowsingService::URL_MALWARE); | 175 DCHECK(result_ == SafeBrowsingService::URL_MALWARE); |
| 176 web->HideInterstitialPage(false, false); | 176 web->HideInterstitialPage(false, false); |
| 177 web->OpenURL(diagnostic_url, CURRENT_TAB, PageTransition::LINK); | 177 web->OpenURL(diagnostic_url, GURL(), CURRENT_TAB, PageTransition::LINK); |
| 178 return; | 178 return; |
| 179 } | 179 } |
| 180 | 180 |
| 181 proceed_ = command == "1"; | 181 proceed_ = command == "1"; |
| 182 | 182 |
| 183 if (proceed_) { | 183 if (proceed_) { |
| 184 if (is_main_frame_) | 184 if (is_main_frame_) |
| 185 web->HideInterstitialPage(true, true); | 185 web->HideInterstitialPage(true, true); |
| 186 else | 186 else |
| 187 web->HideInterstitialPage(false, false); | 187 web->HideInterstitialPage(false, false); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 218 param.result = result_; | 218 param.result = result_; |
| 219 param.client = client_; | 219 param.client = client_; |
| 220 param.render_process_host_id = render_process_host_id_; | 220 param.render_process_host_id = render_process_host_id_; |
| 221 param.render_view_id = render_view_id_; | 221 param.render_view_id = render_view_id_; |
| 222 param.proceed = proceed_; | 222 param.proceed = proceed_; |
| 223 io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 223 io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| 224 sb_service_, | 224 sb_service_, |
| 225 &SafeBrowsingService::OnBlockingPageDone, | 225 &SafeBrowsingService::OnBlockingPageDone, |
| 226 param)); | 226 param)); |
| 227 } | 227 } |
| OLD | NEW |