| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/ssl/captive_portal_blocking_page.h" | 5 #include "chrome/browser/ssl/captive_portal_blocking_page.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 16 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
| 17 #include "chrome/browser/ssl/cert_report_helper.h" | 17 #include "chrome/browser/ssl/cert_report_helper.h" |
| 18 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 18 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
| 19 #include "components/captive_portal/captive_portal_detector.h" | 19 #include "components/captive_portal/captive_portal_detector.h" |
| 20 #include "components/certificate_reporting/error_reporter.h" | 20 #include "components/certificate_reporting/error_reporter.h" |
| 21 #include "components/security_interstitials/core/common_string_util.h" |
| 21 #include "components/security_interstitials/core/controller_client.h" | 22 #include "components/security_interstitials/core/controller_client.h" |
| 22 #include "components/url_formatter/url_formatter.h" | 23 #include "components/url_formatter/url_formatter.h" |
| 23 #include "components/wifi/wifi_service.h" | 24 #include "components/wifi/wifi_service.h" |
| 24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 26 #include "net/base/network_change_notifier.h" | 27 #include "net/base/network_change_notifier.h" |
| 27 #include "net/base/network_interfaces.h" | 28 #include "net/base/network_interfaces.h" |
| 28 #include "net/ssl/ssl_info.h" | 29 #include "net/ssl/ssl_info.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 30 | 31 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // opposed to SafeBrowsing subresource interstitials which just block access | 113 // opposed to SafeBrowsing subresource interstitials which just block access |
| 113 // to the current page and don't create a new entry. | 114 // to the current page and don't create a new entry. |
| 114 return true; | 115 return true; |
| 115 } | 116 } |
| 116 | 117 |
| 117 void CaptivePortalBlockingPage::PopulateInterstitialStrings( | 118 void CaptivePortalBlockingPage::PopulateInterstitialStrings( |
| 118 base::DictionaryValue* load_time_data) { | 119 base::DictionaryValue* load_time_data) { |
| 119 load_time_data->SetString("iconClass", "icon-offline"); | 120 load_time_data->SetString("iconClass", "icon-offline"); |
| 120 load_time_data->SetString("type", "CAPTIVE_PORTAL"); | 121 load_time_data->SetString("type", "CAPTIVE_PORTAL"); |
| 121 load_time_data->SetBoolean("overridable", false); | 122 load_time_data->SetBoolean("overridable", false); |
| 123 security_interstitials::common_string_util::PopulateNewIconStrings( |
| 124 load_time_data); |
| 122 | 125 |
| 123 // |IsWifiConnection| isn't accurate on some platforms, so always try to get | 126 // |IsWifiConnection| isn't accurate on some platforms, so always try to get |
| 124 // the Wi-Fi SSID even if |IsWifiConnection| is false. | 127 // the Wi-Fi SSID even if |IsWifiConnection| is false. |
| 125 std::string wifi_ssid = GetWiFiSSID(); | 128 std::string wifi_ssid = GetWiFiSSID(); |
| 126 bool is_wifi = !wifi_ssid.empty() || IsWifiConnection(); | 129 bool is_wifi = !wifi_ssid.empty() || IsWifiConnection(); |
| 127 | 130 |
| 128 load_time_data->SetString( | 131 load_time_data->SetString( |
| 129 "primaryButtonText", | 132 "primaryButtonText", |
| 130 l10n_util::GetStringUTF16(IDS_CAPTIVE_PORTAL_BUTTON_OPEN_LOGIN_PAGE)); | 133 l10n_util::GetStringUTF16(IDS_CAPTIVE_PORTAL_BUTTON_OPEN_LOGIN_PAGE)); |
| 131 | 134 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); | 217 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); |
| 215 } | 218 } |
| 216 | 219 |
| 217 // Need to explicity deny the certificate via the callback, otherwise memory | 220 // Need to explicity deny the certificate via the callback, otherwise memory |
| 218 // is leaked. | 221 // is leaked. |
| 219 if (!callback_.is_null()) { | 222 if (!callback_.is_null()) { |
| 220 callback_.Run(false); | 223 callback_.Run(false); |
| 221 callback_.Reset(); | 224 callback_.Reset(); |
| 222 } | 225 } |
| 223 } | 226 } |
| OLD | NEW |