Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 #include "net/base/escape.h" | 43 #include "net/base/escape.h" |
| 44 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
| 45 | 45 |
| 46 using base::UserMetricsAction; | 46 using base::UserMetricsAction; |
| 47 using content::BrowserThread; | 47 using content::BrowserThread; |
| 48 using content::InterstitialPage; | 48 using content::InterstitialPage; |
| 49 using content::OpenURLParams; | 49 using content::OpenURLParams; |
| 50 using content::Referrer; | 50 using content::Referrer; |
| 51 using content::WebContents; | 51 using content::WebContents; |
| 52 | 52 |
| 53 namespace { | 53 namespace safe_browsing { |
| 54 | 54 |
| 55 // For malware interstitial pages, we link the problematic URL to Google's | 55 // For malware interstitial pages, we link the problematic URL to Google's |
|
Nathan Parker
2015/11/05 22:00:53
Keep these in anon-namespace.
vakh (old account. dont use)
2015/11/07 01:22:56
Done.
| |
| 56 // diagnostic page. | 56 // diagnostic page. |
| 57 #if defined(GOOGLE_CHROME_BUILD) | 57 #if defined(GOOGLE_CHROME_BUILD) |
| 58 const char kSbDiagnosticUrl[] = | 58 const char kSbDiagnosticUrl[] = |
| 59 "https://www.google.com/safebrowsing/diagnostic?site=%s&client=googlechrome" ; | 59 "https://www.google.com/safebrowsing/diagnostic?site=%s&client=googlechrome" ; |
| 60 #else | 60 #else |
| 61 const char kSbDiagnosticUrl[] = | 61 const char kSbDiagnosticUrl[] = |
| 62 "https://www.google.com/safebrowsing/diagnostic?site=%s&client=chromium"; | 62 "https://www.google.com/safebrowsing/diagnostic?site=%s&client=chromium"; |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 // URL for malware and phishing, V2. | 65 // URL for malware and phishing, V2. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 86 | 86 |
| 87 // Constants for the V4 phishing string upgrades. | 87 // Constants for the V4 phishing string upgrades. |
| 88 const char kReportPhishingErrorUrl[] = | 88 const char kReportPhishingErrorUrl[] = |
| 89 "https://www.google.com/safebrowsing/report_error/"; | 89 "https://www.google.com/safebrowsing/report_error/"; |
| 90 const char kReportPhishingErrorTrial[] = "SafeBrowsingReportPhishingErrorLink"; | 90 const char kReportPhishingErrorTrial[] = "SafeBrowsingReportPhishingErrorLink"; |
| 91 const char kReportPhishingErrorEnabled[] = "Enabled"; | 91 const char kReportPhishingErrorEnabled[] = "Enabled"; |
| 92 | 92 |
| 93 base::LazyInstance<SafeBrowsingBlockingPage::UnsafeResourceMap> | 93 base::LazyInstance<SafeBrowsingBlockingPage::UnsafeResourceMap> |
| 94 g_unsafe_resource_map = LAZY_INSTANCE_INITIALIZER; | 94 g_unsafe_resource_map = LAZY_INSTANCE_INITIALIZER; |
| 95 | 95 |
| 96 } // namespace | |
| 97 | |
| 98 // static | 96 // static |
| 99 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; | 97 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; |
| 100 | 98 |
| 101 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we | 99 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we |
| 102 // don't leak it. | 100 // don't leak it. |
| 103 class SafeBrowsingBlockingPageFactoryImpl | 101 class SafeBrowsingBlockingPageFactoryImpl |
| 104 : public SafeBrowsingBlockingPageFactory { | 102 : public SafeBrowsingBlockingPageFactory { |
| 105 public: | 103 public: |
| 106 SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 104 SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
| 107 SafeBrowsingUIManager* ui_manager, | 105 SafeBrowsingUIManager* ui_manager, |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 "finalParagraph", l10n_util::GetStringUTF16( | 707 "finalParagraph", l10n_util::GetStringUTF16( |
| 710 IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); | 708 IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); |
| 711 } else { | 709 } else { |
| 712 load_time_data->SetString( | 710 load_time_data->SetString( |
| 713 "finalParagraph", | 711 "finalParagraph", |
| 714 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); | 712 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); |
| 715 } | 713 } |
| 716 | 714 |
| 717 PopulateExtendedReportingOption(load_time_data); | 715 PopulateExtendedReportingOption(load_time_data); |
| 718 } | 716 } |
| 717 | |
| 718 } // namespace safe_browsing | |
| OLD | NEW |