| Index: chrome/browser/ui/page_info/page_info.cc
|
| diff --git a/chrome/browser/ui/page_info/website_settings.cc b/chrome/browser/ui/page_info/page_info.cc
|
| similarity index 90%
|
| rename from chrome/browser/ui/page_info/website_settings.cc
|
| rename to chrome/browser/ui/page_info/page_info.cc
|
| index 61d4cdc1cf00c1c7099cfcbaccd0471777bd713b..d45117acce88cb60a7323d0ef9c2624e99fc6028 100644
|
| --- a/chrome/browser/ui/page_info/website_settings.cc
|
| +++ b/chrome/browser/ui/page_info/page_info.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/ui/page_info/website_settings.h"
|
| +#include "chrome/browser/ui/page_info/page_info.h"
|
|
|
| #include <stddef.h>
|
| #include <stdint.h>
|
| @@ -39,7 +39,7 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
|
| #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h"
|
| -#include "chrome/browser/ui/page_info/website_settings_ui.h"
|
| +#include "chrome/browser/ui/page_info/page_info_ui.h"
|
| #include "chrome/browser/usb/usb_chooser_context.h"
|
| #include "chrome/browser/usb/usb_chooser_context_factory.h"
|
| #include "chrome/common/chrome_switches.h"
|
| @@ -75,7 +75,7 @@
|
|
|
| #if !defined(OS_ANDROID)
|
| #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
|
| -#include "chrome/browser/ui/page_info/website_settings_infobar_delegate.h"
|
| +#include "chrome/browser/ui/page_info/page_info_infobar_delegate.h"
|
| #endif
|
|
|
| using base::ASCIIToUTF16;
|
| @@ -92,7 +92,7 @@ enum SSLCertificateDecisionsDidRevoke {
|
| END_OF_SSL_CERTIFICATE_DECISIONS_DID_REVOKE_ENUM
|
| };
|
|
|
| -// The list of content settings types to display on the Website Settings UI. THE
|
| +// The list of content settings types to display on the Page Info UI. THE
|
| // ORDER OF THESE ITEMS IS IMPORTANT. To propose changing it, email
|
| // security-dev@chromium.org.
|
| ContentSettingsType kPermissionType[] = {
|
| @@ -112,7 +112,7 @@ ContentSettingsType kPermissionType[] = {
|
| CONTENT_SETTINGS_TYPE_MIDI_SYSEX,
|
| };
|
|
|
| -// Determines whether to show permission |type| in the Website Settings UI. Only
|
| +// Determines whether to show permission |type| in the Page Info UI. Only
|
| // applies to permissions listed in |kPermissionType|.
|
| bool ShouldShowPermission(ContentSettingsType type) {
|
| #if !defined(OS_ANDROID)
|
| @@ -163,23 +163,23 @@ void CheckForInsecureContent(const security_state::SecurityInfo& security_info,
|
|
|
| void GetSiteIdentityByMaliciousContentStatus(
|
| security_state::MaliciousContentStatus malicious_content_status,
|
| - WebsiteSettings::SiteIdentityStatus* status,
|
| + PageInfo::SiteIdentityStatus* status,
|
| base::string16* details) {
|
| switch (malicious_content_status) {
|
| case security_state::MALICIOUS_CONTENT_STATUS_NONE:
|
| NOTREACHED();
|
| break;
|
| case security_state::MALICIOUS_CONTENT_STATUS_MALWARE:
|
| - *status = WebsiteSettings::SITE_IDENTITY_STATUS_MALWARE;
|
| + *status = PageInfo::SITE_IDENTITY_STATUS_MALWARE;
|
| *details = l10n_util::GetStringUTF16(IDS_PAGEINFO_MALWARE_DETAILS);
|
| break;
|
| case security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING:
|
| - *status = WebsiteSettings::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING;
|
| + *status = PageInfo::SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING;
|
| *details =
|
| l10n_util::GetStringUTF16(IDS_PAGEINFO_SOCIAL_ENGINEERING_DETAILS);
|
| break;
|
| case security_state::MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE:
|
| - *status = WebsiteSettings::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE;
|
| + *status = PageInfo::SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE;
|
| *details =
|
| l10n_util::GetStringUTF16(IDS_PAGEINFO_UNWANTED_SOFTWARE_DETAILS);
|
| break;
|
| @@ -198,21 +198,20 @@ ChooserContextBase* GetUsbChooserContext(Profile* profile) {
|
| // The list of chooser types that need to display entries in the Website
|
| // Settings UI. THE ORDER OF THESE ITEMS IS IMPORTANT. To propose changing it,
|
| // email security-dev@chromium.org.
|
| -WebsiteSettings::ChooserUIInfo kChooserUIInfo[] = {
|
| +PageInfo::ChooserUIInfo kChooserUIInfo[] = {
|
| {CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, &GetUsbChooserContext,
|
| - IDR_BLOCKED_USB, IDR_ALLOWED_USB, IDS_WEBSITE_SETTINGS_USB_DEVICE_LABEL,
|
| - IDS_WEBSITE_SETTINGS_DELETE_USB_DEVICE, "name"},
|
| + IDR_BLOCKED_USB, IDR_ALLOWED_USB, IDS_PAGE_INFO_USB_DEVICE_LABEL,
|
| + IDS_PAGE_INFO_DELETE_USB_DEVICE, "name"},
|
| };
|
|
|
| } // namespace
|
|
|
| -WebsiteSettings::WebsiteSettings(
|
| - WebsiteSettingsUI* ui,
|
| - Profile* profile,
|
| - TabSpecificContentSettings* tab_specific_content_settings,
|
| - content::WebContents* web_contents,
|
| - const GURL& url,
|
| - const security_state::SecurityInfo& security_info)
|
| +PageInfo::PageInfo(PageInfoUI* ui,
|
| + Profile* profile,
|
| + TabSpecificContentSettings* tab_specific_content_settings,
|
| + content::WebContents* web_contents,
|
| + const GURL& url,
|
| + const security_state::SecurityInfo& security_info)
|
| : TabSpecificContentSettings::SiteDataObserver(
|
| tab_specific_content_settings),
|
| content::WebContentsObserver(web_contents),
|
| @@ -234,17 +233,15 @@ WebsiteSettings::WebsiteSettings(
|
| PresentSiteData();
|
| PresentSiteIdentity();
|
|
|
| - // Every time the Website Settings UI is opened a |WebsiteSettings| object is
|
| - // created. So this counts how ofter the Website Settings UI is opened.
|
| - RecordWebsiteSettingsAction(WEBSITE_SETTINGS_OPENED);
|
| + // Every time the Page Info UI is opened a |PageInfo| object is
|
| + // created. So this counts how ofter the Page Info UI is opened.
|
| + RecordPageInfoAction(PAGE_INFO_OPENED);
|
| }
|
|
|
| -WebsiteSettings::~WebsiteSettings() {}
|
| +PageInfo::~PageInfo() {}
|
|
|
| -void WebsiteSettings::RecordWebsiteSettingsAction(
|
| - WebsiteSettingsAction action) {
|
| - UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action", action,
|
| - WEBSITE_SETTINGS_COUNT);
|
| +void PageInfo::RecordPageInfoAction(PageInfoAction action) {
|
| + UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action", action, PAGE_INFO_COUNT);
|
|
|
| std::string histogram_name;
|
|
|
| @@ -252,33 +249,33 @@ void WebsiteSettings::RecordWebsiteSettingsAction(
|
| if (security_level_ == security_state::SECURE ||
|
| security_level_ == security_state::EV_SECURE) {
|
| UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Valid",
|
| - action, WEBSITE_SETTINGS_COUNT);
|
| + action, PAGE_INFO_COUNT);
|
| } else if (security_level_ == security_state::NONE) {
|
| UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Downgraded",
|
| - action, WEBSITE_SETTINGS_COUNT);
|
| + action, PAGE_INFO_COUNT);
|
| } else if (security_level_ == security_state::DANGEROUS) {
|
| UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Dangerous",
|
| - action, WEBSITE_SETTINGS_COUNT);
|
| + action, PAGE_INFO_COUNT);
|
| }
|
| return;
|
| }
|
|
|
| if (security_level_ == security_state::HTTP_SHOW_WARNING) {
|
| UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Warning",
|
| - action, WEBSITE_SETTINGS_COUNT);
|
| + action, PAGE_INFO_COUNT);
|
| } else if (security_level_ == security_state::DANGEROUS) {
|
| UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Dangerous",
|
| - action, WEBSITE_SETTINGS_COUNT);
|
| + action, PAGE_INFO_COUNT);
|
| } else {
|
| UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Neutral",
|
| - action, WEBSITE_SETTINGS_COUNT);
|
| + action, PAGE_INFO_COUNT);
|
| }
|
| }
|
|
|
| -void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type,
|
| - ContentSetting setting) {
|
| +void PageInfo::OnSitePermissionChanged(ContentSettingsType type,
|
| + ContentSetting setting) {
|
| // Count how often a permission for a specific content type is changed using
|
| - // the Website Settings UI.
|
| + // the Page Info UI.
|
| size_t num_values;
|
| int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values);
|
| UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.OriginInfo.PermissionChanged",
|
| @@ -302,8 +299,8 @@ void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type,
|
|
|
| // This is technically redundant given the histogram above, but putting the
|
| // total count of permission changes in another histogram makes it easier to
|
| - // compare it against other kinds of actions in WebsiteSettings[PopupView].
|
| - RecordWebsiteSettingsAction(WEBSITE_SETTINGS_CHANGED_PERMISSION);
|
| + // compare it against other kinds of actions in PageInfo[PopupView].
|
| + RecordPageInfoAction(PAGE_INFO_CHANGED_PERMISSION);
|
|
|
| PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter(
|
| this->profile_, this->site_url_, this->site_url_, type,
|
| @@ -318,9 +315,8 @@ void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type,
|
| PresentSitePermissions();
|
| }
|
|
|
| -void WebsiteSettings::OnSiteChosenObjectDeleted(
|
| - const ChooserUIInfo& ui_info,
|
| - const base::DictionaryValue& object) {
|
| +void PageInfo::OnSiteChosenObjectDeleted(const ChooserUIInfo& ui_info,
|
| + const base::DictionaryValue& object) {
|
| // TODO(reillyg): Create metrics for revocations. crbug.com/556845
|
| ChooserContextBase* context = ui_info.get_context(profile_);
|
| const GURL origin = site_url_.GetOrigin();
|
| @@ -332,11 +328,11 @@ void WebsiteSettings::OnSiteChosenObjectDeleted(
|
| PresentSitePermissions();
|
| }
|
|
|
| -void WebsiteSettings::OnSiteDataAccessed() {
|
| +void PageInfo::OnSiteDataAccessed() {
|
| PresentSiteData();
|
| }
|
|
|
| -void WebsiteSettings::OnUIClosing() {
|
| +void PageInfo::OnUIClosing() {
|
| #if defined(OS_ANDROID)
|
| NOTREACHED();
|
| #else
|
| @@ -344,7 +340,7 @@ void WebsiteSettings::OnUIClosing() {
|
| InfoBarService* infobar_service =
|
| InfoBarService::FromWebContents(web_contents());
|
| if (infobar_service)
|
| - WebsiteSettingsInfoBarDelegate::Create(infobar_service);
|
| + PageInfoInfoBarDelegate::Create(infobar_service);
|
| }
|
|
|
| SSLCertificateDecisionsDidRevoke user_decision =
|
| @@ -357,15 +353,15 @@ void WebsiteSettings::OnUIClosing() {
|
| #endif
|
| }
|
|
|
| -void WebsiteSettings::OnRevokeSSLErrorBypassButtonPressed() {
|
| +void PageInfo::OnRevokeSSLErrorBypassButtonPressed() {
|
| DCHECK(chrome_ssl_host_state_delegate_);
|
| chrome_ssl_host_state_delegate_->RevokeUserAllowExceptionsHard(
|
| site_url().host());
|
| did_revoke_user_ssl_decisions_ = true;
|
| }
|
|
|
| -void WebsiteSettings::Init(const GURL& url,
|
| - const security_state::SecurityInfo& security_info) {
|
| +void PageInfo::Init(const GURL& url,
|
| + const security_state::SecurityInfo& security_info) {
|
| #if !defined(OS_ANDROID) && !defined(OS_IOS)
|
| // On desktop, internal URLs aren't handled by this class. Instead, a
|
| // custom and simpler popup is shown.
|
| @@ -635,11 +631,11 @@ void WebsiteSettings::Init(const GURL& url,
|
| show_ssl_decision_revoke_button_ = delegate->HasAllowException(url.host());
|
| }
|
|
|
| -void WebsiteSettings::PresentSitePermissions() {
|
| +void PageInfo::PresentSitePermissions() {
|
| PermissionInfoList permission_info_list;
|
| ChosenObjectInfoList chosen_object_info_list;
|
|
|
| - WebsiteSettingsUI::PermissionInfo permission_info;
|
| + PageInfoUI::PermissionInfo permission_info;
|
| for (size_t i = 0; i < arraysize(kPermissionType); ++i) {
|
| permission_info.type = kPermissionType[i];
|
|
|
| @@ -701,8 +697,8 @@ void WebsiteSettings::PresentSitePermissions() {
|
| auto chosen_objects = context->GetGrantedObjects(origin, origin);
|
| for (std::unique_ptr<base::DictionaryValue>& object : chosen_objects) {
|
| chosen_object_info_list.push_back(
|
| - base::MakeUnique<WebsiteSettingsUI::ChosenObjectInfo>(
|
| - ui_info, std::move(object)));
|
| + base::MakeUnique<PageInfoUI::ChosenObjectInfo>(ui_info,
|
| + std::move(object)));
|
| }
|
| }
|
|
|
| @@ -710,7 +706,7 @@ void WebsiteSettings::PresentSitePermissions() {
|
| std::move(chosen_object_info_list));
|
| }
|
|
|
| -void WebsiteSettings::PresentSiteData() {
|
| +void PageInfo::PresentSiteData() {
|
| CookieInfoList cookie_info_list;
|
| const LocalSharedObjectsContainer& allowed_objects =
|
| tab_specific_content_settings()->allowed_local_shared_objects();
|
| @@ -718,7 +714,7 @@ void WebsiteSettings::PresentSiteData() {
|
| tab_specific_content_settings()->blocked_local_shared_objects();
|
|
|
| // Add first party cookie and site data counts.
|
| - WebsiteSettingsUI::CookieInfo cookie_info;
|
| + PageInfoUI::CookieInfo cookie_info;
|
| cookie_info.allowed = allowed_objects.GetObjectCountForDomain(site_url_);
|
| cookie_info.blocked = blocked_objects.GetObjectCountForDomain(site_url_);
|
| cookie_info.is_first_party = true;
|
| @@ -733,12 +729,12 @@ void WebsiteSettings::PresentSiteData() {
|
| ui_->SetCookieInfo(cookie_info_list);
|
| }
|
|
|
| -void WebsiteSettings::PresentSiteIdentity() {
|
| +void PageInfo::PresentSiteIdentity() {
|
| // After initialization the status about the site's connection and its
|
| // identity must be available.
|
| DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN);
|
| DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN);
|
| - WebsiteSettingsUI::IdentityInfo info;
|
| + PageInfoUI::IdentityInfo info;
|
| if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT)
|
| info.site_identity = UTF16ToUTF8(organization_name());
|
| else
|
|
|