Desktop Page Info: Point "Site settings" link to "Site Details" when enabled.
If the "Site Details" page (found in Chrome's MD Settings) is enabled,
(i.e. #enable-site-details or #enable-site-settings is on), allow the user to
navigate to the "Site Details" of the origin they are currently visiting via
clicking the "Site settings" link at the bottom of the Page Info bubble.
BUG=655876, 656758
TEST=With the #enable-site-details and/or the #enable-site-settings flag turned
on, navigate to https://www.permission.site/. Open the Page Info bubble by
clicking on the icon next to the URL in the Omnibox. At the bottom of the
bubble, click "Site settings". This should take you to
With both flags off, repeating the above steps should open a new tab with
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
chrome: //settings/content/siteDetails?site=https%3A%2F%2Fptop.only.wip.la%3A443%2Fhttps%2Fpermission.site%2F.
chrome: //settings/content
Change-Id: I6778534923ad2df5b15175ad476686b8491da7b3
Reviewed-on: https://chromium-review.googlesource.com/504067
Commit-Queue: Patricia Lor <[email protected]>
Reviewed-by: Trent Apted <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Mike West <[email protected]>
Reviewed-by: Raymes Khoury <[email protected]>
Reviewed-by: Dan Beam <[email protected]>
Cr-Commit-Position: refs/heads/master@{#476937}
diff --git a/chrome/browser/ui/page_info/page_info.cc b/chrome/browser/ui/page_info/page_info.cc
index b5a07be5..0d815e74 100644
--- a/chrome/browser/ui/page_info/page_info.cc
+++ b/chrome/browser/ui/page_info/page_info.cc
@@ -43,6 +43,7 @@
#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_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/theme_resources.h"
@@ -66,6 +67,7 @@
#include "net/ssl/ssl_connection_status_flags.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
#include "ui/base/l10n/l10n_util.h"
+#include "url/origin.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/policy/policy_cert_service.h"
@@ -411,6 +413,31 @@
did_revoke_user_ssl_decisions_ = true;
}
+void PageInfo::OpenSiteSettingsView() {
+ // By default, this opens the general Content Settings pane. If the
+ // |kSiteSettings| and/or |kSiteDetails| flags are enabled this opens a
+ // settings page specific to the current origin of the page. crbug.com/655876
+ url::Origin site_origin = url::Origin(site_url());
+ std::string link_destination(chrome::kChromeUIContentSettingsURL);
+ if ((base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableSiteSettings) ||
+ base::FeatureList::IsEnabled(features::kSiteDetails)) &&
+ !site_origin.unique()) {
+ std::string origin_string = site_origin.Serialize();
+ url::RawCanonOutputT<char> percent_encoded_origin;
+ url::EncodeURIComponent(origin_string.c_str(), origin_string.length(),
+ &percent_encoded_origin);
+ link_destination = chrome::kChromeUISiteDetailsPrefixURL +
+ std::string(percent_encoded_origin.data(),
+ percent_encoded_origin.length());
+ }
+ web_contents()->OpenURL(
+ content::OpenURLParams(GURL(link_destination), content::Referrer(),
+ WindowOpenDisposition::NEW_FOREGROUND_TAB,
+ ui::PAGE_TRANSITION_LINK, false));
+ RecordPageInfoAction(PageInfo::PAGE_INFO_SITE_SETTINGS_OPENED);
+}
+
void PageInfo::Init(const GURL& url,
const security_state::SecurityInfo& security_info) {
#if !defined(OS_ANDROID) && !defined(OS_IOS)