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

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

Issue 8253002: Move PageTransition into content namespace. While I'm touching all these files, I've also updated... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 SafeBrowsingService::UrlCheckResult threat_type = 428 SafeBrowsingService::UrlCheckResult threat_type =
429 unsafe_resources_[0].threat_type; 429 unsafe_resources_[0].threat_type;
430 if (threat_type == SafeBrowsingService::URL_MALWARE) { 430 if (threat_type == SafeBrowsingService::URL_MALWARE) {
431 url = google_util::AppendGoogleLocaleParam(GURL(kLearnMoreMalwareUrl)); 431 url = google_util::AppendGoogleLocaleParam(GURL(kLearnMoreMalwareUrl));
432 } else if (threat_type == SafeBrowsingService::URL_PHISHING || 432 } else if (threat_type == SafeBrowsingService::URL_PHISHING ||
433 threat_type == SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { 433 threat_type == SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) {
434 url = google_util::AppendGoogleLocaleParam(GURL(kLearnMorePhishingUrl)); 434 url = google_util::AppendGoogleLocaleParam(GURL(kLearnMorePhishingUrl));
435 } else { 435 } else {
436 NOTREACHED(); 436 NOTREACHED();
437 } 437 }
438 tab()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::LINK); 438 tab()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_LINK);
439 return; 439 return;
440 } 440 }
441 441
442 if (command == kShowPrivacyCommand) { 442 if (command == kShowPrivacyCommand) {
443 // User pressed "Safe Browsing privacy policy". 443 // User pressed "Safe Browsing privacy policy".
444 GURL url(kSbPrivacyPolicyUrl); 444 GURL url(kSbPrivacyPolicyUrl);
445 tab()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::LINK); 445 tab()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_LINK);
446 return; 446 return;
447 } 447 }
448 448
449 if (command == kProceedCommand) { 449 if (command == kProceedCommand) {
450 Proceed(); 450 Proceed();
451 // We are deleted after this. 451 // We are deleted after this.
452 return; 452 return;
453 } 453 }
454 454
455 if (command == kTakeMeBackCommand) { 455 if (command == kTakeMeBackCommand) {
(...skipping 27 matching lines...) Expand all
483 // It is not OK to navigate in the context of an interstitial page. 483 // It is not OK to navigate in the context of an interstitial page.
484 SafeBrowsingService::UrlCheckResult threat_type = 484 SafeBrowsingService::UrlCheckResult threat_type =
485 unsafe_resources_[element_index].threat_type; 485 unsafe_resources_[element_index].threat_type;
486 DCHECK(threat_type == SafeBrowsingService::URL_PHISHING || 486 DCHECK(threat_type == SafeBrowsingService::URL_PHISHING ||
487 threat_type == SafeBrowsingService::CLIENT_SIDE_PHISHING_URL); 487 threat_type == SafeBrowsingService::CLIENT_SIDE_PHISHING_URL);
488 GURL report_url = 488 GURL report_url =
489 safe_browsing_util::GeneratePhishingReportUrl( 489 safe_browsing_util::GeneratePhishingReportUrl(
490 kSbReportPhishingErrorUrl, 490 kSbReportPhishingErrorUrl,
491 bad_url_spec, 491 bad_url_spec,
492 threat_type == SafeBrowsingService::CLIENT_SIDE_PHISHING_URL); 492 threat_type == SafeBrowsingService::CLIENT_SIDE_PHISHING_URL);
493 tab()->OpenURL(report_url, GURL(), CURRENT_TAB, PageTransition::LINK); 493 tab()->OpenURL(
494 report_url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_LINK);
494 return; 495 return;
495 } 496 }
496 497
497 if (command == kShowDiagnosticCommand) { 498 if (command == kShowDiagnosticCommand) {
498 // We're going to take the user to Google's SafeBrowsing diagnostic page. 499 // We're going to take the user to Google's SafeBrowsing diagnostic page.
499 std::string diagnostic = 500 std::string diagnostic =
500 base::StringPrintf(kSbDiagnosticUrl, 501 base::StringPrintf(kSbDiagnosticUrl,
501 net::EscapeQueryParamValue(bad_url_spec, true).c_str()); 502 net::EscapeQueryParamValue(bad_url_spec, true).c_str());
502 GURL diagnostic_url(diagnostic); 503 GURL diagnostic_url(diagnostic);
503 diagnostic_url = google_util::AppendGoogleLocaleParam(diagnostic_url); 504 diagnostic_url = google_util::AppendGoogleLocaleParam(diagnostic_url);
504 DCHECK(unsafe_resources_[element_index].threat_type == 505 DCHECK(unsafe_resources_[element_index].threat_type ==
505 SafeBrowsingService::URL_MALWARE); 506 SafeBrowsingService::URL_MALWARE);
506 tab()->OpenURL(diagnostic_url, GURL(), CURRENT_TAB, PageTransition::LINK); 507 tab()->OpenURL(
508 diagnostic_url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_LINK);
507 return; 509 return;
508 } 510 }
509 511
510 NOTREACHED() << "Unexpected command: " << command; 512 NOTREACHED() << "Unexpected command: " << command;
511 } 513 }
512 514
513 void SafeBrowsingBlockingPage::SetReportingPreference(bool report) { 515 void SafeBrowsingBlockingPage::SetReportingPreference(bool report) {
514 Profile* profile = Profile::FromBrowserContext(tab()->browser_context()); 516 Profile* profile = Profile::FromBrowserContext(tab()->browser_context());
515 PrefService* pref = profile->GetPrefs(); 517 PrefService* pref = profile->GetPrefs();
516 pref->SetBoolean(prefs::kSafeBrowsingReportingEnabled, report); 518 pref->SetBoolean(prefs::kSafeBrowsingReportingEnabled, report);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 // Client-side phishing detection interstitials never block the main frame 705 // Client-side phishing detection interstitials never block the main frame
704 // load, since they happen after the page is finished loading. 706 // load, since they happen after the page is finished loading.
705 if (unsafe_resources[0].threat_type == 707 if (unsafe_resources[0].threat_type ==
706 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { 708 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) {
707 return false; 709 return false;
708 } 710 }
709 711
710 // Otherwise, check the threat type. 712 // Otherwise, check the threat type.
711 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; 713 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource;
712 } 714 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698