Skip to content

Commit

Permalink
MD Settings: If on a file:// URL, don't navigate to Site Details via …
Browse files Browse the repository at this point in the history
…Page Info.

PermissionManager doesn't seem to support retrieving permission settings for
file:// scheme URLs, which means Site Details won't either. Temporarily disable
navigation to Site Details from a file:// URL until https://crbug.com/444047 can
be fixed.

[email protected]

(cherry picked from commit 5f083d2)

Bug: 656758, 444047, 762751
Change-Id: Ib12f0990e22e26e20706e976a6cb21c6def70c7d
Reviewed-on: https://chromium-review.googlesource.com/647355
Commit-Queue: Patti <[email protected]>
Reviewed-by: Raymes Khoury <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#500188}
Reviewed-on: https://chromium-review.googlesource.com/656864
Reviewed-by: Patti <[email protected]>
Cr-Commit-Position: refs/branch-heads/3202@{#83}
Cr-Branched-From: fa6a5d8-refs/heads/master@{#499098}
  • Loading branch information
plorcupine committed Sep 8, 2017
1 parent cb7fdd0 commit 10d0030
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion chrome/browser/ui/page_info/page_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,14 @@ void PageInfo::OpenSiteSettingsView() {
// 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);
// TODO(https://crbug.com/444047): Site Details should work with file:// urls
// when this bug is fixed, so add it to the whitelist when that happens.
if ((base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableSiteSettings) ||
base::FeatureList::IsEnabled(features::kSiteDetails)) &&
!site_origin.unique()) {
!site_origin.unique() &&
(site_url().SchemeIsHTTPOrHTTPS() ||
site_url().SchemeIs(content_settings::kExtensionScheme))) {
std::string origin_string = site_origin.Serialize();
url::RawCanonOutputT<char> percent_encoded_origin;
url::EncodeURIComponent(origin_string.c_str(), origin_string.length(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest,
OpenSiteSettingsForUrl(browser(), GURL(url::kAboutBlankURL), true));
}

// Test opening "Site Details" via Page Info from a file:// URL goes to "Content
// Settings".
IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest,
SiteSettingsLinkWithSiteDetailsEnabledAndFileUrl) {
GURL url = GURL("file:///Users/homedirname/folder/file.pdf");
EXPECT_EQ(GURL(chrome::kChromeUIContentSettingsURL),
OpenSiteSettingsForUrl(browser(), url, true));
}

// Test opening page info bubble that matches SB_THREAT_TYPE_PASSWORD_REUSE
// threat type.
IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest,
Expand Down

0 comments on commit 10d0030

Please sign in to comment.