| 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(OS_CHROMEOS) |
| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); | 248 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
| 245 } | 249 } |
| 246 | 250 |
| 247 cert_id_ = ssl.cert_id; | 251 cert_id_ = ssl.cert_id; |
| 248 | 252 |
| 249 if (ssl.cert_id && | 253 if (ssl.cert_id && |
| 250 cert_store_->RetrieveCert(ssl.cert_id, &cert) && | 254 cert_store_->RetrieveCert(ssl.cert_id, &cert) && |
| 251 (!net::IsCertStatusError(ssl.cert_status) || | 255 (!net::IsCertStatusError(ssl.cert_status) || |
| 252 net::IsCertStatusMinorError(ssl.cert_status))) { | 256 net::IsCertStatusMinorError(ssl.cert_status))) { |
| 253 // There are no major errors. Check for minor errors. | 257 // There are no major errors. Check for minor errors. |
| 254 if (net::IsCertStatusMinorError(ssl.cert_status)) { | 258 bool used_policy_certificates = false; |
| 259 #if defined(OS_CHROMEOS) |
| 260 used_policy_certificates = |
| 261 policy::BrowserPolicyConnector::UsedPolicyCertificates(profile); |
| 262 #endif |
| 263 if (used_policy_certificates) { |
| 264 site_identity_status_ = SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT; |
| 265 site_identity_details_ = |
| 266 l10n_util::GetStringFUTF16(IDS_CERT_POLICY_PROVIDED_CERT_MESSAGE, |
| 267 UTF8ToUTF16(url.host())); |
| 268 } else if (net::IsCertStatusMinorError(ssl.cert_status)) { |
| 255 site_identity_status_ = SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN; | 269 site_identity_status_ = SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN; |
| 256 string16 issuer_name(UTF8ToUTF16(cert->issuer().GetDisplayName())); | 270 string16 issuer_name(UTF8ToUTF16(cert->issuer().GetDisplayName())); |
| 257 if (issuer_name.empty()) { | 271 if (issuer_name.empty()) { |
| 258 issuer_name.assign(l10n_util::GetStringUTF16( | 272 issuer_name.assign(l10n_util::GetStringUTF16( |
| 259 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); | 273 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); |
| 260 } | 274 } |
| 261 site_identity_details_.assign(l10n_util::GetStringFUTF16( | 275 site_identity_details_.assign(l10n_util::GetStringFUTF16( |
| 262 IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name)); | 276 IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name)); |
| 263 | 277 |
| 264 site_identity_details_ += ASCIIToUTF16("\n\n"); | 278 site_identity_details_ += ASCIIToUTF16("\n\n"); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 // By default select the permissions tab that displays all the site | 444 // By default select the permissions tab that displays all the site |
| 431 // permissions. In case of a connection error or an issue with the | 445 // permissions. In case of a connection error or an issue with the |
| 432 // certificate presented by the website, select the connection tab to draw | 446 // certificate presented by the website, select the connection tab to draw |
| 433 // the user's attention to the issue. If the site does not provide a | 447 // the user's attention to the issue. If the site does not provide a |
| 434 // certificate because it was loaded over an unencrypted connection, don't | 448 // certificate because it was loaded over an unencrypted connection, don't |
| 435 // select the connection tab. | 449 // select the connection tab. |
| 436 WebsiteSettingsUI::TabId tab_id = WebsiteSettingsUI::TAB_ID_PERMISSIONS; | 450 WebsiteSettingsUI::TabId tab_id = WebsiteSettingsUI::TAB_ID_PERMISSIONS; |
| 437 if (site_connection_status_ == SITE_CONNECTION_STATUS_ENCRYPTED_ERROR || | 451 if (site_connection_status_ == SITE_CONNECTION_STATUS_ENCRYPTED_ERROR || |
| 438 site_connection_status_ == SITE_CONNECTION_STATUS_MIXED_CONTENT || | 452 site_connection_status_ == SITE_CONNECTION_STATUS_MIXED_CONTENT || |
| 439 site_identity_status_ == SITE_IDENTITY_STATUS_ERROR || | 453 site_identity_status_ == SITE_IDENTITY_STATUS_ERROR || |
| 440 site_identity_status_ == SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN) | 454 site_identity_status_ == SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN || |
| 455 site_identity_status_ == SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT) |
| 441 tab_id = WebsiteSettingsUI::TAB_ID_CONNECTION; | 456 tab_id = WebsiteSettingsUI::TAB_ID_CONNECTION; |
| 442 ui_->SetSelectedTab(tab_id); | 457 ui_->SetSelectedTab(tab_id); |
| 443 } | 458 } |
| 444 | 459 |
| 445 void WebsiteSettings::PresentSitePermissions() { | 460 void WebsiteSettings::PresentSitePermissions() { |
| 446 PermissionInfoList permission_info_list; | 461 PermissionInfoList permission_info_list; |
| 447 | 462 |
| 448 WebsiteSettingsUI::PermissionInfo permission_info; | 463 WebsiteSettingsUI::PermissionInfo permission_info; |
| 449 for (size_t i = 0; i < arraysize(kPermissionType); ++i) { | 464 for (size_t i = 0; i < arraysize(kPermissionType); ++i) { |
| 450 permission_info.type = kPermissionType[i]; | 465 permission_info.type = kPermissionType[i]; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 first_visit_text = l10n_util::GetStringFUTF16( | 577 first_visit_text = l10n_util::GetStringFUTF16( |
| 563 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, | 578 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, |
| 564 base::TimeFormatShortDate(first_visit)); | 579 base::TimeFormatShortDate(first_visit)); |
| 565 } else { | 580 } else { |
| 566 first_visit_text = l10n_util::GetStringUTF16( | 581 first_visit_text = l10n_util::GetStringUTF16( |
| 567 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); | 582 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); |
| 568 | 583 |
| 569 } | 584 } |
| 570 ui_->SetFirstVisit(first_visit_text); | 585 ui_->SetFirstVisit(first_visit_text); |
| 571 } | 586 } |
| OLD | NEW |