| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 PHISHING_PROCEED_CROSS_SITE, | 139 PHISHING_PROCEED_CROSS_SITE, |
| 140 MAX_DETAILED_ACTION | 140 MAX_DETAILED_ACTION |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 void RecordDetailedUserAction(DetailedDecision decision) { | 143 void RecordDetailedUserAction(DetailedDecision decision) { |
| 144 UMA_HISTOGRAM_ENUMERATION("SB2.InterstitialActionDetails", | 144 UMA_HISTOGRAM_ENUMERATION("SB2.InterstitialActionDetails", |
| 145 decision, | 145 decision, |
| 146 MAX_DETAILED_ACTION); | 146 MAX_DETAILED_ACTION); |
| 147 } | 147 } |
| 148 | 148 |
| 149 class SafeBrowsingBlockingPageV1 : public SafeBrowsingBlockingPage { |
| 150 public: |
| 151 SafeBrowsingBlockingPageV1(SafeBrowsingUIManager* ui_manager, |
| 152 content::WebContents* web_contents, |
| 153 const UnsafeResourceList& unsafe_resources); |
| 154 |
| 155 // InterstitialPageDelegate method: |
| 156 virtual std::string GetHTMLContents() OVERRIDE; |
| 157 |
| 158 private: |
| 159 // Fills the passed dictionary with the strings passed to JS Template when |
| 160 // creating the HTML. |
| 161 void PopulateMultipleThreatStringDictionary(base::DictionaryValue* strings); |
| 162 void PopulateMalwareStringDictionary(base::DictionaryValue* strings); |
| 163 void PopulatePhishingStringDictionary(base::DictionaryValue* strings); |
| 164 |
| 165 // A helper method used by the Populate methods above used to populate common |
| 166 // fields. |
| 167 void PopulateStringDictionary(base::DictionaryValue* strings, |
| 168 const base::string16& title, |
| 169 const base::string16& headline, |
| 170 const base::string16& description1, |
| 171 const base::string16& description2, |
| 172 const base::string16& description3); |
| 173 |
| 174 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPageV1); |
| 175 }; |
| 176 |
| 177 class SafeBrowsingBlockingPageV2 : public SafeBrowsingBlockingPage { |
| 178 public: |
| 179 SafeBrowsingBlockingPageV2(SafeBrowsingUIManager* ui_manager, |
| 180 content::WebContents* web_contents, |
| 181 const UnsafeResourceList& unsafe_resources); |
| 182 |
| 183 // InterstitialPageDelegate method: |
| 184 virtual std::string GetHTMLContents() OVERRIDE; |
| 185 |
| 186 private: |
| 187 // Fills the passed dictionary with the strings passed to JS Template when |
| 188 // creating the HTML. |
| 189 void PopulateMultipleThreatStringDictionary(base::DictionaryValue* strings); |
| 190 void PopulateMalwareStringDictionary(base::DictionaryValue* strings); |
| 191 void PopulatePhishingStringDictionary(base::DictionaryValue* strings); |
| 192 |
| 193 // A helper method used by the Populate methods above used to populate common |
| 194 // fields. |
| 195 void PopulateStringDictionary(base::DictionaryValue* strings, |
| 196 const base::string16& title, |
| 197 const base::string16& headline, |
| 198 const base::string16& description1, |
| 199 const base::string16& description2, |
| 200 const base::string16& description3); |
| 201 |
| 202 // For the FieldTrial: this contains the name of the condition. |
| 203 std::string trialCondition_; |
| 204 |
| 205 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPageV2); |
| 206 }; |
| 207 |
| 149 } // namespace | 208 } // namespace |
| 150 | 209 |
| 151 // static | 210 // static |
| 152 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; | 211 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; |
| 153 | 212 |
| 154 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we | 213 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we |
| 155 // don't leak it. | 214 // don't leak it. |
| 156 class SafeBrowsingBlockingPageFactoryImpl | 215 class SafeBrowsingBlockingPageFactoryImpl |
| 157 : public SafeBrowsingBlockingPageFactory { | 216 : public SafeBrowsingBlockingPageFactory { |
| 158 public: | 217 public: |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 strings->SetString("details", std::string()); | 1244 strings->SetString("details", std::string()); |
| 1186 strings->SetString("confirm_text", std::string()); | 1245 strings->SetString("confirm_text", std::string()); |
| 1187 strings->SetString(kBoxChecked, std::string()); | 1246 strings->SetString(kBoxChecked, std::string()); |
| 1188 strings->SetString( | 1247 strings->SetString( |
| 1189 "report_error", | 1248 "report_error", |
| 1190 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); | 1249 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); |
| 1191 strings->SetBoolean(kDisplayCheckBox, false); | 1250 strings->SetBoolean(kDisplayCheckBox, false); |
| 1192 strings->SetString("learnMore", | 1251 strings->SetString("learnMore", |
| 1193 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); | 1252 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); |
| 1194 } | 1253 } |
| OLD | NEW |