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/website_settings/website_settings.h" | 5 #include "chrome/browser/ui/website_settings/website_settings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "grit/chromium_strings.h" | 38 #include "grit/chromium_strings.h" |
39 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
40 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 40 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
41 #include "net/cert/cert_status_flags.h" | 41 #include "net/cert/cert_status_flags.h" |
42 #include "net/cert/x509_certificate.h" | 42 #include "net/cert/x509_certificate.h" |
43 #include "net/ssl/ssl_cipher_suite_names.h" | 43 #include "net/ssl/ssl_cipher_suite_names.h" |
44 #include "net/ssl/ssl_connection_status_flags.h" | 44 #include "net/ssl/ssl_connection_status_flags.h" |
45 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
46 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
47 | 47 |
| 48 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 49 #include "chrome/browser/policy/browser_policy_connector.h" |
| 50 #endif |
| 51 |
48 using content::BrowserThread; | 52 using content::BrowserThread; |
49 | 53 |
50 namespace { | 54 namespace { |
51 | 55 |
52 // The list of content settings types to display on the Website Settings UI. | 56 // The list of content settings types to display on the Website Settings UI. |
53 ContentSettingsType kPermissionType[] = { | 57 ContentSettingsType kPermissionType[] = { |
54 CONTENT_SETTINGS_TYPE_IMAGES, | 58 CONTENT_SETTINGS_TYPE_IMAGES, |
55 CONTENT_SETTINGS_TYPE_JAVASCRIPT, | 59 CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
56 CONTENT_SETTINGS_TYPE_PLUGINS, | 60 CONTENT_SETTINGS_TYPE_PLUGINS, |
57 CONTENT_SETTINGS_TYPE_POPUPS, | 61 CONTENT_SETTINGS_TYPE_POPUPS, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); | 254 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
251 } | 255 } |
252 | 256 |
253 cert_id_ = ssl.cert_id; | 257 cert_id_ = ssl.cert_id; |
254 | 258 |
255 if (ssl.cert_id && | 259 if (ssl.cert_id && |
256 cert_store_->RetrieveCert(ssl.cert_id, &cert) && | 260 cert_store_->RetrieveCert(ssl.cert_id, &cert) && |
257 (!net::IsCertStatusError(ssl.cert_status) || | 261 (!net::IsCertStatusError(ssl.cert_status) || |
258 net::IsCertStatusMinorError(ssl.cert_status))) { | 262 net::IsCertStatusMinorError(ssl.cert_status))) { |
259 // There are no major errors. Check for minor errors. | 263 // There are no major errors. Check for minor errors. |
260 if (net::IsCertStatusMinorError(ssl.cert_status)) { | 264 bool used_policy_certificates = false; |
| 265 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 266 used_policy_certificates = |
| 267 policy::BrowserPolicyConnector::UsedPolicyCertificates(profile); |
| 268 #endif |
| 269 if (used_policy_certificates) { |
| 270 site_identity_status_ = SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT; |
| 271 site_identity_details_ = |
| 272 l10n_util::GetStringFUTF16(IDS_CERT_POLICY_PROVIDED_CERT_MESSAGE, |
| 273 UTF8ToUTF16(url.host())); |
| 274 } else if (net::IsCertStatusMinorError(ssl.cert_status)) { |
261 site_identity_status_ = SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN; | 275 site_identity_status_ = SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN; |
262 string16 issuer_name(UTF8ToUTF16(cert->issuer().GetDisplayName())); | 276 string16 issuer_name(UTF8ToUTF16(cert->issuer().GetDisplayName())); |
263 if (issuer_name.empty()) { | 277 if (issuer_name.empty()) { |
264 issuer_name.assign(l10n_util::GetStringUTF16( | 278 issuer_name.assign(l10n_util::GetStringUTF16( |
265 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); | 279 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
266 } | 280 } |
267 site_identity_details_.assign(l10n_util::GetStringFUTF16( | 281 site_identity_details_.assign(l10n_util::GetStringFUTF16( |
268 IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name)); | 282 IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name)); |
269 | 283 |
270 site_identity_details_ += ASCIIToUTF16("\n\n"); | 284 site_identity_details_ += ASCIIToUTF16("\n\n"); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 // By default select the permissions tab that displays all the site | 450 // By default select the permissions tab that displays all the site |
437 // permissions. In case of a connection error or an issue with the | 451 // permissions. In case of a connection error or an issue with the |
438 // certificate presented by the website, select the connection tab to draw | 452 // certificate presented by the website, select the connection tab to draw |
439 // the user's attention to the issue. If the site does not provide a | 453 // the user's attention to the issue. If the site does not provide a |
440 // certificate because it was loaded over an unencrypted connection, don't | 454 // certificate because it was loaded over an unencrypted connection, don't |
441 // select the connection tab. | 455 // select the connection tab. |
442 WebsiteSettingsUI::TabId tab_id = WebsiteSettingsUI::TAB_ID_PERMISSIONS; | 456 WebsiteSettingsUI::TabId tab_id = WebsiteSettingsUI::TAB_ID_PERMISSIONS; |
443 if (site_connection_status_ == SITE_CONNECTION_STATUS_ENCRYPTED_ERROR || | 457 if (site_connection_status_ == SITE_CONNECTION_STATUS_ENCRYPTED_ERROR || |
444 site_connection_status_ == SITE_CONNECTION_STATUS_MIXED_CONTENT || | 458 site_connection_status_ == SITE_CONNECTION_STATUS_MIXED_CONTENT || |
445 site_identity_status_ == SITE_IDENTITY_STATUS_ERROR || | 459 site_identity_status_ == SITE_IDENTITY_STATUS_ERROR || |
446 site_identity_status_ == SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN) | 460 site_identity_status_ == SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN || |
| 461 site_identity_status_ == SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT) |
447 tab_id = WebsiteSettingsUI::TAB_ID_CONNECTION; | 462 tab_id = WebsiteSettingsUI::TAB_ID_CONNECTION; |
448 ui_->SetSelectedTab(tab_id); | 463 ui_->SetSelectedTab(tab_id); |
449 } | 464 } |
450 | 465 |
451 void WebsiteSettings::PresentSitePermissions() { | 466 void WebsiteSettings::PresentSitePermissions() { |
452 PermissionInfoList permission_info_list; | 467 PermissionInfoList permission_info_list; |
453 | 468 |
454 WebsiteSettingsUI::PermissionInfo permission_info; | 469 WebsiteSettingsUI::PermissionInfo permission_info; |
455 for (size_t i = 0; i < arraysize(kPermissionType); ++i) { | 470 for (size_t i = 0; i < arraysize(kPermissionType); ++i) { |
456 permission_info.type = kPermissionType[i]; | 471 permission_info.type = kPermissionType[i]; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 first_visit_text = l10n_util::GetStringFUTF16( | 589 first_visit_text = l10n_util::GetStringFUTF16( |
575 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, | 590 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, |
576 base::TimeFormatShortDate(first_visit)); | 591 base::TimeFormatShortDate(first_visit)); |
577 } else { | 592 } else { |
578 first_visit_text = l10n_util::GetStringUTF16( | 593 first_visit_text = l10n_util::GetStringUTF16( |
579 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); | 594 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); |
580 | 595 |
581 } | 596 } |
582 ui_->SetFirstVisit(first_visit_text); | 597 ui_->SetFirstVisit(first_visit_text); |
583 } | 598 } |
OLD | NEW |