| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool Version3Enabled() { | 153 bool Version3Enabled() { |
| 154 if (CommandLine::ForCurrentProcess()->HasSwitch( | 154 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 155 switches::kMalwareInterstitialVersionV3)) { | 155 switches::kMalwareInterstitialVersionV3)) { |
| 156 return true; | 156 return true; |
| 157 } | 157 } |
| 158 return false; | 158 return false; |
| 159 } | 159 } |
| 160 | 160 |
| 161 class SafeBrowsingBlockingPageV3 : public SafeBrowsingBlockingPage { | |
| 162 public: | |
| 163 SafeBrowsingBlockingPageV3(SafeBrowsingUIManager* ui_manager, | |
| 164 content::WebContents* web_contents, | |
| 165 const UnsafeResourceList& unsafe_resources); | |
| 166 | |
| 167 // InterstitialPageDelegate method: | |
| 168 virtual std::string GetHTMLContents() OVERRIDE; | |
| 169 | |
| 170 private: | |
| 171 // Fills the passed dictionary with the values to be passed to the template | |
| 172 // when creating the HTML. | |
| 173 void PopulateMalwareLoadTimeData(base::DictionaryValue* load_time_data); | |
| 174 void PopulatePhishingLoadTimeData(base::DictionaryValue* load_time_data); | |
| 175 | |
| 176 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPageV3); | |
| 177 }; | |
| 178 | |
| 179 } // namespace | 161 } // namespace |
| 180 | 162 |
| 181 // static | 163 // static |
| 182 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; | 164 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; |
| 183 | 165 |
| 184 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we | 166 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we |
| 185 // don't leak it. | 167 // don't leak it. |
| 186 class SafeBrowsingBlockingPageFactoryImpl | 168 class SafeBrowsingBlockingPageFactoryImpl |
| 187 : public SafeBrowsingBlockingPageFactory { | 169 : public SafeBrowsingBlockingPageFactory { |
| 188 public: | 170 public: |
| (...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 IDS_PHISHING_V3_PRIMARY_PARAGRAPH, | 1305 IDS_PHISHING_V3_PRIMARY_PARAGRAPH, |
| 1324 base::UTF8ToUTF16(url_.host()))); | 1306 base::UTF8ToUTF16(url_.host()))); |
| 1325 load_time_data->SetString( | 1307 load_time_data->SetString( |
| 1326 "explanationParagraph", | 1308 "explanationParagraph", |
| 1327 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH, | 1309 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH, |
| 1328 base::UTF8ToUTF16(url_.host()))); | 1310 base::UTF8ToUTF16(url_.host()))); |
| 1329 load_time_data->SetString( | 1311 load_time_data->SetString( |
| 1330 "finalParagraph", | 1312 "finalParagraph", |
| 1331 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); | 1313 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); |
| 1332 } | 1314 } |
| OLD | NEW |