Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (command == kLearnMoreCommand) { 269 if (command == kLearnMoreCommand) {
270 // User pressed "Learn more". 270 // User pressed "Learn more".
271 RecordUserInteraction(SHOW_LEARN_MORE); 271 RecordUserInteraction(SHOW_LEARN_MORE);
272 GURL learn_more_url(interstitial_type_ == TYPE_PHISHING ? 272 GURL learn_more_url(interstitial_type_ == TYPE_PHISHING ?
273 kLearnMorePhishingUrlV2 : kLearnMoreMalwareUrlV2); 273 kLearnMorePhishingUrlV2 : kLearnMoreMalwareUrlV2);
274 learn_more_url = google_util::AppendGoogleLocaleParam( 274 learn_more_url = google_util::AppendGoogleLocaleParam(
275 learn_more_url, g_browser_process->GetApplicationLocale()); 275 learn_more_url, g_browser_process->GetApplicationLocale());
276 OpenURLParams params(learn_more_url, 276 OpenURLParams params(learn_more_url,
277 Referrer(), 277 Referrer(),
278 CURRENT_TAB, 278 CURRENT_TAB,
279 content::PAGE_TRANSITION_LINK, 279 ui::PAGE_TRANSITION_LINK,
280 false); 280 false);
281 web_contents_->OpenURL(params); 281 web_contents_->OpenURL(params);
282 return; 282 return;
283 } 283 }
284 284
285 if (command == kShowPrivacyCommand) { 285 if (command == kShowPrivacyCommand) {
286 // User pressed "Safe Browsing privacy policy". 286 // User pressed "Safe Browsing privacy policy".
287 RecordUserInteraction(SHOW_PRIVACY_POLICY); 287 RecordUserInteraction(SHOW_PRIVACY_POLICY);
288 GURL privacy_url( 288 GURL privacy_url(
289 l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_PRIVACY_POLICY_URL)); 289 l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_PRIVACY_POLICY_URL));
290 privacy_url = google_util::AppendGoogleLocaleParam( 290 privacy_url = google_util::AppendGoogleLocaleParam(
291 privacy_url, g_browser_process->GetApplicationLocale()); 291 privacy_url, g_browser_process->GetApplicationLocale());
292 OpenURLParams params(privacy_url, 292 OpenURLParams params(privacy_url,
293 Referrer(), 293 Referrer(),
294 CURRENT_TAB, 294 CURRENT_TAB,
295 content::PAGE_TRANSITION_LINK, 295 ui::PAGE_TRANSITION_LINK,
296 false); 296 false);
297 web_contents_->OpenURL(params); 297 web_contents_->OpenURL(params);
298 return; 298 return;
299 } 299 }
300 300
301 bool proceed_blocked = false; 301 bool proceed_blocked = false;
302 if (command == kProceedCommand) { 302 if (command == kProceedCommand) {
303 if (IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) { 303 if (IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) {
304 proceed_blocked = true; 304 proceed_blocked = true;
305 } else { 305 } else {
(...skipping 16 matching lines...) Expand all
322 } 322 }
323 323
324 // Otherwise the offending entry has committed, and we need to go back or 324 // Otherwise the offending entry has committed, and we need to go back or
325 // to a safe page. We will close the interstitial when that page commits. 325 // to a safe page. We will close the interstitial when that page commits.
326 if (web_contents_->GetController().CanGoBack()) { 326 if (web_contents_->GetController().CanGoBack()) {
327 web_contents_->GetController().GoBack(); 327 web_contents_->GetController().GoBack();
328 } else { 328 } else {
329 web_contents_->GetController().LoadURL( 329 web_contents_->GetController().LoadURL(
330 GURL(chrome::kChromeUINewTabURL), 330 GURL(chrome::kChromeUINewTabURL),
331 content::Referrer(), 331 content::Referrer(),
332 content::PAGE_TRANSITION_AUTO_TOPLEVEL, 332 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
333 std::string()); 333 std::string());
334 } 334 }
335 return; 335 return;
336 } 336 }
337 337
338 // The "report error" and "show diagnostic" commands can have a number 338 // The "report error" and "show diagnostic" commands can have a number
339 // appended to them, which is the index of the element they apply to. 339 // appended to them, which is the index of the element they apply to.
340 size_t element_index = 0; 340 size_t element_index = 0;
341 size_t colon_index = command.find(':'); 341 size_t colon_index = command.find(':');
342 if (colon_index != std::string::npos) { 342 if (colon_index != std::string::npos) {
(...skipping 21 matching lines...) Expand all
364 base::StringPrintf(kSbDiagnosticUrl, 364 base::StringPrintf(kSbDiagnosticUrl,
365 net::EscapeQueryParamValue(bad_url_spec, true).c_str()); 365 net::EscapeQueryParamValue(bad_url_spec, true).c_str());
366 GURL diagnostic_url(diagnostic); 366 GURL diagnostic_url(diagnostic);
367 diagnostic_url = google_util::AppendGoogleLocaleParam( 367 diagnostic_url = google_util::AppendGoogleLocaleParam(
368 diagnostic_url, g_browser_process->GetApplicationLocale()); 368 diagnostic_url, g_browser_process->GetApplicationLocale());
369 DCHECK(unsafe_resources_[element_index].threat_type == 369 DCHECK(unsafe_resources_[element_index].threat_type ==
370 SB_THREAT_TYPE_URL_MALWARE || 370 SB_THREAT_TYPE_URL_MALWARE ||
371 unsafe_resources_[element_index].threat_type == 371 unsafe_resources_[element_index].threat_type ==
372 SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL); 372 SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL);
373 OpenURLParams params( 373 OpenURLParams params(
374 diagnostic_url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, 374 diagnostic_url, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_LINK,
375 false); 375 false);
376 web_contents_->OpenURL(params); 376 web_contents_->OpenURL(params);
377 return; 377 return;
378 } 378 }
379 379
380 if (command == kExpandedSeeMoreCommand) { 380 if (command == kExpandedSeeMoreCommand) {
381 RecordUserInteraction(SHOW_ADVANCED); 381 RecordUserInteraction(SHOW_ADVANCED);
382 return; 382 return;
383 } 383 }
384 384
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 IDS_PHISHING_V3_PRIMARY_PARAGRAPH, 754 IDS_PHISHING_V3_PRIMARY_PARAGRAPH,
755 base::UTF8ToUTF16(url_.host()))); 755 base::UTF8ToUTF16(url_.host())));
756 load_time_data->SetString( 756 load_time_data->SetString(
757 "explanationParagraph", 757 "explanationParagraph",
758 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH, 758 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH,
759 base::UTF8ToUTF16(url_.host()))); 759 base::UTF8ToUTF16(url_.host())));
760 load_time_data->SetString( 760 load_time_data->SetString(
761 "finalParagraph", 761 "finalParagraph",
762 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); 762 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH));
763 } 763 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698