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/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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 &visit_count_task_tracker_); | 195 &visit_count_task_tracker_); |
| 196 } | 196 } |
| 197 | 197 |
| 198 PresentSitePermissions(); | 198 PresentSitePermissions(); |
| 199 PresentSiteData(); | 199 PresentSiteData(); |
| 200 PresentSiteIdentity(); | 200 PresentSiteIdentity(); |
| 201 PresentHistoryInfo(base::Time()); | 201 PresentHistoryInfo(base::Time()); |
| 202 | 202 |
| 203 // Every time the Website Settings UI is opened a |WebsiteSettings| object is | 203 // Every time the Website Settings UI is opened a |WebsiteSettings| object is |
| 204 // created. So this counts how ofter the Website Settings UI is opened. | 204 // created. So this counts how ofter the Website Settings UI is opened. |
| 205 content::RecordAction(base::UserMetricsAction("WebsiteSettings_Opened")); | 205 RecordWebsiteSettingsAction(WEBSITE_SETTINGS_OPENED); |
| 206 } | 206 } |
| 207 | 207 |
| 208 WebsiteSettings::~WebsiteSettings() { | 208 WebsiteSettings::~WebsiteSettings() { |
| 209 } | 209 } |
| 210 | 210 |
| 211 void WebsiteSettings::RecordWebsiteSettingsAction( | |
| 212 WebsiteSettingsAction action) { | |
| 213 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings", | |
|
Ilya Sherman
2014/10/29 23:55:42
Also, is "WebsiteSettings" a namespace that's alre
Ilya Sherman
2014/10/29 23:55:42
This histogram currently just has a namespace, but
lgarron
2014/10/30 00:10:19
I originally planned just to have this histogram (
lgarron
2014/10/30 00:10:19
It's used by WebsiteSettings.PermissionChanged (un
lgarron
2014/10/31 00:50:48
Acknowledged.
| |
| 214 action, | |
| 215 WEBSITE_SETTINGS_COUNT); | |
| 216 | |
| 217 // Use a separate histogram to record actions if they are done on a page with | |
| 218 // an HTTPS URL. Note that this *disregards* security status. | |
| 219 if (site_url_.SchemeIs(url::kHttpsScheme)) { | |
| 220 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.HTTPS_URL", | |
|
Ilya Sherman
2014/10/29 23:55:42
Optional nit: I'd write "HTTPS_URL" as "SecureUrl"
lgarron
2014/10/31 00:50:48
SecureURL is probably a bad idea, but HttpsUrl sou
| |
| 221 action, | |
| 222 WEBSITE_SETTINGS_COUNT); | |
| 223 } | |
| 224 } | |
| 225 | |
| 226 | |
| 211 void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, | 227 void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, |
| 212 ContentSetting setting) { | 228 ContentSetting setting) { |
| 213 // Count how often a permission for a specific content type is changed using | 229 // Count how often a permission for a specific content type is changed using |
| 214 // the Website Settings UI. | 230 // the Website Settings UI. |
| 215 UMA_HISTOGRAM_COUNTS("WebsiteSettings.PermissionChanged", type); | 231 UMA_HISTOGRAM_COUNTS("WebsiteSettings.PermissionChanged", type); |
| 216 | 232 |
| 233 // This is technically redundant given the histogram above, but putting the | |
| 234 // total count of permission changes in another histogram makes it easier to | |
| 235 // compare it against other kinds of actions in WebsiteSettings[PopupView]. | |
| 236 RecordWebsiteSettingsAction(WEBSITE_SETTINGS_CHANGED_PERMISSION); | |
| 237 | |
| 217 ContentSettingsPattern primary_pattern; | 238 ContentSettingsPattern primary_pattern; |
| 218 ContentSettingsPattern secondary_pattern; | 239 ContentSettingsPattern secondary_pattern; |
| 219 switch (type) { | 240 switch (type) { |
| 220 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 241 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 221 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 242 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 222 // TODO(markusheintz): The rule we create here should also change the | 243 // TODO(markusheintz): The rule we create here should also change the |
| 223 // location permission for iframed content. | 244 // location permission for iframed content. |
| 224 primary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); | 245 primary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); |
| 225 secondary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); | 246 secondary_pattern = ContentSettingsPattern::FromURLNoWildcard(site_url_); |
| 226 break; | 247 break; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 620 // the user's attention to the issue. If the site does not provide a | 641 // the user's attention to the issue. If the site does not provide a |
| 621 // certificate because it was loaded over an unencrypted connection, don't | 642 // certificate because it was loaded over an unencrypted connection, don't |
| 622 // select the connection tab. | 643 // select the connection tab. |
| 623 WebsiteSettingsUI::TabId tab_id = WebsiteSettingsUI::TAB_ID_PERMISSIONS; | 644 WebsiteSettingsUI::TabId tab_id = WebsiteSettingsUI::TAB_ID_PERMISSIONS; |
| 624 if (site_connection_status_ == SITE_CONNECTION_STATUS_ENCRYPTED_ERROR || | 645 if (site_connection_status_ == SITE_CONNECTION_STATUS_ENCRYPTED_ERROR || |
| 625 site_connection_status_ == SITE_CONNECTION_STATUS_MIXED_CONTENT || | 646 site_connection_status_ == SITE_CONNECTION_STATUS_MIXED_CONTENT || |
| 626 site_identity_status_ == SITE_IDENTITY_STATUS_ERROR || | 647 site_identity_status_ == SITE_IDENTITY_STATUS_ERROR || |
| 627 site_identity_status_ == SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN || | 648 site_identity_status_ == SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN || |
| 628 site_identity_status_ == SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT || | 649 site_identity_status_ == SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT || |
| 629 site_identity_status_ == | 650 site_identity_status_ == |
| 630 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM) | 651 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM) { |
| 631 tab_id = WebsiteSettingsUI::TAB_ID_CONNECTION; | 652 tab_id = WebsiteSettingsUI::TAB_ID_CONNECTION; |
| 653 RecordWebsiteSettingsAction( | |
| 654 WEBSITE_SETTINGS_CONNECTION_TAB_SHOWN_IMMEDIATELY); | |
| 655 } | |
| 632 ui_->SetSelectedTab(tab_id); | 656 ui_->SetSelectedTab(tab_id); |
| 633 } | 657 } |
| 634 | 658 |
| 635 void WebsiteSettings::PresentSitePermissions() { | 659 void WebsiteSettings::PresentSitePermissions() { |
| 636 PermissionInfoList permission_info_list; | 660 PermissionInfoList permission_info_list; |
| 637 | 661 |
| 638 WebsiteSettingsUI::PermissionInfo permission_info; | 662 WebsiteSettingsUI::PermissionInfo permission_info; |
| 639 for (size_t i = 0; i < arraysize(kPermissionType); ++i) { | 663 for (size_t i = 0; i < arraysize(kPermissionType); ++i) { |
| 640 permission_info.type = kPermissionType[i]; | 664 permission_info.type = kPermissionType[i]; |
| 641 if (permission_info.type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { | 665 if (permission_info.type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 771 if (visited_before_today) { | 795 if (visited_before_today) { |
| 772 first_visit_text = l10n_util::GetStringFUTF16( | 796 first_visit_text = l10n_util::GetStringFUTF16( |
| 773 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, | 797 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, |
| 774 base::TimeFormatShortDate(first_visit)); | 798 base::TimeFormatShortDate(first_visit)); |
| 775 } else { | 799 } else { |
| 776 first_visit_text = l10n_util::GetStringUTF16( | 800 first_visit_text = l10n_util::GetStringUTF16( |
| 777 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); | 801 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); |
| 778 } | 802 } |
| 779 ui_->SetFirstVisit(first_visit_text); | 803 ui_->SetFirstVisit(first_visit_text); |
| 780 } | 804 } |
| OLD | NEW |