Commit c717b6e9 authored by Ravjit Singh Uppal's avatar Ravjit Singh Uppal Committed by Chromium LUCI CQ

Updated site settings and content settings bubble for one time permissions

As part of one time permissions for Geolocation on desktop, updated the Content Settings Bubble and Site Settings page to reflect the change.

Bug: 1150347
Change-Id: I6d13c59315a60fdf64a4ef54d52a2b7882f752a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2544889Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Commit-Queue: Ravjit Singh Uppal <ravjit@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836728}
parent 37369d71
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
using base::UserMetricsAction; using base::UserMetricsAction;
using content::WebContents; using content::WebContents;
using content_settings::PageSpecificContentSettings; using content_settings::PageSpecificContentSettings;
using content_settings::SessionModel;
using content_settings::SETTING_SOURCE_NONE; using content_settings::SETTING_SOURCE_NONE;
using content_settings::SETTING_SOURCE_USER; using content_settings::SETTING_SOURCE_USER;
using content_settings::SettingInfo; using content_settings::SettingInfo;
...@@ -1228,6 +1229,7 @@ ContentSettingGeolocationBubbleModel::ContentSettingGeolocationBubbleModel( ...@@ -1228,6 +1229,7 @@ ContentSettingGeolocationBubbleModel::ContentSettingGeolocationBubbleModel(
: ContentSettingSingleRadioGroup(delegate, : ContentSettingSingleRadioGroup(delegate,
web_contents, web_contents,
ContentSettingsType::GEOLOCATION) { ContentSettingsType::GEOLOCATION) {
SetCustomLink();
#if defined(OS_MAC) #if defined(OS_MAC)
if (base::FeatureList::IsEnabled( if (base::FeatureList::IsEnabled(
::features::kMacCoreLocationImplementation)) { ::features::kMacCoreLocationImplementation)) {
...@@ -1273,7 +1275,6 @@ void ContentSettingGeolocationBubbleModel::OnManageButtonClicked() { ...@@ -1273,7 +1275,6 @@ void ContentSettingGeolocationBubbleModel::OnManageButtonClicked() {
void ContentSettingGeolocationBubbleModel::CommitChanges() { void ContentSettingGeolocationBubbleModel::CommitChanges() {
if (show_system_geolocation_bubble_) if (show_system_geolocation_bubble_)
return; return;
ContentSettingSingleRadioGroup::CommitChanges(); ContentSettingSingleRadioGroup::CommitChanges();
} }
...@@ -1293,6 +1294,17 @@ void ContentSettingGeolocationBubbleModel:: ...@@ -1293,6 +1294,17 @@ void ContentSettingGeolocationBubbleModel::
#endif // defined(OS_MAC) #endif // defined(OS_MAC)
} }
void ContentSettingGeolocationBubbleModel::SetCustomLink() {
auto* map = HostContentSettingsMapFactory::GetForProfile(
web_contents()->GetBrowserContext());
SettingInfo info;
const GURL url =
web_contents()->GetMainFrame()->GetLastCommittedOrigin().GetURL();
map->GetWebsiteSetting(url, url, ContentSettingsType::GEOLOCATION, &info);
if (info.session_model == SessionModel::OneTime)
set_custom_link(l10n_util::GetStringUTF16(IDS_GEOLOCATION_WILL_ASK_AGAIN));
}
// ContentSettingSubresourceFilterBubbleModel ---------------------------------- // ContentSettingSubresourceFilterBubbleModel ----------------------------------
ContentSettingSubresourceFilterBubbleModel:: ContentSettingSubresourceFilterBubbleModel::
......
...@@ -538,6 +538,7 @@ class ContentSettingGeolocationBubbleModel ...@@ -538,6 +538,7 @@ class ContentSettingGeolocationBubbleModel
// Initialize the bubble with the elements specific to the scenario when // Initialize the bubble with the elements specific to the scenario when
// geolocation is disabled on the system (OS) level. // geolocation is disabled on the system (OS) level.
void InitializeSystemGeolocationPermissionBubble(); void InitializeSystemGeolocationPermissionBubble();
void SetCustomLink();
// Whether or not we are showing the bubble UI specific to when geolocation // Whether or not we are showing the bubble UI specific to when geolocation
// permissions are turned off on a system level. // permissions are turned off on a system level.
......
...@@ -716,6 +716,11 @@ ContentSetting GetContentSettingForOrigin( ...@@ -716,6 +716,11 @@ ContentSetting GetContentSettingForOrigin(
CalculateSiteSettingSource(profile, content_type, origin, info, result)); CalculateSiteSettingSource(profile, content_type, origin, info, result));
*display_name = GetDisplayNameForGURL(origin, extension_registry); *display_name = GetDisplayNameForGURL(origin, extension_registry);
if (info.session_model == content_settings::SessionModel::OneTime) {
DCHECK_EQ(content_type, ContentSettingsType::GEOLOCATION);
DCHECK_EQ(result.content_setting, CONTENT_SETTING_ALLOW);
return CONTENT_SETTING_DEFAULT;
}
return result.content_setting; return result.content_setting;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment