[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 4237dd5 | 2012-06-05 00:00:32 | [diff] [blame] | 5 | #include "chrome/browser/ui/website_settings/website_settings.h" |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 6 | |
avi | 655876a | 2015-12-25 07:18:15 | [diff] [blame] | 7 | #include <stddef.h> |
| 8 | #include <stdint.h> |
| 9 | |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 10 | #include <string> |
| 11 | #include <vector> |
| 12 | |
[email protected] | eb2140c | 2013-07-29 12:37:34 | [diff] [blame] | 13 | #include "base/command_line.h" |
[email protected] | 15b09254 | 2012-05-16 13:08:14 | [diff] [blame] | 14 | #include "base/i18n/time_formatting.h" |
avi | 655876a | 2015-12-25 07:18:15 | [diff] [blame] | 15 | #include "base/macros.h" |
[email protected] | 71cd5ef | 2014-08-13 21:22:04 | [diff] [blame] | 16 | #include "base/metrics/field_trial.h" |
[email protected] | 3ea1b18 | 2013-02-08 22:38:41 | [diff] [blame] | 17 | #include "base/metrics/histogram.h" |
| 18 | #include "base/strings/string_number_conversions.h" |
jialiul | 02aad2d | 2015-04-01 18:56:03 | [diff] [blame] | 19 | #include "base/strings/stringprintf.h" |
[email protected] | 774cc3c | 2013-06-07 20:26:45 | [diff] [blame] | 20 | #include "base/strings/utf_string_conversions.h" |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 21 | #include "base/values.h" |
avi | 655876a | 2015-12-25 07:18:15 | [diff] [blame] | 22 | #include "build/build_config.h" |
jialiul | 02aad2d | 2015-04-01 18:56:03 | [diff] [blame] | 23 | #include "chrome/browser/browser_process.h" |
[email protected] | 6b8a3c74 | 2014-07-25 00:25:35 | [diff] [blame] | 24 | #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" |
[email protected] | b0cb5e8 | 2012-07-19 19:22:47 | [diff] [blame] | 25 | #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
| 26 | #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
| 27 | #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
| 28 | #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
| 29 | #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
peconn | 5100d43 | 2015-09-16 12:03:08 | [diff] [blame] | 30 | #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
[email protected] | 77a91c7 | 2012-08-13 16:19:34 | [diff] [blame] | 31 | #include "chrome/browser/history/history_service_factory.h" |
palmer | f2cba0d | 2015-08-27 23:15:06 | [diff] [blame] | 32 | #include "chrome/browser/infobars/infobar_service.h" |
reillyg | 85f57db | 2016-01-12 23:14:38 | [diff] [blame] | 33 | #include "chrome/browser/permissions/chooser_context_base.h" |
tsergeant | f1e8935 | 2016-01-15 20:34:54 | [diff] [blame] | 34 | #include "chrome/browser/permissions/permission_uma_util.h" |
| 35 | #include "chrome/browser/permissions/permission_util.h" |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 36 | #include "chrome/browser/profiles/profile.h" |
[email protected] | 71cd5ef | 2014-08-13 21:22:04 | [diff] [blame] | 37 | #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
| 38 | #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" |
[email protected] | 4237dd5 | 2012-06-05 00:00:32 | [diff] [blame] | 39 | #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
reillyg | 85f57db | 2016-01-12 23:14:38 | [diff] [blame] | 40 | #include "chrome/browser/usb/usb_chooser_context.h" |
| 41 | #include "chrome/browser/usb/usb_chooser_context_factory.h" |
[email protected] | 71cd5ef | 2014-08-13 21:22:04 | [diff] [blame] | 42 | #include "chrome/common/chrome_switches.h" |
sievers | 2f1e811 | 2015-12-04 18:43:56 | [diff] [blame] | 43 | #include "chrome/common/features.h" |
jsbell | ddb849e | 2015-08-27 00:12:56 | [diff] [blame] | 44 | #include "chrome/common/url_constants.h" |
thestig | 884a160 | 2014-08-27 01:29:39 | [diff] [blame] | 45 | #include "chrome/grit/chromium_strings.h" |
| 46 | #include "chrome/grit/generated_resources.h" |
reillyg | 85f57db | 2016-01-12 23:14:38 | [diff] [blame] | 47 | #include "chrome/grit/theme_resources.h" |
mukai | 8eaec82 | 2014-10-25 17:53:16 | [diff] [blame] | 48 | #include "components/content_settings/core/browser/content_settings_utils.h" |
| 49 | #include "components/content_settings/core/browser/host_content_settings_map.h" |
vabr | 4856559 | 2014-10-08 15:06:02 | [diff] [blame] | 50 | #include "components/content_settings/core/browser/local_shared_objects_counter.h" |
palmer | 0da10b3 | 2015-02-11 00:42:19 | [diff] [blame] | 51 | #include "components/content_settings/core/common/content_settings.h" |
vasilii | f62dbf9 | 2014-09-05 10:23:13 | [diff] [blame] | 52 | #include "components/content_settings/core/common/content_settings_pattern.h" |
jialiul | 02aad2d | 2015-04-01 18:56:03 | [diff] [blame] | 53 | #include "components/rappor/rappor_utils.h" |
felt | 2493b445 | 2015-09-17 20:33:59 | [diff] [blame] | 54 | #include "components/ssl_errors/error_info.h" |
palmer | 153af98 | 2015-09-15 02:04:19 | [diff] [blame] | 55 | #include "components/url_formatter/elide_url.h" |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 56 | #include "content/public/browser/browser_thread.h" |
[email protected] | b59c6cf0 | 2012-03-12 20:51:42 | [diff] [blame] | 57 | #include "content/public/browser/cert_store.h" |
tsergeant | f1e8935 | 2016-01-15 20:34:54 | [diff] [blame] | 58 | #include "content/public/browser/permission_type.h" |
[email protected] | e22d64f | 2012-09-10 09:03:23 | [diff] [blame] | 59 | #include "content/public/browser/user_metrics.h" |
[email protected] | eb2140c | 2013-07-29 12:37:34 | [diff] [blame] | 60 | #include "content/public/common/content_switches.h" |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 61 | #include "content/public/common/url_constants.h" |
sdefresne | 21a6eaf | 2016-02-11 22:30:19 | [diff] [blame] | 62 | #include "grit/components_chromium_strings.h" |
| 63 | #include "grit/components_google_chrome_strings.h" |
| 64 | #include "grit/components_strings.h" |
[email protected] | 6e7845ae | 2013-03-29 21:48:11 | [diff] [blame] | 65 | #include "net/cert/cert_status_flags.h" |
| 66 | #include "net/cert/x509_certificate.h" |
[email protected] | 536fd0b | 2013-03-14 17:41:57 | [diff] [blame] | 67 | #include "net/ssl/ssl_cipher_suite_names.h" |
| 68 | #include "net/ssl/ssl_connection_status_flags.h" |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 69 | #include "ui/base/l10n/l10n_util.h" |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 70 | |
[email protected] | 24a9f1c9 | 2013-11-13 12:33:37 | [diff] [blame] | 71 | #if defined(OS_CHROMEOS) |
| 72 | #include "chrome/browser/chromeos/policy/policy_cert_service.h" |
| 73 | #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" |
| 74 | #endif |
| 75 | |
estade | 3feb83f | 2015-09-01 23:00:49 | [diff] [blame] | 76 | #if !defined(OS_ANDROID) |
mgiuca | a319f21 | 2016-01-14 03:30:11 | [diff] [blame] | 77 | #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
estade | 3feb83f | 2015-09-01 23:00:49 | [diff] [blame] | 78 | #include "chrome/browser/ui/website_settings/website_settings_infobar_delegate.h" |
| 79 | #endif |
| 80 | |
[email protected] | ab6df3b1 | 2013-12-24 23:32:26 | [diff] [blame] | 81 | using base::ASCIIToUTF16; |
| 82 | using base::UTF8ToUTF16; |
[email protected] | f729d7a | 2013-12-26 07:07:56 | [diff] [blame] | 83 | using base::UTF16ToUTF8; |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 84 | using content::BrowserThread; |
estark | d9e54fb | 2016-01-11 19:37:12 | [diff] [blame] | 85 | using security_state::SecurityStateModel; |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 86 | |
| 87 | namespace { |
| 88 | |
jww | 1ed8ea7 | 2014-09-02 20:43:25 | [diff] [blame] | 89 | // Events for UMA. Do not reorder or change! |
| 90 | enum SSLCertificateDecisionsDidRevoke { |
| 91 | USER_CERT_DECISIONS_NOT_REVOKED = 0, |
| 92 | USER_CERT_DECISIONS_REVOKED, |
| 93 | END_OF_SSL_CERTIFICATE_DECISIONS_DID_REVOKE_ENUM |
| 94 | }; |
| 95 | |
palmer | 0da10b3 | 2015-02-11 00:42:19 | [diff] [blame] | 96 | // The list of content settings types to display on the Website Settings UI. THE |
| 97 | // ORDER OF THESE ITEMS IS IMPORTANT. To propose changing it, email |
| 98 | // [email protected]. |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 99 | ContentSettingsType kPermissionType[] = { |
sashab | 2b2a314f | 2015-01-17 06:42:21 | [diff] [blame] | 100 | CONTENT_SETTINGS_TYPE_GEOLOCATION, |
sashab | 2b2a314f | 2015-01-17 06:42:21 | [diff] [blame] | 101 | CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
| 102 | CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, |
palmer | 0da10b3 | 2015-02-11 00:42:19 | [diff] [blame] | 103 | CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
benwells | a68ed4b | 2014-11-13 03:25:36 | [diff] [blame] | 104 | #if defined(OS_ANDROID) |
sashab | 2b2a314f | 2015-01-17 06:42:21 | [diff] [blame] | 105 | CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, |
benwells | a68ed4b | 2014-11-13 03:25:36 | [diff] [blame] | 106 | #endif |
palmer | 7715e33 | 2016-05-27 00:41:19 | [diff] [blame] | 107 | CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
lshang | e085f20 | 2016-06-14 01:25:08 | [diff] [blame^] | 108 | #if !defined(OS_ANDROID) |
palmer | 7715e33 | 2016-05-27 00:41:19 | [diff] [blame] | 109 | CONTENT_SETTINGS_TYPE_PLUGINS, |
| 110 | CONTENT_SETTINGS_TYPE_IMAGES, |
lshang | e085f20 | 2016-06-14 01:25:08 | [diff] [blame^] | 111 | #endif |
palmer | 7715e33 | 2016-05-27 00:41:19 | [diff] [blame] | 112 | CONTENT_SETTINGS_TYPE_POPUPS, |
nsatragno | 670fe92 | 2016-04-08 14:10:50 | [diff] [blame] | 113 | CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, |
palmer | 7715e33 | 2016-05-27 00:41:19 | [diff] [blame] | 114 | CONTENT_SETTINGS_TYPE_KEYGEN, |
| 115 | CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, |
lshang | e085f20 | 2016-06-14 01:25:08 | [diff] [blame^] | 116 | #if !defined(OS_ANDROID) |
palmer | 7715e33 | 2016-05-27 00:41:19 | [diff] [blame] | 117 | CONTENT_SETTINGS_TYPE_MOUSELOCK, |
lshang | e085f20 | 2016-06-14 01:25:08 | [diff] [blame^] | 118 | #endif |
palmer | 7715e33 | 2016-05-27 00:41:19 | [diff] [blame] | 119 | CONTENT_SETTINGS_TYPE_FULLSCREEN, |
| 120 | CONTENT_SETTINGS_TYPE_MIDI_SYSEX, |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 121 | }; |
| 122 | |
mgiuca | a319f21 | 2016-01-14 03:30:11 | [diff] [blame] | 123 | // Determines whether to show permission |type| in the Website Settings UI. Only |
| 124 | // applies to permissions listed in |kPermissionType|. |
| 125 | bool ShouldShowPermission(ContentSettingsType type) { |
mgiuca | 0f3e1f7 | 2016-05-13 01:56:27 | [diff] [blame] | 126 | // TODO(mgiuca): When simplified-fullscreen-ui is enabled permanently on |
| 127 | // Android, remove these from kPermissionType, rather than having this check |
mgiuca | a319f21 | 2016-01-14 03:30:11 | [diff] [blame] | 128 | // (http://crbug.com/577396). |
| 129 | #if !defined(OS_ANDROID) |
mgiuca | 0f3e1f7 | 2016-05-13 01:56:27 | [diff] [blame] | 130 | // Fullscreen and mouselock settings are no longer shown (always allow). |
mgiuca | a319f21 | 2016-01-14 03:30:11 | [diff] [blame] | 131 | if (type == CONTENT_SETTINGS_TYPE_FULLSCREEN || |
| 132 | type == CONTENT_SETTINGS_TYPE_MOUSELOCK) { |
mgiuca | 0f3e1f7 | 2016-05-13 01:56:27 | [diff] [blame] | 133 | return false; |
mgiuca | a319f21 | 2016-01-14 03:30:11 | [diff] [blame] | 134 | } |
| 135 | #endif |
| 136 | |
| 137 | return true; |
| 138 | } |
| 139 | |
estark | 134a982 | 2015-10-29 04:35:18 | [diff] [blame] | 140 | // Returns true if any of the given statuses match |status|. |
| 141 | bool CertificateTransparencyStatusMatchAny( |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 142 | const std::vector<net::ct::SCTVerifyStatus>& sct_verify_statuses, |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 143 | net::ct::SCTVerifyStatus status) { |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 144 | for (const auto& verify_status : sct_verify_statuses) { |
| 145 | if (verify_status == status) |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 146 | return true; |
| 147 | } |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 148 | return false; |
| 149 | } |
| 150 | |
| 151 | int GetSiteIdentityDetailsMessageByCTInfo( |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 152 | const std::vector<net::ct::SCTVerifyStatus>& sct_verify_statuses, |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 153 | bool is_ev) { |
| 154 | // No SCTs - no CT information. |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 155 | if (sct_verify_statuses.empty()) |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 156 | return (is_ev ? IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV_NO_CT |
| 157 | : IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_NO_CT); |
| 158 | |
estark | 134a982 | 2015-10-29 04:35:18 | [diff] [blame] | 159 | // Any valid SCT. |
| 160 | if (CertificateTransparencyStatusMatchAny(sct_verify_statuses, |
| 161 | net::ct::SCT_STATUS_OK)) |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 162 | return (is_ev ? IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV_CT_VERIFIED |
| 163 | : IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_CT_VERIFIED); |
| 164 | |
estark | 134a982 | 2015-10-29 04:35:18 | [diff] [blame] | 165 | // Any invalid SCT. |
| 166 | if (CertificateTransparencyStatusMatchAny(sct_verify_statuses, |
| 167 | net::ct::SCT_STATUS_INVALID)) |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 168 | return (is_ev ? IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV_CT_INVALID |
| 169 | : IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_CT_INVALID); |
| 170 | |
estark | 134a982 | 2015-10-29 04:35:18 | [diff] [blame] | 171 | // All SCTs are from unknown logs. |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 172 | return (is_ev ? IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV_CT_UNVERIFIED |
| 173 | : IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_CT_UNVERIFIED); |
| 174 | } |
| 175 | |
| 176 | // This function will return SITE_IDENTITY_STATUS_CERT or |
estark | 134a982 | 2015-10-29 04:35:18 | [diff] [blame] | 177 | // SITE_IDENTITY_STATUS_EV_CERT depending on |is_ev| unless all SCTs |
| 178 | // failed verification, in which case it will return |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 179 | // SITE_IDENTITY_STATUS_ERROR. |
| 180 | WebsiteSettings::SiteIdentityStatus GetSiteIdentityStatusByCTInfo( |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 181 | const std::vector<net::ct::SCTVerifyStatus>& sct_verify_statuses, |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 182 | bool is_ev) { |
estark | 134a982 | 2015-10-29 04:35:18 | [diff] [blame] | 183 | if (sct_verify_statuses.empty() || |
| 184 | CertificateTransparencyStatusMatchAny(sct_verify_statuses, |
| 185 | net::ct::SCT_STATUS_OK)) |
| 186 | return is_ev ? WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT |
| 187 | : WebsiteSettings::SITE_IDENTITY_STATUS_CERT; |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 188 | |
estark | 134a982 | 2015-10-29 04:35:18 | [diff] [blame] | 189 | return WebsiteSettings::SITE_IDENTITY_STATUS_CT_ERROR; |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 190 | } |
| 191 | |
jshin | 1fb7646 | 2016-04-05 22:13:03 | [diff] [blame] | 192 | base::string16 GetSimpleSiteName(const GURL& url) { |
benwells | 2337b810 | 2016-04-20 01:53:53 | [diff] [blame] | 193 | return url_formatter::FormatUrlForSecurityDisplay( |
| 194 | url, url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS); |
palmer | 153af98 | 2015-09-15 02:04:19 | [diff] [blame] | 195 | } |
| 196 | |
reillyg | 85f57db | 2016-01-12 23:14:38 | [diff] [blame] | 197 | ChooserContextBase* GetUsbChooserContext(Profile* profile) { |
| 198 | return UsbChooserContextFactory::GetForProfile(profile); |
| 199 | } |
| 200 | |
| 201 | // The list of chooser types that need to display entries in the Website |
| 202 | // Settings UI. THE ORDER OF THESE ITEMS IS IMPORTANT. To propose changing it, |
| 203 | // email [email protected]. |
| 204 | WebsiteSettings::ChooserUIInfo kChooserUIInfo[] = { |
| 205 | {&GetUsbChooserContext, IDR_BLOCKED_USB, IDR_ALLOWED_USB, |
| 206 | IDS_WEBSITE_SETTINGS_USB_DEVICE_LABEL, |
| 207 | IDS_WEBSITE_SETTINGS_DELETE_USB_DEVICE, "name"}, |
| 208 | }; |
| 209 | |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 210 | } // namespace |
| 211 | |
| 212 | WebsiteSettings::WebsiteSettings( |
| 213 | WebsiteSettingsUI* ui, |
| 214 | Profile* profile, |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 215 | TabSpecificContentSettings* tab_specific_content_settings, |
palmer | f2cba0d | 2015-08-27 23:15:06 | [diff] [blame] | 216 | content::WebContents* web_contents, |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 217 | const GURL& url, |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 218 | const SecurityStateModel::SecurityInfo& security_info, |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 219 | content::CertStore* cert_store) |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 220 | : TabSpecificContentSettings::SiteDataObserver( |
| 221 | tab_specific_content_settings), |
| 222 | ui_(ui), |
pkasting | acd1e12 | 2016-05-19 23:55:10 | [diff] [blame] | 223 | #if !defined(OS_ANDROID) |
palmer | f2cba0d | 2015-08-27 23:15:06 | [diff] [blame] | 224 | web_contents_(web_contents), |
pkasting | acd1e12 | 2016-05-19 23:55:10 | [diff] [blame] | 225 | #endif |
[email protected] | 66f15731 | 2012-08-01 13:50:26 | [diff] [blame] | 226 | show_info_bar_(false), |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 227 | site_url_(url), |
| 228 | site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), |
[email protected] | f61c1ce | 2012-05-09 13:55:11 | [diff] [blame] | 229 | cert_id_(0), |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 230 | site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 231 | cert_store_(cert_store), |
peconn | 5100d43 | 2015-09-16 12:03:08 | [diff] [blame] | 232 | content_settings_(HostContentSettingsMapFactory::GetForProfile(profile)), |
[email protected] | 71cd5ef | 2014-08-13 21:22:04 | [diff] [blame] | 233 | chrome_ssl_host_state_delegate_( |
jww | 1ed8ea7 | 2014-09-02 20:43:25 | [diff] [blame] | 234 | ChromeSSLHostStateDelegateFactory::GetForProfile(profile)), |
palmer | 153af98 | 2015-09-15 02:04:19 | [diff] [blame] | 235 | did_revoke_user_ssl_decisions_(false), |
| 236 | profile_(profile) { |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 237 | Init(url, security_info); |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 238 | |
| 239 | PresentSitePermissions(); |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 240 | PresentSiteData(); |
[email protected] | 24c8818c | 2012-04-25 09:57:41 | [diff] [blame] | 241 | PresentSiteIdentity(); |
[email protected] | e22d64f | 2012-09-10 09:03:23 | [diff] [blame] | 242 | |
| 243 | // Every time the Website Settings UI is opened a |WebsiteSettings| object is |
| 244 | // created. So this counts how ofter the Website Settings UI is opened. |
lgarron | 04a9350 | 2014-11-04 22:25:04 | [diff] [blame] | 245 | RecordWebsiteSettingsAction(WEBSITE_SETTINGS_OPENED); |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 246 | } |
| 247 | |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 248 | WebsiteSettings::~WebsiteSettings() { |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 249 | } |
| 250 | |
lgarron | 04a9350 | 2014-11-04 22:25:04 | [diff] [blame] | 251 | void WebsiteSettings::RecordWebsiteSettingsAction( |
| 252 | WebsiteSettingsAction action) { |
| 253 | UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action", |
| 254 | action, |
| 255 | WEBSITE_SETTINGS_COUNT); |
| 256 | |
| 257 | // Use a separate histogram to record actions if they are done on a page with |
| 258 | // an HTTPS URL. Note that this *disregards* security status. |
palmer | ee0e5af | 2015-06-05 03:10:40 | [diff] [blame] | 259 | // |
| 260 | |
| 261 | // TODO(palmer): Consider adding a new histogram for |
| 262 | // GURL::SchemeIsCryptographic. (We don't want to replace this call with a |
| 263 | // call to that function because we don't want to change the meanings of |
| 264 | // existing metrics.) This would inform the decision to mark non-secure |
| 265 | // origins as Dubious or Non-Secure; the overall bug for that is |
| 266 | // crbug.com/454579. |
lgarron | 04a9350 | 2014-11-04 22:25:04 | [diff] [blame] | 267 | if (site_url_.SchemeIs(url::kHttpsScheme)) { |
| 268 | UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action.HttpsUrl", |
| 269 | action, |
| 270 | WEBSITE_SETTINGS_COUNT); |
| 271 | } |
| 272 | } |
| 273 | |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 274 | void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, |
| 275 | ContentSetting setting) { |
[email protected] | e22d64f | 2012-09-10 09:03:23 | [diff] [blame] | 276 | // Count how often a permission for a specific content type is changed using |
| 277 | // the Website Settings UI. |
raymes | 4a13d43 | 2015-09-08 00:44:07 | [diff] [blame] | 278 | size_t num_values; |
| 279 | int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); |
sashab | 9debecd | 2014-12-18 04:15:56 | [diff] [blame] | 280 | UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.OriginInfo.PermissionChanged", |
raymes | 4a13d43 | 2015-09-08 00:44:07 | [diff] [blame] | 281 | histogram_value, num_values); |
sashab | 9debecd | 2014-12-18 04:15:56 | [diff] [blame] | 282 | |
| 283 | if (setting == ContentSetting::CONTENT_SETTING_ALLOW) { |
| 284 | UMA_HISTOGRAM_ENUMERATION( |
| 285 | "WebsiteSettings.OriginInfo.PermissionChanged.Allowed", histogram_value, |
raymes | 4a13d43 | 2015-09-08 00:44:07 | [diff] [blame] | 286 | num_values); |
sashab | 9debecd | 2014-12-18 04:15:56 | [diff] [blame] | 287 | } else if (setting == ContentSetting::CONTENT_SETTING_BLOCK) { |
| 288 | UMA_HISTOGRAM_ENUMERATION( |
| 289 | "WebsiteSettings.OriginInfo.PermissionChanged.Blocked", histogram_value, |
raymes | 4a13d43 | 2015-09-08 00:44:07 | [diff] [blame] | 290 | num_values); |
jialiul | 02aad2d | 2015-04-01 18:56:03 | [diff] [blame] | 291 | // Trigger Rappor sampling if it is a permission revoke action. |
tsergeant | aa3dab665 | 2016-04-05 08:14:11 | [diff] [blame] | 292 | // TODO(tsergeant): Integrate this with the revocation recording performed |
| 293 | // in the permissions layer. See crbug.com/469221. |
tsergeant | f1e8935 | 2016-01-15 20:34:54 | [diff] [blame] | 294 | content::PermissionType permission_type; |
| 295 | if (PermissionUtil::GetPermissionType(type, &permission_type)) { |
| 296 | PermissionUmaUtil::PermissionRevoked(permission_type, |
| 297 | this->site_url_); |
jialiul | 02aad2d | 2015-04-01 18:56:03 | [diff] [blame] | 298 | } |
sashab | 9debecd | 2014-12-18 04:15:56 | [diff] [blame] | 299 | } |
[email protected] | e22d64f | 2012-09-10 09:03:23 | [diff] [blame] | 300 | |
lgarron | 04a9350 | 2014-11-04 22:25:04 | [diff] [blame] | 301 | // This is technically redundant given the histogram above, but putting the |
| 302 | // total count of permission changes in another histogram makes it easier to |
| 303 | // compare it against other kinds of actions in WebsiteSettings[PopupView]. |
| 304 | RecordWebsiteSettingsAction(WEBSITE_SETTINGS_CHANGED_PERMISSION); |
| 305 | |
raymes | fbaaaaa | 2015-11-10 02:20:40 | [diff] [blame] | 306 | content_settings_->SetNarrowestContentSetting(site_url_, site_url_, type, |
| 307 | setting); |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 308 | |
[email protected] | 66f15731 | 2012-08-01 13:50:26 | [diff] [blame] | 309 | show_info_bar_ = true; |
[email protected] | 2f45d54 | 2012-08-22 08:47:24 | [diff] [blame] | 310 | |
[email protected] | 2f45d54 | 2012-08-22 08:47:24 | [diff] [blame] | 311 | // Refresh the UI to reflect the new setting. |
| 312 | PresentSitePermissions(); |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 313 | } |
| 314 | |
reillyg | 85f57db | 2016-01-12 23:14:38 | [diff] [blame] | 315 | void WebsiteSettings::OnSiteChosenObjectDeleted( |
| 316 | const ChooserUIInfo& ui_info, |
| 317 | const base::DictionaryValue& object) { |
| 318 | // TODO(reillyg): Create metrics for revocations. crbug.com/556845 |
| 319 | ChooserContextBase* context = ui_info.get_context(profile_); |
reillyg | 36a7fab3 | 2016-01-28 19:15:10 | [diff] [blame] | 320 | const GURL origin = site_url_.GetOrigin(); |
| 321 | context->RevokeObjectPermission(origin, origin, object); |
reillyg | 85f57db | 2016-01-12 23:14:38 | [diff] [blame] | 322 | |
| 323 | show_info_bar_ = true; |
| 324 | |
| 325 | // Refresh the UI to reflect the changed settings. |
| 326 | PresentSitePermissions(); |
| 327 | } |
| 328 | |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 329 | void WebsiteSettings::OnSiteDataAccessed() { |
| 330 | PresentSiteData(); |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 331 | } |
| 332 | |
[email protected] | 66f15731 | 2012-08-01 13:50:26 | [diff] [blame] | 333 | void WebsiteSettings::OnUIClosing() { |
estade | 3feb83f | 2015-09-01 23:00:49 | [diff] [blame] | 334 | #if defined(OS_ANDROID) |
| 335 | NOTREACHED(); |
| 336 | #else |
palmer | f2cba0d | 2015-08-27 23:15:06 | [diff] [blame] | 337 | if (show_info_bar_ && web_contents_) { |
| 338 | InfoBarService* infobar_service = |
| 339 | InfoBarService::FromWebContents(web_contents_); |
| 340 | if (infobar_service) |
| 341 | WebsiteSettingsInfoBarDelegate::Create(infobar_service); |
| 342 | } |
jww | 1ed8ea7 | 2014-09-02 20:43:25 | [diff] [blame] | 343 | |
| 344 | SSLCertificateDecisionsDidRevoke user_decision = |
| 345 | did_revoke_user_ssl_decisions_ ? USER_CERT_DECISIONS_REVOKED |
| 346 | : USER_CERT_DECISIONS_NOT_REVOKED; |
| 347 | |
| 348 | UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.did_user_revoke_decisions", |
| 349 | user_decision, |
| 350 | END_OF_SSL_CERTIFICATE_DECISIONS_DID_REVOKE_ENUM); |
estade | 3feb83f | 2015-09-01 23:00:49 | [diff] [blame] | 351 | #endif |
jww | 1ed8ea7 | 2014-09-02 20:43:25 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | void WebsiteSettings::OnRevokeSSLErrorBypassButtonPressed() { |
| 355 | DCHECK(chrome_ssl_host_state_delegate_); |
jww | 6a55df7 | 2014-09-05 19:59:29 | [diff] [blame] | 356 | chrome_ssl_host_state_delegate_->RevokeUserAllowExceptionsHard( |
| 357 | site_url().host()); |
jww | 1ed8ea7 | 2014-09-02 20:43:25 | [diff] [blame] | 358 | did_revoke_user_ssl_decisions_ = true; |
[email protected] | 66f15731 | 2012-08-01 13:50:26 | [diff] [blame] | 359 | } |
| 360 | |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 361 | void WebsiteSettings::Init( |
| 362 | const GURL& url, |
| 363 | const SecurityStateModel::SecurityInfo& security_info) { |
sashab | 97894ce | 2014-10-22 10:08:33 | [diff] [blame] | 364 | bool isChromeUINativeScheme = false; |
sievers | 2f1e811 | 2015-12-04 18:43:56 | [diff] [blame] | 365 | #if BUILDFLAG(ANDROID_JAVA_UI) |
sashab | 97894ce | 2014-10-22 10:08:33 | [diff] [blame] | 366 | isChromeUINativeScheme = url.SchemeIs(chrome::kChromeUINativeScheme); |
| 367 | #endif |
| 368 | |
upendrag.gowda | 60886a6e | 2015-10-31 05:51:09 | [diff] [blame] | 369 | if (url.SchemeIs(url::kAboutScheme)) { |
| 370 | // All about: URLs except about:blank are redirected. |
| 371 | DCHECK_EQ(url::kAboutBlankURL, url.spec()); |
| 372 | site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; |
| 373 | site_identity_details_ = |
| 374 | l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY); |
| 375 | site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; |
| 376 | site_connection_details_ = l10n_util::GetStringFUTF16( |
| 377 | IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
| 378 | UTF8ToUTF16(url.spec())); |
| 379 | return; |
| 380 | } |
| 381 | |
| 382 | if (url.SchemeIs(content::kChromeUIScheme) || isChromeUINativeScheme) { |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 383 | site_identity_status_ = SITE_IDENTITY_STATUS_INTERNAL_PAGE; |
| 384 | site_identity_details_ = |
| 385 | l10n_util::GetStringUTF16(IDS_PAGE_INFO_INTERNAL_PAGE); |
| 386 | site_connection_status_ = SITE_CONNECTION_STATUS_INTERNAL_PAGE; |
| 387 | return; |
| 388 | } |
| 389 | |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 390 | // Identity section. |
palmer | 153af98 | 2015-09-15 02:04:19 | [diff] [blame] | 391 | scoped_refptr<net::X509Certificate> cert; |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 392 | cert_id_ = security_info.cert_id; |
[email protected] | f61c1ce | 2012-05-09 13:55:11 | [diff] [blame] | 393 | |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 394 | // HTTPS with no or minor errors. |
| 395 | if (security_info.cert_id && |
| 396 | cert_store_->RetrieveCert(security_info.cert_id, &cert) && |
| 397 | (!net::IsCertStatusError(security_info.cert_status) || |
| 398 | net::IsCertStatusMinorError(security_info.cert_status))) { |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 399 | // There are no major errors. Check for minor errors. |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 400 | if (security_info.security_level == |
| 401 | SecurityStateModel::SECURITY_POLICY_WARNING) { |
[email protected] | eaf3f32 | 2013-04-25 21:53:59 | [diff] [blame] | 402 | site_identity_status_ = SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT; |
[email protected] | 24a9f1c9 | 2013-11-13 12:33:37 | [diff] [blame] | 403 | site_identity_details_ = l10n_util::GetStringFUTF16( |
| 404 | IDS_CERT_POLICY_PROVIDED_CERT_MESSAGE, UTF8ToUTF16(url.host())); |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 405 | } else if (net::IsCertStatusMinorError(security_info.cert_status)) { |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 406 | site_identity_status_ = SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN; |
[email protected] | a04db82 | 2013-12-11 19:14:40 | [diff] [blame] | 407 | base::string16 issuer_name(UTF8ToUTF16(cert->issuer().GetDisplayName())); |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 408 | if (issuer_name.empty()) { |
| 409 | issuer_name.assign(l10n_util::GetStringUTF16( |
| 410 | IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
| 411 | } |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 412 | |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 413 | site_identity_details_.assign(l10n_util::GetStringFUTF16( |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 414 | GetSiteIdentityDetailsMessageByCTInfo( |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 415 | security_info.sct_verify_statuses, false /* not EV */), |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 416 | issuer_name)); |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 417 | |
| 418 | site_identity_details_ += ASCIIToUTF16("\n\n"); |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 419 | if (security_info.cert_status & |
| 420 | net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION) { |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 421 | site_identity_details_ += l10n_util::GetStringUTF16( |
| 422 | IDS_PAGE_INFO_SECURITY_TAB_UNABLE_TO_CHECK_REVOCATION); |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 423 | } else if (security_info.cert_status & |
| 424 | net::CERT_STATUS_NO_REVOCATION_MECHANISM) { |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 425 | site_identity_details_ += l10n_util::GetStringUTF16( |
| 426 | IDS_PAGE_INFO_SECURITY_TAB_NO_REVOCATION_MECHANISM); |
| 427 | } else { |
| 428 | NOTREACHED() << "Need to specify string for this warning"; |
| 429 | } |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 430 | } else { |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 431 | if (security_info.cert_status & net::CERT_STATUS_IS_EV) { |
rsleevi | 4f801272 | 2014-09-30 01:28:01 | [diff] [blame] | 432 | // EV HTTPS page. |
| 433 | site_identity_status_ = GetSiteIdentityStatusByCTInfo( |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 434 | security_info.sct_verify_statuses, true); |
rsleevi | 4f801272 | 2014-09-30 01:28:01 | [diff] [blame] | 435 | DCHECK(!cert->subject().organization_names.empty()); |
| 436 | organization_name_ = UTF8ToUTF16(cert->subject().organization_names[0]); |
| 437 | // An EV Cert is required to have a city (localityName) and country but |
| 438 | // state is "if any". |
| 439 | DCHECK(!cert->subject().locality_name.empty()); |
| 440 | DCHECK(!cert->subject().country_name.empty()); |
| 441 | base::string16 locality; |
| 442 | if (!cert->subject().state_or_province_name.empty()) { |
| 443 | locality = l10n_util::GetStringFUTF16( |
| 444 | IDS_PAGEINFO_ADDRESS, |
| 445 | UTF8ToUTF16(cert->subject().locality_name), |
| 446 | UTF8ToUTF16(cert->subject().state_or_province_name), |
| 447 | UTF8ToUTF16(cert->subject().country_name)); |
| 448 | } else { |
| 449 | locality = l10n_util::GetStringFUTF16( |
| 450 | IDS_PAGEINFO_PARTIAL_ADDRESS, |
| 451 | UTF8ToUTF16(cert->subject().locality_name), |
| 452 | UTF8ToUTF16(cert->subject().country_name)); |
| 453 | } |
| 454 | DCHECK(!cert->subject().organization_names.empty()); |
| 455 | site_identity_details_.assign(l10n_util::GetStringFUTF16( |
| 456 | GetSiteIdentityDetailsMessageByCTInfo( |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 457 | security_info.sct_verify_statuses, true /* is EV */), |
| 458 | UTF8ToUTF16(cert->subject().organization_names[0]), locality, |
rsleevi | 4f801272 | 2014-09-30 01:28:01 | [diff] [blame] | 459 | UTF8ToUTF16(cert->issuer().GetDisplayName()))); |
| 460 | } else { |
| 461 | // Non-EV OK HTTPS page. |
| 462 | site_identity_status_ = GetSiteIdentityStatusByCTInfo( |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 463 | security_info.sct_verify_statuses, false); |
rsleevi | 4f801272 | 2014-09-30 01:28:01 | [diff] [blame] | 464 | base::string16 issuer_name( |
| 465 | UTF8ToUTF16(cert->issuer().GetDisplayName())); |
| 466 | if (issuer_name.empty()) { |
| 467 | issuer_name.assign(l10n_util::GetStringUTF16( |
| 468 | IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
| 469 | } |
[email protected] | 94c74b4 | 2013-12-02 15:19:49 | [diff] [blame] | 470 | |
rsleevi | 4f801272 | 2014-09-30 01:28:01 | [diff] [blame] | 471 | site_identity_details_.assign(l10n_util::GetStringFUTF16( |
| 472 | GetSiteIdentityDetailsMessageByCTInfo( |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 473 | security_info.sct_verify_statuses, false /* not EV */), |
rsleevi | 4f801272 | 2014-09-30 01:28:01 | [diff] [blame] | 474 | issuer_name)); |
| 475 | } |
lgarron | cc53de2 | 2015-10-05 23:03:17 | [diff] [blame] | 476 | switch (security_info.sha1_deprecation_status) { |
| 477 | case SecurityStateModel::DEPRECATED_SHA1_MINOR: |
| 478 | site_identity_status_ = |
| 479 | SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MINOR; |
| 480 | site_identity_details_ += |
| 481 | UTF8ToUTF16("\n\n") + |
| 482 | l10n_util::GetStringUTF16( |
| 483 | IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM_MINOR); |
| 484 | break; |
| 485 | case SecurityStateModel::DEPRECATED_SHA1_MAJOR: |
| 486 | site_identity_status_ = |
| 487 | SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MAJOR; |
| 488 | site_identity_details_ += |
| 489 | UTF8ToUTF16("\n\n") + |
| 490 | l10n_util::GetStringUTF16( |
| 491 | IDS_PAGE_INFO_SECURITY_TAB_DEPRECATED_SIGNATURE_ALGORITHM_MAJOR); |
| 492 | break; |
| 493 | case SecurityStateModel::NO_DEPRECATED_SHA1: |
| 494 | // Nothing to do. |
| 495 | break; |
rsleevi | 4f801272 | 2014-09-30 01:28:01 | [diff] [blame] | 496 | } |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 497 | } |
| 498 | } else { |
| 499 | // HTTP or HTTPS with errors (not warnings). |
| 500 | site_identity_details_.assign(l10n_util::GetStringUTF16( |
| 501 | IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 502 | if (!security_info.scheme_is_cryptographic || !security_info.cert_id) |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 503 | site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; |
| 504 | else |
| 505 | site_identity_status_ = SITE_IDENTITY_STATUS_ERROR; |
| 506 | |
[email protected] | a04db82 | 2013-12-11 19:14:40 | [diff] [blame] | 507 | const base::string16 bullet = UTF8ToUTF16("\n • "); |
felt | 2493b445 | 2015-09-17 20:33:59 | [diff] [blame] | 508 | std::vector<ssl_errors::ErrorInfo> errors; |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 509 | ssl_errors::ErrorInfo::GetErrorsForCertStatus( |
| 510 | cert, security_info.cert_status, url, &errors); |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 511 | for (size_t i = 0; i < errors.size(); ++i) { |
| 512 | site_identity_details_ += bullet; |
| 513 | site_identity_details_ += errors[i].short_description(); |
| 514 | } |
| 515 | |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 516 | if (security_info.cert_status & net::CERT_STATUS_NON_UNIQUE_NAME) { |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 517 | site_identity_details_ += ASCIIToUTF16("\n\n"); |
| 518 | site_identity_details_ += l10n_util::GetStringUTF16( |
| 519 | IDS_PAGE_INFO_SECURITY_TAB_NON_UNIQUE_NAME); |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | // Site Connection |
| 524 | // We consider anything less than 80 bits encryption to be weak encryption. |
| 525 | // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and |
| 526 | // weakly encrypted connections. |
| 527 | site_connection_status_ = SITE_CONNECTION_STATUS_UNKNOWN; |
| 528 | |
jshin | 1fb7646 | 2016-04-05 22:13:03 | [diff] [blame] | 529 | base::string16 subject_name(GetSimpleSiteName(url)); |
palmer | 153af98 | 2015-09-15 02:04:19 | [diff] [blame] | 530 | if (subject_name.empty()) { |
| 531 | subject_name.assign( |
| 532 | l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
| 533 | } |
| 534 | |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 535 | if (!security_info.cert_id || !security_info.scheme_is_cryptographic) { |
| 536 | // Page is still loading (so SSL status is not yet available) or |
| 537 | // loaded over HTTP or loaded over HTTPS with no cert. |
[email protected] | 1c1051d | 2014-05-10 11:39:58 | [diff] [blame] | 538 | site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; |
| 539 | |
| 540 | site_connection_details_.assign(l10n_util::GetStringFUTF16( |
| 541 | IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
| 542 | subject_name)); |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 543 | } else if (security_info.security_bits < 0) { |
| 544 | // Security strength is unknown. Say nothing. |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 545 | site_connection_status_ = SITE_CONNECTION_STATUS_ENCRYPTED_ERROR; |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 546 | } else if (security_info.security_bits == 0) { |
| 547 | DCHECK_NE(security_info.security_level, SecurityStateModel::NONE); |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 548 | site_connection_status_ = SITE_CONNECTION_STATUS_ENCRYPTED_ERROR; |
| 549 | site_connection_details_.assign(l10n_util::GetStringFUTF16( |
| 550 | IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
| 551 | subject_name)); |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 552 | } else { |
| 553 | site_connection_status_ = SITE_CONNECTION_STATUS_ENCRYPTED; |
Adam Langley | 71c2b59b | 2014-11-13 00:34:22 | [diff] [blame] | 554 | |
estark | fd5ca02 | 2015-10-29 21:07:55 | [diff] [blame] | 555 | if (security_info.is_secure_protocol_and_ciphersuite) { |
Adam Langley | 71c2b59b | 2014-11-13 00:34:22 | [diff] [blame] | 556 | site_connection_details_.assign(l10n_util::GetStringFUTF16( |
| 557 | IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT, |
| 558 | subject_name)); |
| 559 | } else { |
| 560 | site_connection_details_.assign(l10n_util::GetStringFUTF16( |
| 561 | IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT, |
| 562 | subject_name)); |
| 563 | } |
| 564 | |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 565 | if (security_info.mixed_content_status != |
| 566 | SecurityStateModel::NO_MIXED_CONTENT) { |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 567 | bool ran_insecure_content = |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 568 | (security_info.mixed_content_status == |
| 569 | SecurityStateModel::RAN_MIXED_CONTENT || |
| 570 | security_info.mixed_content_status == |
| 571 | SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT); |
palmer | cc7f5f8c | 2015-09-04 01:02:59 | [diff] [blame] | 572 | site_connection_status_ = ran_insecure_content |
| 573 | ? SITE_CONNECTION_STATUS_MIXED_SCRIPT |
| 574 | : SITE_CONNECTION_STATUS_MIXED_CONTENT; |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 575 | site_connection_details_.assign(l10n_util::GetStringFUTF16( |
| 576 | IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, |
| 577 | site_connection_details_, |
| 578 | l10n_util::GetStringUTF16(ran_insecure_content ? |
| 579 | IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR : |
| 580 | IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING))); |
| 581 | } |
| 582 | } |
| 583 | |
avi | 655876a | 2015-12-25 07:18:15 | [diff] [blame] | 584 | uint16_t cipher_suite = |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 585 | net::SSLConnectionStatusToCipherSuite(security_info.connection_status); |
| 586 | if (security_info.security_bits > 0 && cipher_suite) { |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 587 | int ssl_version = |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 588 | net::SSLConnectionStatusToVersion(security_info.connection_status); |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 589 | const char* ssl_version_str; |
| 590 | net::SSLVersionToString(&ssl_version_str, ssl_version); |
| 591 | site_connection_details_ += ASCIIToUTF16("\n\n"); |
| 592 | site_connection_details_ += l10n_util::GetStringFUTF16( |
| 593 | IDS_PAGE_INFO_SECURITY_TAB_SSL_VERSION, |
| 594 | ASCIIToUTF16(ssl_version_str)); |
| 595 | |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 596 | bool no_renegotiation = |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 597 | (security_info.connection_status & |
| 598 | net::SSL_CONNECTION_NO_RENEGOTIATION_EXTENSION) != 0; |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 599 | const char *key_exchange, *cipher, *mac; |
[email protected] | b6c1d9e8 | 2013-06-12 17:26:57 | [diff] [blame] | 600 | bool is_aead; |
| 601 | net::SSLCipherSuiteToStrings( |
| 602 | &key_exchange, &cipher, &mac, &is_aead, cipher_suite); |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 603 | |
| 604 | site_connection_details_ += ASCIIToUTF16("\n\n"); |
[email protected] | b6c1d9e8 | 2013-06-12 17:26:57 | [diff] [blame] | 605 | if (is_aead) { |
| 606 | site_connection_details_ += l10n_util::GetStringFUTF16( |
| 607 | IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTION_DETAILS_AEAD, |
| 608 | ASCIIToUTF16(cipher), ASCIIToUTF16(key_exchange)); |
| 609 | } else { |
| 610 | site_connection_details_ += l10n_util::GetStringFUTF16( |
| 611 | IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTION_DETAILS, |
| 612 | ASCIIToUTF16(cipher), ASCIIToUTF16(mac), ASCIIToUTF16(key_exchange)); |
| 613 | } |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 614 | |
agl | 078d210 | 2014-10-20 22:03:22 | [diff] [blame] | 615 | if (ssl_version == net::SSL_CONNECTION_VERSION_SSL3 && |
| 616 | site_connection_status_ < SITE_CONNECTION_STATUS_MIXED_CONTENT) { |
| 617 | site_connection_status_ = SITE_CONNECTION_STATUS_ENCRYPTED_ERROR; |
| 618 | } |
| 619 | |
estark | a3121f6b | 2015-09-18 21:15:59 | [diff] [blame] | 620 | const bool did_fallback = (security_info.connection_status & |
| 621 | net::SSL_CONNECTION_VERSION_FALLBACK) != 0; |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 622 | if (did_fallback) { |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 623 | site_connection_details_ += ASCIIToUTF16("\n\n"); |
| 624 | site_connection_details_ += l10n_util::GetStringUTF16( |
| 625 | IDS_PAGE_INFO_SECURITY_TAB_FALLBACK_MESSAGE); |
| 626 | } |
agl | 078d210 | 2014-10-20 22:03:22 | [diff] [blame] | 627 | |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 628 | if (no_renegotiation) { |
| 629 | site_connection_details_ += ASCIIToUTF16("\n\n"); |
| 630 | site_connection_details_ += l10n_util::GetStringUTF16( |
| 631 | IDS_PAGE_INFO_SECURITY_TAB_RENEGOTIATION_MESSAGE); |
| 632 | } |
| 633 | } |
[email protected] | e583f75 | 2012-08-30 13:26:21 | [diff] [blame] | 634 | |
[email protected] | 71cd5ef | 2014-08-13 21:22:04 | [diff] [blame] | 635 | // Check if a user decision has been made to allow or deny certificates with |
| 636 | // errors on this site. |
| 637 | ChromeSSLHostStateDelegate* delegate = |
estark | 7c6bfbf | 2015-09-16 22:20:50 | [diff] [blame] | 638 | ChromeSSLHostStateDelegateFactory::GetForProfile(profile_); |
[email protected] | 71cd5ef | 2014-08-13 21:22:04 | [diff] [blame] | 639 | DCHECK(delegate); |
jww | f806c36 | 2015-06-02 02:00:40 | [diff] [blame] | 640 | // Only show an SSL decision revoke button if the user has chosen to bypass |
| 641 | // SSL host errors for this host in the past. |
| 642 | show_ssl_decision_revoke_button_ = delegate->HasAllowException(url.host()); |
[email protected] | 71cd5ef | 2014-08-13 21:22:04 | [diff] [blame] | 643 | |
palmer | 82b1f7b | 2015-09-17 19:20:41 | [diff] [blame] | 644 | // By default select the Permissions Tab that displays all the site |
| 645 | // permissions. In case of a connection error or an issue with the certificate |
| 646 | // presented by the website, select the Connection Tab to draw the user's |
| 647 | // attention to the issue. If the site does not provide a certificate because |
| 648 | // it was loaded over an unencrypted connection, don't select the Connection |
| 649 | // Tab. |
[email protected] | e583f75 | 2012-08-30 13:26:21 | [diff] [blame] | 650 | WebsiteSettingsUI::TabId tab_id = WebsiteSettingsUI::TAB_ID_PERMISSIONS; |
| 651 | if (site_connection_status_ == SITE_CONNECTION_STATUS_ENCRYPTED_ERROR || |
| 652 | site_connection_status_ == SITE_CONNECTION_STATUS_MIXED_CONTENT || |
estark | f62683e | 2015-09-17 17:52:06 | [diff] [blame] | 653 | site_connection_status_ == SITE_CONNECTION_STATUS_MIXED_SCRIPT || |
[email protected] | e583f75 | 2012-08-30 13:26:21 | [diff] [blame] | 654 | site_identity_status_ == SITE_IDENTITY_STATUS_ERROR || |
estark | 134a982 | 2015-10-29 04:35:18 | [diff] [blame] | 655 | site_identity_status_ == SITE_IDENTITY_STATUS_CT_ERROR || |
[email protected] | eaf3f32 | 2013-04-25 21:53:59 | [diff] [blame] | 656 | site_identity_status_ == SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN || |
rsleevi | 4f801272 | 2014-09-30 01:28:01 | [diff] [blame] | 657 | site_identity_status_ == SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT || |
| 658 | site_identity_status_ == |
lgarron | cc53de2 | 2015-10-05 23:03:17 | [diff] [blame] | 659 | SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MINOR || |
| 660 | site_identity_status_ == |
| 661 | SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM_MAJOR) { |
[email protected] | e583f75 | 2012-08-30 13:26:21 | [diff] [blame] | 662 | tab_id = WebsiteSettingsUI::TAB_ID_CONNECTION; |
lgarron | 04a9350 | 2014-11-04 22:25:04 | [diff] [blame] | 663 | RecordWebsiteSettingsAction( |
| 664 | WEBSITE_SETTINGS_CONNECTION_TAB_SHOWN_IMMEDIATELY); |
| 665 | } |
palmer | 82b1f7b | 2015-09-17 19:20:41 | [diff] [blame] | 666 | |
[email protected] | e583f75 | 2012-08-30 13:26:21 | [diff] [blame] | 667 | ui_->SetSelectedTab(tab_id); |
[email protected] | 03ef4b2a | 2012-03-06 15:04:20 | [diff] [blame] | 668 | } |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 669 | |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 670 | void WebsiteSettings::PresentSitePermissions() { |
| 671 | PermissionInfoList permission_info_list; |
reillyg | 85f57db | 2016-01-12 23:14:38 | [diff] [blame] | 672 | ChosenObjectInfoList chosen_object_info_list; |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 673 | |
| 674 | WebsiteSettingsUI::PermissionInfo permission_info; |
| 675 | for (size_t i = 0; i < arraysize(kPermissionType); ++i) { |
| 676 | permission_info.type = kPermissionType[i]; |
| 677 | |
mgiuca | a319f21 | 2016-01-14 03:30:11 | [diff] [blame] | 678 | if (!ShouldShowPermission(permission_info.type)) |
| 679 | continue; |
| 680 | |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 681 | content_settings::SettingInfo info; |
dcheng | 9603ab9 | 2016-04-08 04:17:32 | [diff] [blame] | 682 | std::unique_ptr<base::Value> value = content_settings_->GetWebsiteSetting( |
| 683 | site_url_, site_url_, permission_info.type, std::string(), &info); |
sashab | 2b2a314f | 2015-01-17 06:42:21 | [diff] [blame] | 684 | DCHECK(value.get()); |
| 685 | if (value->GetType() == base::Value::TYPE_INTEGER) { |
| 686 | permission_info.setting = |
| 687 | content_settings::ValueToContentSetting(value.get()); |
[email protected] | fe4686a | 2012-10-19 15:38:26 | [diff] [blame] | 688 | } else { |
sashab | 2b2a314f | 2015-01-17 06:42:21 | [diff] [blame] | 689 | NOTREACHED(); |
[email protected] | fe4686a | 2012-10-19 15:38:26 | [diff] [blame] | 690 | } |
| 691 | |
[email protected] | 8bdf45c3 | 2012-08-04 00:12:55 | [diff] [blame] | 692 | permission_info.source = info.source; |
johnme | 9ed9388 | 2016-01-15 01:13:28 | [diff] [blame] | 693 | permission_info.is_incognito = profile_->IsOffTheRecord(); |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 694 | |
[email protected] | b1d113d | 2012-06-27 21:27:34 | [diff] [blame] | 695 | if (info.primary_pattern == ContentSettingsPattern::Wildcard() && |
sashab | 2b2a314f | 2015-01-17 06:42:21 | [diff] [blame] | 696 | info.secondary_pattern == ContentSettingsPattern::Wildcard()) { |
[email protected] | b1d113d | 2012-06-27 21:27:34 | [diff] [blame] | 697 | permission_info.default_setting = permission_info.setting; |
| 698 | permission_info.setting = CONTENT_SETTING_DEFAULT; |
| 699 | } else { |
| 700 | permission_info.default_setting = |
| 701 | content_settings_->GetDefaultContentSetting(permission_info.type, |
| 702 | NULL); |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 703 | } |
palmer | 0da10b3 | 2015-02-11 00:42:19 | [diff] [blame] | 704 | |
palmer | 64a09998 | 2016-03-09 21:26:11 | [diff] [blame] | 705 | if (permission_info.type == CONTENT_SETTINGS_TYPE_KEYGEN && |
| 706 | (permission_info.setting == CONTENT_SETTING_DEFAULT || |
| 707 | permission_info.setting == permission_info.default_setting) && |
| 708 | !tab_specific_content_settings()->IsContentBlocked( |
| 709 | permission_info.type)) { |
| 710 | continue; |
palmer | 0da10b3 | 2015-02-11 00:42:19 | [diff] [blame] | 711 | } |
palmer | 64a09998 | 2016-03-09 21:26:11 | [diff] [blame] | 712 | permission_info_list.push_back(permission_info); |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 713 | } |
| 714 | |
reillyg | 85f57db | 2016-01-12 23:14:38 | [diff] [blame] | 715 | for (const ChooserUIInfo& ui_info : kChooserUIInfo) { |
| 716 | ChooserContextBase* context = ui_info.get_context(profile_); |
reillyg | 36a7fab3 | 2016-01-28 19:15:10 | [diff] [blame] | 717 | const GURL origin = site_url_.GetOrigin(); |
| 718 | auto chosen_objects = context->GetGrantedObjects(origin, origin); |
dcheng | 9603ab9 | 2016-04-08 04:17:32 | [diff] [blame] | 719 | for (std::unique_ptr<base::DictionaryValue>& object : chosen_objects) { |
reillyg | 85f57db | 2016-01-12 23:14:38 | [diff] [blame] | 720 | chosen_object_info_list.push_back( |
| 721 | new WebsiteSettingsUI::ChosenObjectInfo(ui_info, std::move(object))); |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | ui_->SetPermissionInfo(permission_info_list, chosen_object_info_list); |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 726 | } |
| 727 | |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 728 | void WebsiteSettings::PresentSiteData() { |
| 729 | CookieInfoList cookie_info_list; |
vabr | d5e30cd | 2014-10-02 11:06:03 | [diff] [blame] | 730 | const LocalSharedObjectsCounter& allowed_objects = |
[email protected] | e0ac3589 | 2012-05-15 12:53:34 | [diff] [blame] | 731 | tab_specific_content_settings()->allowed_local_shared_objects(); |
vabr | d5e30cd | 2014-10-02 11:06:03 | [diff] [blame] | 732 | const LocalSharedObjectsCounter& blocked_objects = |
[email protected] | e0ac3589 | 2012-05-15 12:53:34 | [diff] [blame] | 733 | tab_specific_content_settings()->blocked_local_shared_objects(); |
| 734 | |
| 735 | // Add first party cookie and site data counts. |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 736 | WebsiteSettingsUI::CookieInfo cookie_info; |
[email protected] | e0ac3589 | 2012-05-15 12:53:34 | [diff] [blame] | 737 | cookie_info.allowed = allowed_objects.GetObjectCountForDomain(site_url_); |
| 738 | cookie_info.blocked = blocked_objects.GetObjectCountForDomain(site_url_); |
palmer | b14526492 | 2015-08-28 23:53:15 | [diff] [blame] | 739 | cookie_info.is_first_party = true; |
[email protected] | e0ac3589 | 2012-05-15 12:53:34 | [diff] [blame] | 740 | cookie_info_list.push_back(cookie_info); |
| 741 | |
| 742 | // Add third party cookie counts. |
[email protected] | e0ac3589 | 2012-05-15 12:53:34 | [diff] [blame] | 743 | cookie_info.allowed = allowed_objects.GetObjectCount() - cookie_info.allowed; |
| 744 | cookie_info.blocked = blocked_objects.GetObjectCount() - cookie_info.blocked; |
palmer | b14526492 | 2015-08-28 23:53:15 | [diff] [blame] | 745 | cookie_info.is_first_party = false; |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 746 | cookie_info_list.push_back(cookie_info); |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 747 | |
[email protected] | df81827 | 2012-04-20 13:10:50 | [diff] [blame] | 748 | ui_->SetCookieInfo(cookie_info_list); |
[email protected] | 0b9fdd7 | 2012-04-04 10:00:33 | [diff] [blame] | 749 | } |
[email protected] | 16de6de | 2012-04-04 12:24:14 | [diff] [blame] | 750 | |
[email protected] | 24c8818c | 2012-04-25 09:57:41 | [diff] [blame] | 751 | void WebsiteSettings::PresentSiteIdentity() { |
palmer | f9b680a | 2015-07-09 18:56:04 | [diff] [blame] | 752 | // After initialization the status about the site's connection and its |
| 753 | // identity must be available. |
[email protected] | 24c8818c | 2012-04-25 09:57:41 | [diff] [blame] | 754 | DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); |
| 755 | DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); |
| 756 | WebsiteSettingsUI::IdentityInfo info; |
| 757 | if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT) |
| 758 | info.site_identity = UTF16ToUTF8(organization_name()); |
| 759 | else |
jshin | 1fb7646 | 2016-04-05 22:13:03 | [diff] [blame] | 760 | info.site_identity = UTF16ToUTF8(GetSimpleSiteName(site_url_)); |
[email protected] | 24c8818c | 2012-04-25 09:57:41 | [diff] [blame] | 761 | |
| 762 | info.connection_status = site_connection_status_; |
| 763 | info.connection_status_description = |
| 764 | UTF16ToUTF8(site_connection_details_); |
| 765 | info.identity_status = site_identity_status_; |
| 766 | info.identity_status_description = |
| 767 | UTF16ToUTF8(site_identity_details_); |
[email protected] | f61c1ce | 2012-05-09 13:55:11 | [diff] [blame] | 768 | info.cert_id = cert_id_; |
[email protected] | 71cd5ef | 2014-08-13 21:22:04 | [diff] [blame] | 769 | info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; |
[email protected] | 24c8818c | 2012-04-25 09:57:41 | [diff] [blame] | 770 | ui_->SetIdentityInfo(info); |
| 771 | } |