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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; | 117 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; |
118 | 118 |
119 static base::LazyInstance<SafeBrowsingBlockingPage::UnsafeResourceMap> | 119 static base::LazyInstance<SafeBrowsingBlockingPage::UnsafeResourceMap> |
120 g_unsafe_resource_map = LAZY_INSTANCE_INITIALIZER; | 120 g_unsafe_resource_map = LAZY_INSTANCE_INITIALIZER; |
121 | 121 |
122 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we | 122 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we |
123 // don't leak it. | 123 // don't leak it. |
124 class SafeBrowsingBlockingPageFactoryImpl | 124 class SafeBrowsingBlockingPageFactoryImpl |
125 : public SafeBrowsingBlockingPageFactory { | 125 : public SafeBrowsingBlockingPageFactory { |
126 public: | 126 public: |
127 SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 127 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
128 SafeBrowsingUIManager* ui_manager, | 128 SafeBrowsingUIManager* ui_manager, |
129 WebContents* web_contents, | 129 WebContents* web_contents, |
130 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) { | 130 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) |
| 131 OVERRIDE { |
131 // Only do the trial if the interstitial is for a single malware or | 132 // Only do the trial if the interstitial is for a single malware or |
132 // phishing resource, the multi-threat interstitial has not been updated to | 133 // phishing resource, the multi-threat interstitial has not been updated to |
133 // V2 yet. | 134 // V2 yet. |
134 if (unsafe_resources.size() == 1 && | 135 if (unsafe_resources.size() == 1 && |
135 (unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_MALWARE || | 136 (unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_MALWARE || |
136 unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_PHISHING)) { | 137 unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_PHISHING)) { |
137 return new SafeBrowsingBlockingPageV2(ui_manager, web_contents, | 138 return new SafeBrowsingBlockingPageV2(ui_manager, web_contents, |
138 unsafe_resources); | 139 unsafe_resources); |
139 } | 140 } |
140 return new SafeBrowsingBlockingPageV1(ui_manager, web_contents, | 141 return new SafeBrowsingBlockingPageV1(ui_manager, web_contents, |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 | 1044 |
1044 strings->SetString("details", ""); | 1045 strings->SetString("details", ""); |
1045 strings->SetString("confirm_text", ""); | 1046 strings->SetString("confirm_text", ""); |
1046 strings->SetString(kBoxChecked, ""); | 1047 strings->SetString(kBoxChecked, ""); |
1047 strings->SetString("report_error", | 1048 strings->SetString("report_error", |
1048 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); | 1049 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); |
1049 strings->SetBoolean(kDisplayCheckBox, false); | 1050 strings->SetBoolean(kDisplayCheckBox, false); |
1050 strings->SetString("learnMore", | 1051 strings->SetString("learnMore", |
1051 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); | 1052 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); |
1052 } | 1053 } |
OLD | NEW |