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 22 matching lines...) Expand all Loading... |
33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/browser/interstitial_page.h" | 34 #include "content/public/browser/interstitial_page.h" |
35 #include "content/public/browser/navigation_controller.h" | 35 #include "content/public/browser/navigation_controller.h" |
36 #include "content/public/browser/user_metrics.h" | 36 #include "content/public/browser/user_metrics.h" |
37 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
38 #include "grit/browser_resources.h" | 38 #include "grit/browser_resources.h" |
39 #include "grit/chromium_strings.h" | 39 #include "grit/chromium_strings.h" |
40 #include "grit/generated_resources.h" | 40 #include "grit/generated_resources.h" |
41 #include "grit/locale_settings.h" | 41 #include "grit/locale_settings.h" |
42 #include "net/base/escape.h" | 42 #include "net/base/escape.h" |
| 43 #include "net/base/url_constants.h" |
43 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
44 #include "ui/base/resource/resource_bundle.h" | 45 #include "ui/base/resource/resource_bundle.h" |
45 #include "ui/base/webui/jstemplate_builder.h" | 46 #include "ui/base/webui/jstemplate_builder.h" |
46 #include "ui/base/webui/web_ui_util.h" | 47 #include "ui/base/webui/web_ui_util.h" |
47 | 48 |
48 using base::UserMetricsAction; | 49 using base::UserMetricsAction; |
49 using content::BrowserThread; | 50 using content::BrowserThread; |
50 using content::InterstitialPage; | 51 using content::InterstitialPage; |
51 using content::OpenURLParams; | 52 using content::OpenURLParams; |
52 using content::Referrer; | 53 using content::Referrer; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 malware_details_ = MalwareDetails::NewMalwareDetails( | 259 malware_details_ = MalwareDetails::NewMalwareDetails( |
259 ui_manager_, web_contents, unsafe_resources[0]); | 260 ui_manager_, web_contents, unsafe_resources[0]); |
260 } | 261 } |
261 | 262 |
262 interstitial_page_ = InterstitialPage::Create( | 263 interstitial_page_ = InterstitialPage::Create( |
263 web_contents, IsMainPageLoadBlocked(unsafe_resources), url_, this); | 264 web_contents, IsMainPageLoadBlocked(unsafe_resources), url_, this); |
264 } | 265 } |
265 | 266 |
266 bool SafeBrowsingBlockingPage::CanShowMalwareDetailsOption() { | 267 bool SafeBrowsingBlockingPage::CanShowMalwareDetailsOption() { |
267 return (!web_contents_->GetBrowserContext()->IsOffTheRecord() && | 268 return (!web_contents_->GetBrowserContext()->IsOffTheRecord() && |
268 web_contents_->GetURL().SchemeIs(content::kHttpScheme)); | 269 web_contents_->GetURL().SchemeIs(net::kHttpScheme)); |
269 } | 270 } |
270 | 271 |
271 SafeBrowsingBlockingPage::~SafeBrowsingBlockingPage() { | 272 SafeBrowsingBlockingPage::~SafeBrowsingBlockingPage() { |
272 } | 273 } |
273 | 274 |
274 void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) { | 275 void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) { |
275 std::string command(cmd); // Make a local copy so we can modify it. | 276 std::string command(cmd); // Make a local copy so we can modify it. |
276 // The Jasonified response has quotes, remove them. | 277 // The Jasonified response has quotes, remove them. |
277 if (command.length() > 1 && command[0] == '"') { | 278 if (command.length() > 1 && command[0] == '"') { |
278 command = command.substr(1, command.length() - 2); | 279 command = command.substr(1, command.length() - 2); |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 strings->SetString("details", std::string()); | 1186 strings->SetString("details", std::string()); |
1186 strings->SetString("confirm_text", std::string()); | 1187 strings->SetString("confirm_text", std::string()); |
1187 strings->SetString(kBoxChecked, std::string()); | 1188 strings->SetString(kBoxChecked, std::string()); |
1188 strings->SetString( | 1189 strings->SetString( |
1189 "report_error", | 1190 "report_error", |
1190 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); | 1191 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); |
1191 strings->SetBoolean(kDisplayCheckBox, false); | 1192 strings->SetBoolean(kDisplayCheckBox, false); |
1192 strings->SetString("learnMore", | 1193 strings->SetString("learnMore", |
1193 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); | 1194 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); |
1194 } | 1195 } |
OLD | NEW |