| 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" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/metrics/histogram.h" |
| 12 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
| 13 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 17 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
| 17 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 18 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
| 18 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" | 19 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
| 19 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" | 20 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
| 20 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 21 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
| 21 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" | 22 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" |
| 22 #include "chrome/browser/content_settings/content_settings_utils.h" | 23 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 23 #include "chrome/browser/content_settings/host_content_settings_map.h" | 24 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 24 #include "chrome/browser/content_settings/local_shared_objects_container.h" | 25 #include "chrome/browser/content_settings/local_shared_objects_container.h" |
| 25 #include "chrome/browser/history/history_service_factory.h" | 26 #include "chrome/browser/history/history_service_factory.h" |
| 26 #include "chrome/browser/infobars/infobar_tab_helper.h" | 27 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/ssl/ssl_error_info.h" | 29 #include "chrome/browser/ssl/ssl_error_info.h" |
| 29 #include "chrome/browser/ui/website_settings/website_settings_infobar_delegate.h
" | 30 #include "chrome/browser/ui/website_settings/website_settings_infobar_delegate.h
" |
| 30 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 31 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
| 31 #include "chrome/common/content_settings_pattern.h" | 32 #include "chrome/common/content_settings_pattern.h" |
| 32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 33 #include "content/public/browser/cert_store.h" | 34 #include "content/public/browser/cert_store.h" |
| 35 #include "content/public/browser/user_metrics.h" |
| 34 #include "content/public/common/ssl_status.h" | 36 #include "content/public/common/ssl_status.h" |
| 35 #include "content/public/common/url_constants.h" | 37 #include "content/public/common/url_constants.h" |
| 36 #include "grit/chromium_strings.h" | 38 #include "grit/chromium_strings.h" |
| 37 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
| 38 #include "net/base/cert_status_flags.h" | 40 #include "net/base/cert_status_flags.h" |
| 39 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 41 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 40 #include "net/base/ssl_cipher_suite_names.h" | 42 #include "net/base/ssl_cipher_suite_names.h" |
| 41 #include "net/base/ssl_connection_status_flags.h" | 43 #include "net/base/ssl_connection_status_flags.h" |
| 42 #include "net/base/x509_certificate.h" | 44 #include "net/base/x509_certificate.h" |
| 43 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 site_url_, | 92 site_url_, |
| 91 &visit_count_request_consumer_, | 93 &visit_count_request_consumer_, |
| 92 base::Bind(&WebsiteSettings::OnGotVisitCountToHost, | 94 base::Bind(&WebsiteSettings::OnGotVisitCountToHost, |
| 93 base::Unretained(this))); | 95 base::Unretained(this))); |
| 94 } | 96 } |
| 95 | 97 |
| 96 PresentSitePermissions(); | 98 PresentSitePermissions(); |
| 97 PresentSiteData(); | 99 PresentSiteData(); |
| 98 PresentSiteIdentity(); | 100 PresentSiteIdentity(); |
| 99 PresentHistoryInfo(base::Time()); | 101 PresentHistoryInfo(base::Time()); |
| 102 |
| 103 // Every time the Website Settings UI is opened a |WebsiteSettings| object is |
| 104 // created. So this counts how ofter the Website Settings UI is opened. |
| 105 content::RecordAction(content::UserMetricsAction("WebsiteSettings_Opened")); |
| 100 } | 106 } |
| 101 | 107 |
| 102 WebsiteSettings::~WebsiteSettings() { | 108 WebsiteSettings::~WebsiteSettings() { |
| 103 } | 109 } |
| 104 | 110 |
| 105 void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, | 111 void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, |
| 106 ContentSetting setting) { | 112 ContentSetting setting) { |
| 113 // Count how often a permission for a specific content type is changed using |
| 114 // the Website Settings UI. |
| 115 UMA_HISTOGRAM_COUNTS("WebsiteSettings.PermissionChanged", type); |
| 116 |
| 107 ContentSettingsPattern primary_pattern; | 117 ContentSettingsPattern primary_pattern; |
| 108 ContentSettingsPattern secondary_pattern; | 118 ContentSettingsPattern secondary_pattern; |
| 109 switch (type) { | 119 switch (type) { |
| 110 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 120 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 111 // TODO(markusheintz): The rule we create here should also change the | 121 // TODO(markusheintz): The rule we create here should also change the |
| 112 // location permission for iframed content. | 122 // location permission for iframed content. |
| 113 primary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); | 123 primary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); |
| 114 secondary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); | 124 secondary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); |
| 115 break; | 125 break; |
| 116 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 126 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 first_visit_text = l10n_util::GetStringFUTF16( | 538 first_visit_text = l10n_util::GetStringFUTF16( |
| 529 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, | 539 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, |
| 530 base::TimeFormatShortDate(first_visit)); | 540 base::TimeFormatShortDate(first_visit)); |
| 531 } else { | 541 } else { |
| 532 first_visit_text = l10n_util::GetStringUTF16( | 542 first_visit_text = l10n_util::GetStringUTF16( |
| 533 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); | 543 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); |
| 534 | 544 |
| 535 } | 545 } |
| 536 ui_->SetFirstVisit(first_visit_text); | 546 ui_->SetFirstVisit(first_visit_text); |
| 537 } | 547 } |
| OLD | NEW |