Chromium Code Reviews| 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 #include "chrome/browser/ui/page_info/website_settings.h" | 5 #include "chrome/browser/ui/page_info/page_info.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/i18n/time_formatting.h" | 14 #include "base/i18n/time_formatting.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 32 #include "chrome/browser/history/history_service_factory.h" | 32 #include "chrome/browser/history/history_service_factory.h" |
| 33 #include "chrome/browser/infobars/infobar_service.h" | 33 #include "chrome/browser/infobars/infobar_service.h" |
| 34 #include "chrome/browser/permissions/chooser_context_base.h" | 34 #include "chrome/browser/permissions/chooser_context_base.h" |
| 35 #include "chrome/browser/permissions/permission_manager.h" | 35 #include "chrome/browser/permissions/permission_manager.h" |
| 36 #include "chrome/browser/permissions/permission_result.h" | 36 #include "chrome/browser/permissions/permission_result.h" |
| 37 #include "chrome/browser/permissions/permission_uma_util.h" | 37 #include "chrome/browser/permissions/permission_uma_util.h" |
| 38 #include "chrome/browser/permissions/permission_util.h" | 38 #include "chrome/browser/permissions/permission_util.h" |
| 39 #include "chrome/browser/profiles/profile.h" | 39 #include "chrome/browser/profiles/profile.h" |
| 40 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" | 40 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
| 41 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" | 41 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" |
| 42 #include "chrome/browser/ui/page_info/website_settings_ui.h" | 42 #include "chrome/browser/ui/page_info/page_info_ui.h" |
| 43 #include "chrome/browser/usb/usb_chooser_context.h" | 43 #include "chrome/browser/usb/usb_chooser_context.h" |
| 44 #include "chrome/browser/usb/usb_chooser_context_factory.h" | 44 #include "chrome/browser/usb/usb_chooser_context_factory.h" |
| 45 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
| 46 #include "chrome/common/url_constants.h" | 46 #include "chrome/common/url_constants.h" |
| 47 #include "chrome/grit/chromium_strings.h" | 47 #include "chrome/grit/chromium_strings.h" |
| 48 #include "chrome/grit/generated_resources.h" | 48 #include "chrome/grit/generated_resources.h" |
| 49 #include "chrome/grit/theme_resources.h" | 49 #include "chrome/grit/theme_resources.h" |
| 50 #include "components/content_settings/core/browser/content_settings_utils.h" | 50 #include "components/content_settings/core/browser/content_settings_utils.h" |
| 51 #include "components/content_settings/core/browser/host_content_settings_map.h" | 51 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 52 #include "components/content_settings/core/common/content_settings.h" | 52 #include "components/content_settings/core/common/content_settings.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 68 #include "third_party/boringssl/src/include/openssl/ssl.h" | 68 #include "third_party/boringssl/src/include/openssl/ssl.h" |
| 69 #include "ui/base/l10n/l10n_util.h" | 69 #include "ui/base/l10n/l10n_util.h" |
| 70 | 70 |
| 71 #if defined(OS_CHROMEOS) | 71 #if defined(OS_CHROMEOS) |
| 72 #include "chrome/browser/chromeos/policy/policy_cert_service.h" | 72 #include "chrome/browser/chromeos/policy/policy_cert_service.h" |
| 73 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" | 73 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 #if !defined(OS_ANDROID) | 76 #if !defined(OS_ANDROID) |
| 77 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" | 77 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
| 78 #include "chrome/browser/ui/page_info/website_settings_infobar_delegate.h" | 78 #include "chrome/browser/ui/page_info/page_info_infobar_delegate.h" |
| 79 #endif | 79 #endif |
| 80 | 80 |
| 81 using base::ASCIIToUTF16; | 81 using base::ASCIIToUTF16; |
| 82 using base::UTF8ToUTF16; | 82 using base::UTF8ToUTF16; |
| 83 using base::UTF16ToUTF8; | 83 using base::UTF16ToUTF8; |
| 84 using content::BrowserThread; | 84 using content::BrowserThread; |
| 85 | 85 |
| 86 namespace { | 86 namespace { |
| 87 | 87 |
| 88 // Events for UMA. Do not reorder or change! | 88 // Events for UMA. Do not reorder or change! |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 if (net::IsCertStatusError(security_info.cert_status) && | 156 if (net::IsCertStatusError(security_info.cert_status) && |
| 157 !net::IsCertStatusMinorError(security_info.cert_status)) { | 157 !net::IsCertStatusMinorError(security_info.cert_status)) { |
| 158 return; | 158 return; |
| 159 } | 159 } |
| 160 CheckContentStatus(security_info.content_with_cert_errors_status, displayed, | 160 CheckContentStatus(security_info.content_with_cert_errors_status, displayed, |
| 161 ran); | 161 ran); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void GetSiteIdentityByMaliciousContentStatus( | 164 void GetSiteIdentityByMaliciousContentStatus( |
| 165 security_state::MaliciousContentStatus malicious_content_status, | 165 security_state::MaliciousContentStatus malicious_content_status, |
| 166 WebsiteSettings::SiteIdentityStatus* status, | 166 PageInfo::SiteIdentityStatus* status, |
| 167 base::string16* details) { | 167 base::string16* details) { |
| 168 switch (malicious_content_status) { | 168 switch (malicious_content_status) { |
| 169 case security_state::MALICIOUS_CONTENT_STATUS_NONE: | 169 case security_state::MALICIOUS_CONTENT_STATUS_NONE: |
| 170 NOTREACHED(); | 170 NOTREACHED(); |
| 171 break; | 171 break; |
| 172 case security_state::MALICIOUS_CONTENT_STATUS_MALWARE: | 172 case security_state::MALICIOUS_CONTENT_STATUS_MALWARE: |
| 173 *status = WebsiteSettings::SITE_IDENTITY_STATUS_MALWARE; | 173 *status = PageInfo::SITE_IDENTITY_STATUS_MALWARE; |
| 174 *details = l10n_util::GetStringUTF16(IDS_PAGEINFO_MALWARE_DETAILS); | 174 *details = l10n_util::GetStringUTF16(IDS_PAGEINFO_MALWARE_DETAILS); |
| 175 break; | 175 break; |
| 176 case security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING: | 176 case security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING: |
| 177 *status = WebsiteSettings::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING; | 177 *status = PageInfo::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING; |
| 178 *details = | 178 *details = |
| 179 l10n_util::GetStringUTF16(IDS_PAGEINFO_SOCIAL_ENGINEERING_DETAILS); | 179 l10n_util::GetStringUTF16(IDS_PAGEINFO_SOCIAL_ENGINEERING_DETAILS); |
| 180 break; | 180 break; |
| 181 case security_state::MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE: | 181 case security_state::MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE: |
| 182 *status = WebsiteSettings::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE; | 182 *status = PageInfo::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE; |
| 183 *details = | 183 *details = |
| 184 l10n_util::GetStringUTF16(IDS_PAGEINFO_UNWANTED_SOFTWARE_DETAILS); | 184 l10n_util::GetStringUTF16(IDS_PAGEINFO_UNWANTED_SOFTWARE_DETAILS); |
| 185 break; | 185 break; |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 base::string16 GetSimpleSiteName(const GURL& url) { | 189 base::string16 GetSimpleSiteName(const GURL& url) { |
| 190 return url_formatter::FormatUrlForSecurityDisplay( | 190 return url_formatter::FormatUrlForSecurityDisplay( |
| 191 url, url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS); | 191 url, url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS); |
| 192 } | 192 } |
| 193 | 193 |
| 194 ChooserContextBase* GetUsbChooserContext(Profile* profile) { | 194 ChooserContextBase* GetUsbChooserContext(Profile* profile) { |
| 195 return UsbChooserContextFactory::GetForProfile(profile); | 195 return UsbChooserContextFactory::GetForProfile(profile); |
| 196 } | 196 } |
| 197 | 197 |
| 198 // The list of chooser types that need to display entries in the Website | 198 // The list of chooser types that need to display entries in the Website |
| 199 // Settings UI. THE ORDER OF THESE ITEMS IS IMPORTANT. To propose changing it, | 199 // Settings UI. THE ORDER OF THESE ITEMS IS IMPORTANT. To propose changing it, |
| 200 // email security-dev@chromium.org. | 200 // email security-dev@chromium.org. |
| 201 WebsiteSettings::ChooserUIInfo kChooserUIInfo[] = { | 201 PageInfo::ChooserUIInfo kChooserUIInfo[] = { |
| 202 {CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, &GetUsbChooserContext, | 202 {CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, &GetUsbChooserContext, |
| 203 IDR_BLOCKED_USB, IDR_ALLOWED_USB, IDS_WEBSITE_SETTINGS_USB_DEVICE_LABEL, | 203 IDR_BLOCKED_USB, IDR_ALLOWED_USB, IDS_WEBSITE_SETTINGS_USB_DEVICE_LABEL, |
| 204 IDS_WEBSITE_SETTINGS_DELETE_USB_DEVICE, "name"}, | 204 IDS_WEBSITE_SETTINGS_DELETE_USB_DEVICE, "name"}, |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 } // namespace | 207 } // namespace |
| 208 | 208 |
| 209 WebsiteSettings::WebsiteSettings( | 209 PageInfo::PageInfo(PageInfoUI* ui, |
| 210 WebsiteSettingsUI* ui, | 210 Profile* profile, |
| 211 Profile* profile, | 211 TabSpecificContentSettings* tab_specific_content_settings, |
| 212 TabSpecificContentSettings* tab_specific_content_settings, | 212 content::WebContents* web_contents, |
| 213 content::WebContents* web_contents, | 213 const GURL& url, |
| 214 const GURL& url, | 214 const security_state::SecurityInfo& security_info) |
| 215 const security_state::SecurityInfo& security_info) | |
| 216 : TabSpecificContentSettings::SiteDataObserver( | 215 : TabSpecificContentSettings::SiteDataObserver( |
| 217 tab_specific_content_settings), | 216 tab_specific_content_settings), |
| 218 content::WebContentsObserver(web_contents), | 217 content::WebContentsObserver(web_contents), |
| 219 ui_(ui), | 218 ui_(ui), |
| 220 show_info_bar_(false), | 219 show_info_bar_(false), |
| 221 site_url_(url), | 220 site_url_(url), |
| 222 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), | 221 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), |
| 223 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), | 222 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), |
| 224 show_ssl_decision_revoke_button_(false), | 223 show_ssl_decision_revoke_button_(false), |
| 225 content_settings_(HostContentSettingsMapFactory::GetForProfile(profile)), | 224 content_settings_(HostContentSettingsMapFactory::GetForProfile(profile)), |
| 226 chrome_ssl_host_state_delegate_( | 225 chrome_ssl_host_state_delegate_( |
| 227 ChromeSSLHostStateDelegateFactory::GetForProfile(profile)), | 226 ChromeSSLHostStateDelegateFactory::GetForProfile(profile)), |
| 228 did_revoke_user_ssl_decisions_(false), | 227 did_revoke_user_ssl_decisions_(false), |
| 229 profile_(profile), | 228 profile_(profile), |
| 230 security_level_(security_state::NONE) { | 229 security_level_(security_state::NONE) { |
| 231 Init(url, security_info); | 230 Init(url, security_info); |
| 232 | 231 |
| 233 PresentSitePermissions(); | 232 PresentSitePermissions(); |
| 234 PresentSiteData(); | 233 PresentSiteData(); |
| 235 PresentSiteIdentity(); | 234 PresentSiteIdentity(); |
| 236 | 235 |
| 237 // Every time the Website Settings UI is opened a |WebsiteSettings| object is | 236 // Every time the Website Settings UI is opened a |PageInfo| object is |
|
estark
2017/03/20 20:19:17
Website Settings => Page Info
| |
| 238 // created. So this counts how ofter the Website Settings UI is opened. | 237 // created. So this counts how ofter the Website Settings UI is opened. |
|
estark
2017/03/20 20:19:17
ditto
| |
| 239 RecordWebsiteSettingsAction(WEBSITE_SETTINGS_OPENED); | 238 RecordPageInfoAction(WEBSITE_SETTINGS_OPENED); |
| 240 } | 239 } |
| 241 | 240 |
| 242 WebsiteSettings::~WebsiteSettings() {} | 241 PageInfo::~PageInfo() {} |
| 243 | 242 |
| 244 void WebsiteSettings::RecordWebsiteSettingsAction( | 243 void PageInfo::RecordPageInfoAction(PageInfoAction action) { |
| 245 WebsiteSettingsAction action) { | |
| 246 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action", action, | 244 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action", action, |
| 247 WEBSITE_SETTINGS_COUNT); | 245 WEBSITE_SETTINGS_COUNT); |
| 248 | 246 |
| 249 std::string histogram_name; | 247 std::string histogram_name; |
| 250 | 248 |
| 251 if (site_url_.SchemeIsCryptographic()) { | 249 if (site_url_.SchemeIsCryptographic()) { |
| 252 if (security_level_ == security_state::SECURE || | 250 if (security_level_ == security_state::SECURE || |
| 253 security_level_ == security_state::EV_SECURE) { | 251 security_level_ == security_state::EV_SECURE) { |
| 254 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Valid", | 252 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Valid", |
| 255 action, WEBSITE_SETTINGS_COUNT); | 253 action, WEBSITE_SETTINGS_COUNT); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 268 action, WEBSITE_SETTINGS_COUNT); | 266 action, WEBSITE_SETTINGS_COUNT); |
| 269 } else if (security_level_ == security_state::DANGEROUS) { | 267 } else if (security_level_ == security_state::DANGEROUS) { |
| 270 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Dangerous", | 268 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Dangerous", |
| 271 action, WEBSITE_SETTINGS_COUNT); | 269 action, WEBSITE_SETTINGS_COUNT); |
| 272 } else { | 270 } else { |
| 273 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Neutral", | 271 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Neutral", |
| 274 action, WEBSITE_SETTINGS_COUNT); | 272 action, WEBSITE_SETTINGS_COUNT); |
| 275 } | 273 } |
| 276 } | 274 } |
| 277 | 275 |
| 278 void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, | 276 void PageInfo::OnSitePermissionChanged(ContentSettingsType type, |
| 279 ContentSetting setting) { | 277 ContentSetting setting) { |
| 280 // Count how often a permission for a specific content type is changed using | 278 // Count how often a permission for a specific content type is changed using |
| 281 // the Website Settings UI. | 279 // the Website Settings UI. |
| 282 size_t num_values; | 280 size_t num_values; |
| 283 int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); | 281 int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); |
| 284 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.OriginInfo.PermissionChanged", | 282 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.OriginInfo.PermissionChanged", |
| 285 histogram_value, num_values); | 283 histogram_value, num_values); |
| 286 | 284 |
| 287 if (setting == ContentSetting::CONTENT_SETTING_ALLOW) { | 285 if (setting == ContentSetting::CONTENT_SETTING_ALLOW) { |
| 288 UMA_HISTOGRAM_ENUMERATION( | 286 UMA_HISTOGRAM_ENUMERATION( |
| 289 "WebsiteSettings.OriginInfo.PermissionChanged.Allowed", histogram_value, | 287 "WebsiteSettings.OriginInfo.PermissionChanged.Allowed", histogram_value, |
| 290 num_values); | 288 num_values); |
| 291 | 289 |
| 292 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { | 290 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { |
| 293 rappor::SampleDomainAndRegistryFromGURL( | 291 rappor::SampleDomainAndRegistryFromGURL( |
| 294 g_browser_process->rappor_service(), | 292 g_browser_process->rappor_service(), |
| 295 "ContentSettings.Plugins.AddedAllowException", site_url_); | 293 "ContentSettings.Plugins.AddedAllowException", site_url_); |
| 296 } | 294 } |
| 297 } else if (setting == ContentSetting::CONTENT_SETTING_BLOCK) { | 295 } else if (setting == ContentSetting::CONTENT_SETTING_BLOCK) { |
| 298 UMA_HISTOGRAM_ENUMERATION( | 296 UMA_HISTOGRAM_ENUMERATION( |
| 299 "WebsiteSettings.OriginInfo.PermissionChanged.Blocked", histogram_value, | 297 "WebsiteSettings.OriginInfo.PermissionChanged.Blocked", histogram_value, |
| 300 num_values); | 298 num_values); |
| 301 } | 299 } |
| 302 | 300 |
| 303 // This is technically redundant given the histogram above, but putting the | 301 // This is technically redundant given the histogram above, but putting the |
| 304 // total count of permission changes in another histogram makes it easier to | 302 // total count of permission changes in another histogram makes it easier to |
| 305 // compare it against other kinds of actions in WebsiteSettings[PopupView]. | 303 // compare it against other kinds of actions in PageInfo[PopupView]. |
| 306 RecordWebsiteSettingsAction(WEBSITE_SETTINGS_CHANGED_PERMISSION); | 304 RecordPageInfoAction(WEBSITE_SETTINGS_CHANGED_PERMISSION); |
| 307 | 305 |
| 308 PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter( | 306 PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter( |
| 309 this->profile_, this->site_url_, this->site_url_, type, | 307 this->profile_, this->site_url_, this->site_url_, type, |
| 310 PermissionSourceUI::OIB); | 308 PermissionSourceUI::OIB); |
| 311 | 309 |
| 312 content_settings_->SetNarrowestContentSetting(site_url_, site_url_, type, | 310 content_settings_->SetNarrowestContentSetting(site_url_, site_url_, type, |
| 313 setting); | 311 setting); |
| 314 | 312 |
| 315 show_info_bar_ = true; | 313 show_info_bar_ = true; |
| 316 | 314 |
| 317 // Refresh the UI to reflect the new setting. | 315 // Refresh the UI to reflect the new setting. |
| 318 PresentSitePermissions(); | 316 PresentSitePermissions(); |
| 319 } | 317 } |
| 320 | 318 |
| 321 void WebsiteSettings::OnSiteChosenObjectDeleted( | 319 void PageInfo::OnSiteChosenObjectDeleted(const ChooserUIInfo& ui_info, |
| 322 const ChooserUIInfo& ui_info, | 320 const base::DictionaryValue& object) { |
| 323 const base::DictionaryValue& object) { | |
| 324 // TODO(reillyg): Create metrics for revocations. crbug.com/556845 | 321 // TODO(reillyg): Create metrics for revocations. crbug.com/556845 |
| 325 ChooserContextBase* context = ui_info.get_context(profile_); | 322 ChooserContextBase* context = ui_info.get_context(profile_); |
| 326 const GURL origin = site_url_.GetOrigin(); | 323 const GURL origin = site_url_.GetOrigin(); |
| 327 context->RevokeObjectPermission(origin, origin, object); | 324 context->RevokeObjectPermission(origin, origin, object); |
| 328 | 325 |
| 329 show_info_bar_ = true; | 326 show_info_bar_ = true; |
| 330 | 327 |
| 331 // Refresh the UI to reflect the changed settings. | 328 // Refresh the UI to reflect the changed settings. |
| 332 PresentSitePermissions(); | 329 PresentSitePermissions(); |
| 333 } | 330 } |
| 334 | 331 |
| 335 void WebsiteSettings::OnSiteDataAccessed() { | 332 void PageInfo::OnSiteDataAccessed() { |
| 336 PresentSiteData(); | 333 PresentSiteData(); |
| 337 } | 334 } |
| 338 | 335 |
| 339 void WebsiteSettings::OnUIClosing() { | 336 void PageInfo::OnUIClosing() { |
| 340 #if defined(OS_ANDROID) | 337 #if defined(OS_ANDROID) |
| 341 NOTREACHED(); | 338 NOTREACHED(); |
| 342 #else | 339 #else |
| 343 if (show_info_bar_ && web_contents() && !web_contents()->IsBeingDestroyed()) { | 340 if (show_info_bar_ && web_contents() && !web_contents()->IsBeingDestroyed()) { |
| 344 InfoBarService* infobar_service = | 341 InfoBarService* infobar_service = |
| 345 InfoBarService::FromWebContents(web_contents()); | 342 InfoBarService::FromWebContents(web_contents()); |
| 346 if (infobar_service) | 343 if (infobar_service) |
| 347 WebsiteSettingsInfoBarDelegate::Create(infobar_service); | 344 WebsiteSettingsInfoBarDelegate::Create(infobar_service); |
| 348 } | 345 } |
| 349 | 346 |
| 350 SSLCertificateDecisionsDidRevoke user_decision = | 347 SSLCertificateDecisionsDidRevoke user_decision = |
| 351 did_revoke_user_ssl_decisions_ ? USER_CERT_DECISIONS_REVOKED | 348 did_revoke_user_ssl_decisions_ ? USER_CERT_DECISIONS_REVOKED |
| 352 : USER_CERT_DECISIONS_NOT_REVOKED; | 349 : USER_CERT_DECISIONS_NOT_REVOKED; |
| 353 | 350 |
| 354 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.did_user_revoke_decisions", | 351 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.did_user_revoke_decisions", |
| 355 user_decision, | 352 user_decision, |
| 356 END_OF_SSL_CERTIFICATE_DECISIONS_DID_REVOKE_ENUM); | 353 END_OF_SSL_CERTIFICATE_DECISIONS_DID_REVOKE_ENUM); |
| 357 #endif | 354 #endif |
| 358 } | 355 } |
| 359 | 356 |
| 360 void WebsiteSettings::OnRevokeSSLErrorBypassButtonPressed() { | 357 void PageInfo::OnRevokeSSLErrorBypassButtonPressed() { |
| 361 DCHECK(chrome_ssl_host_state_delegate_); | 358 DCHECK(chrome_ssl_host_state_delegate_); |
| 362 chrome_ssl_host_state_delegate_->RevokeUserAllowExceptionsHard( | 359 chrome_ssl_host_state_delegate_->RevokeUserAllowExceptionsHard( |
| 363 site_url().host()); | 360 site_url().host()); |
| 364 did_revoke_user_ssl_decisions_ = true; | 361 did_revoke_user_ssl_decisions_ = true; |
| 365 } | 362 } |
| 366 | 363 |
| 367 void WebsiteSettings::Init(const GURL& url, | 364 void PageInfo::Init(const GURL& url, |
| 368 const security_state::SecurityInfo& security_info) { | 365 const security_state::SecurityInfo& security_info) { |
| 369 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 366 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 370 // On desktop, internal URLs aren't handled by this class. Instead, a | 367 // On desktop, internal URLs aren't handled by this class. Instead, a |
| 371 // custom and simpler popup is shown. | 368 // custom and simpler popup is shown. |
| 372 DCHECK(!url.SchemeIs(content::kChromeUIScheme) && | 369 DCHECK(!url.SchemeIs(content::kChromeUIScheme) && |
| 373 !url.SchemeIs(content::kChromeDevToolsScheme) && | 370 !url.SchemeIs(content::kChromeDevToolsScheme) && |
| 374 !url.SchemeIs(content::kViewSourceScheme) && | 371 !url.SchemeIs(content::kViewSourceScheme) && |
| 375 !url.SchemeIs(content_settings::kExtensionScheme)); | 372 !url.SchemeIs(content_settings::kExtensionScheme)); |
| 376 #endif | 373 #endif |
| 377 | 374 |
| 378 bool isChromeUINativeScheme = false; | 375 bool isChromeUINativeScheme = false; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 // Check if a user decision has been made to allow or deny certificates with | 625 // Check if a user decision has been made to allow or deny certificates with |
| 629 // errors on this site. | 626 // errors on this site. |
| 630 ChromeSSLHostStateDelegate* delegate = | 627 ChromeSSLHostStateDelegate* delegate = |
| 631 ChromeSSLHostStateDelegateFactory::GetForProfile(profile_); | 628 ChromeSSLHostStateDelegateFactory::GetForProfile(profile_); |
| 632 DCHECK(delegate); | 629 DCHECK(delegate); |
| 633 // Only show an SSL decision revoke button if the user has chosen to bypass | 630 // Only show an SSL decision revoke button if the user has chosen to bypass |
| 634 // SSL host errors for this host in the past. | 631 // SSL host errors for this host in the past. |
| 635 show_ssl_decision_revoke_button_ = delegate->HasAllowException(url.host()); | 632 show_ssl_decision_revoke_button_ = delegate->HasAllowException(url.host()); |
| 636 } | 633 } |
| 637 | 634 |
| 638 void WebsiteSettings::PresentSitePermissions() { | 635 void PageInfo::PresentSitePermissions() { |
| 639 PermissionInfoList permission_info_list; | 636 PermissionInfoList permission_info_list; |
| 640 ChosenObjectInfoList chosen_object_info_list; | 637 ChosenObjectInfoList chosen_object_info_list; |
| 641 | 638 |
| 642 WebsiteSettingsUI::PermissionInfo permission_info; | 639 PageInfoUI::PermissionInfo permission_info; |
| 643 for (size_t i = 0; i < arraysize(kPermissionType); ++i) { | 640 for (size_t i = 0; i < arraysize(kPermissionType); ++i) { |
| 644 permission_info.type = kPermissionType[i]; | 641 permission_info.type = kPermissionType[i]; |
| 645 | 642 |
| 646 if (!ShouldShowPermission(permission_info.type)) | 643 if (!ShouldShowPermission(permission_info.type)) |
| 647 continue; | 644 continue; |
| 648 | 645 |
| 649 content_settings::SettingInfo info; | 646 content_settings::SettingInfo info; |
| 650 std::unique_ptr<base::Value> value = content_settings_->GetWebsiteSetting( | 647 std::unique_ptr<base::Value> value = content_settings_->GetWebsiteSetting( |
| 651 site_url_, site_url_, permission_info.type, std::string(), &info); | 648 site_url_, site_url_, permission_info.type, std::string(), &info); |
| 652 DCHECK(value.get()); | 649 DCHECK(value.get()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 694 | 691 |
| 695 permission_info_list.push_back(permission_info); | 692 permission_info_list.push_back(permission_info); |
| 696 } | 693 } |
| 697 | 694 |
| 698 for (const ChooserUIInfo& ui_info : kChooserUIInfo) { | 695 for (const ChooserUIInfo& ui_info : kChooserUIInfo) { |
| 699 ChooserContextBase* context = ui_info.get_context(profile_); | 696 ChooserContextBase* context = ui_info.get_context(profile_); |
| 700 const GURL origin = site_url_.GetOrigin(); | 697 const GURL origin = site_url_.GetOrigin(); |
| 701 auto chosen_objects = context->GetGrantedObjects(origin, origin); | 698 auto chosen_objects = context->GetGrantedObjects(origin, origin); |
| 702 for (std::unique_ptr<base::DictionaryValue>& object : chosen_objects) { | 699 for (std::unique_ptr<base::DictionaryValue>& object : chosen_objects) { |
| 703 chosen_object_info_list.push_back( | 700 chosen_object_info_list.push_back( |
| 704 base::MakeUnique<WebsiteSettingsUI::ChosenObjectInfo>( | 701 base::MakeUnique<PageInfoUI::ChosenObjectInfo>(ui_info, |
| 705 ui_info, std::move(object))); | 702 std::move(object))); |
| 706 } | 703 } |
| 707 } | 704 } |
| 708 | 705 |
| 709 ui_->SetPermissionInfo(permission_info_list, | 706 ui_->SetPermissionInfo(permission_info_list, |
| 710 std::move(chosen_object_info_list)); | 707 std::move(chosen_object_info_list)); |
| 711 } | 708 } |
| 712 | 709 |
| 713 void WebsiteSettings::PresentSiteData() { | 710 void PageInfo::PresentSiteData() { |
| 714 CookieInfoList cookie_info_list; | 711 CookieInfoList cookie_info_list; |
| 715 const LocalSharedObjectsContainer& allowed_objects = | 712 const LocalSharedObjectsContainer& allowed_objects = |
| 716 tab_specific_content_settings()->allowed_local_shared_objects(); | 713 tab_specific_content_settings()->allowed_local_shared_objects(); |
| 717 const LocalSharedObjectsContainer& blocked_objects = | 714 const LocalSharedObjectsContainer& blocked_objects = |
| 718 tab_specific_content_settings()->blocked_local_shared_objects(); | 715 tab_specific_content_settings()->blocked_local_shared_objects(); |
| 719 | 716 |
| 720 // Add first party cookie and site data counts. | 717 // Add first party cookie and site data counts. |
| 721 WebsiteSettingsUI::CookieInfo cookie_info; | 718 PageInfoUI::CookieInfo cookie_info; |
| 722 cookie_info.allowed = allowed_objects.GetObjectCountForDomain(site_url_); | 719 cookie_info.allowed = allowed_objects.GetObjectCountForDomain(site_url_); |
| 723 cookie_info.blocked = blocked_objects.GetObjectCountForDomain(site_url_); | 720 cookie_info.blocked = blocked_objects.GetObjectCountForDomain(site_url_); |
| 724 cookie_info.is_first_party = true; | 721 cookie_info.is_first_party = true; |
| 725 cookie_info_list.push_back(cookie_info); | 722 cookie_info_list.push_back(cookie_info); |
| 726 | 723 |
| 727 // Add third party cookie counts. | 724 // Add third party cookie counts. |
| 728 cookie_info.allowed = allowed_objects.GetObjectCount() - cookie_info.allowed; | 725 cookie_info.allowed = allowed_objects.GetObjectCount() - cookie_info.allowed; |
| 729 cookie_info.blocked = blocked_objects.GetObjectCount() - cookie_info.blocked; | 726 cookie_info.blocked = blocked_objects.GetObjectCount() - cookie_info.blocked; |
| 730 cookie_info.is_first_party = false; | 727 cookie_info.is_first_party = false; |
| 731 cookie_info_list.push_back(cookie_info); | 728 cookie_info_list.push_back(cookie_info); |
| 732 | 729 |
| 733 ui_->SetCookieInfo(cookie_info_list); | 730 ui_->SetCookieInfo(cookie_info_list); |
| 734 } | 731 } |
| 735 | 732 |
| 736 void WebsiteSettings::PresentSiteIdentity() { | 733 void PageInfo::PresentSiteIdentity() { |
| 737 // After initialization the status about the site's connection and its | 734 // After initialization the status about the site's connection and its |
| 738 // identity must be available. | 735 // identity must be available. |
| 739 DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); | 736 DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); |
| 740 DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); | 737 DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); |
| 741 WebsiteSettingsUI::IdentityInfo info; | 738 PageInfoUI::IdentityInfo info; |
| 742 if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT) | 739 if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT) |
| 743 info.site_identity = UTF16ToUTF8(organization_name()); | 740 info.site_identity = UTF16ToUTF8(organization_name()); |
| 744 else | 741 else |
| 745 info.site_identity = UTF16ToUTF8(GetSimpleSiteName(site_url_)); | 742 info.site_identity = UTF16ToUTF8(GetSimpleSiteName(site_url_)); |
| 746 | 743 |
| 747 info.connection_status = site_connection_status_; | 744 info.connection_status = site_connection_status_; |
| 748 info.connection_status_description = UTF16ToUTF8(site_connection_details_); | 745 info.connection_status_description = UTF16ToUTF8(site_connection_details_); |
| 749 info.identity_status = site_identity_status_; | 746 info.identity_status = site_identity_status_; |
| 750 info.identity_status_description = UTF16ToUTF8(site_identity_details_); | 747 info.identity_status_description = UTF16ToUTF8(site_identity_details_); |
| 751 info.certificate = certificate_; | 748 info.certificate = certificate_; |
| 752 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; | 749 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; |
| 753 ui_->SetIdentityInfo(info); | 750 ui_->SetIdentityInfo(info); |
| 754 } | 751 } |
| OLD | NEW |