Commit 232a35e4 authored by Illia Klimov's avatar Illia Klimov Committed by Commit Bot

Display embargoed origin subtitle on Android.

That patch shows "Automatically blocked" subtitle for embargoed origins
in Site Details page.

Bug: 1033593
Change-Id: Ib9820f31cce317b23a62d4f53eff301f8e638d96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2219505
Commit-Queue: Illia Klimov <elklm@google.com>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarAndy Paicu <andypaicu@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774623}
parent a70449f8
...@@ -6,6 +6,7 @@ package org.chromium.chrome.browser.site_settings; ...@@ -6,6 +6,7 @@ package org.chromium.chrome.browser.site_settings;
import static org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridge.SITE_WILDCARD; import static org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridge.SITE_WILDCARD;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
...@@ -46,6 +47,7 @@ import org.chromium.components.browser_ui.settings.ChromeBaseCheckBoxPreference; ...@@ -46,6 +47,7 @@ import org.chromium.components.browser_ui.settings.ChromeBaseCheckBoxPreference;
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference; import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference;
import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference.CookieSettingsState; import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference.CookieSettingsState;
import org.chromium.components.browser_ui.site_settings.R;
import org.chromium.components.browser_ui.site_settings.SingleCategorySettings; import org.chromium.components.browser_ui.site_settings.SingleCategorySettings;
import org.chromium.components.browser_ui.site_settings.SingleWebsiteSettings; import org.chromium.components.browser_ui.site_settings.SingleWebsiteSettings;
import org.chromium.components.browser_ui.site_settings.SiteSettingsCategory; import org.chromium.components.browser_ui.site_settings.SiteSettingsCategory;
...@@ -1213,8 +1215,9 @@ public class SiteSettingsTest { ...@@ -1213,8 +1215,9 @@ public class SiteSettingsTest {
} }
SettingsLauncher settingsLauncher = new SettingsLauncherImpl(); SettingsLauncher settingsLauncher = new SettingsLauncherImpl();
Intent intent = settingsLauncher.createSettingsActivityIntent( Context context = InstrumentationRegistry.getTargetContext();
InstrumentationRegistry.getTargetContext(), SingleWebsiteSettings.class.getName(), Intent intent = settingsLauncher.createSettingsActivityIntent(context,
SingleWebsiteSettings.class.getName(),
SingleWebsiteSettings.createFragmentArgsForSite(url)); SingleWebsiteSettings.createFragmentArgsForSite(url));
final SettingsActivity settingsActivity = final SettingsActivity settingsActivity =
(SettingsActivity) InstrumentationRegistry.getInstrumentation().startActivitySync( (SettingsActivity) InstrumentationRegistry.getInstrumentation().startActivitySync(
...@@ -1227,6 +1230,9 @@ public class SiteSettingsTest { ...@@ -1227,6 +1230,9 @@ public class SiteSettingsTest {
final Preference notificationPreference = final Preference notificationPreference =
websitePreferences.findPreference("push_notifications_list"); websitePreferences.findPreference("push_notifications_list");
Assert.assertEquals(context.getString(R.string.automatically_blocked),
notificationPreference.getSummary());
websitePreferences.launchOsChannelSettingsFromPreference(notificationPreference); websitePreferences.launchOsChannelSettingsFromPreference(notificationPreference);
// Ensure that a proper separate channel has indeed been created to allow the user to // Ensure that a proper separate channel has indeed been created to allow the user to
......
...@@ -45,15 +45,22 @@ public class PermissionInfo implements Serializable { ...@@ -45,15 +45,22 @@ public class PermissionInfo implements Serializable {
} }
private final boolean mIsIncognito; private final boolean mIsIncognito;
private final boolean mIsEmbargoed;
private final String mEmbedder; private final String mEmbedder;
private final String mOrigin; private final String mOrigin;
private final @Type int mType; private final @Type int mType;
public PermissionInfo(@Type int type, String origin, String embedder, boolean isIncognito) { public PermissionInfo(@Type int type, String origin, String embedder, boolean isIncognito) {
this(type, origin, embedder, isIncognito, false);
}
public PermissionInfo(@Type int type, String origin, String embedder, boolean isIncognito,
boolean isEmbargoed) {
mOrigin = origin; mOrigin = origin;
mEmbedder = embedder; mEmbedder = embedder;
mIsIncognito = isIncognito; mIsIncognito = isIncognito;
mType = type; mType = type;
mIsEmbargoed = isEmbargoed;
} }
public @Type int getType() { public @Type int getType() {
...@@ -76,6 +83,10 @@ public class PermissionInfo implements Serializable { ...@@ -76,6 +83,10 @@ public class PermissionInfo implements Serializable {
return mEmbedder != null ? mEmbedder : mOrigin; return mEmbedder != null ? mEmbedder : mOrigin;
} }
public boolean isEmbargoed() {
return mIsEmbargoed;
}
/** /**
* Returns the ContentSetting value for this origin. * Returns the ContentSetting value for this origin.
*/ */
......
...@@ -350,7 +350,9 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -350,7 +350,9 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
} else if (i == ContentSettingException.Type.JAVASCRIPT) { } else if (i == ContentSettingException.Type.JAVASCRIPT) {
setUpJavascriptPreference(preference); setUpJavascriptPreference(preference);
} else { } else {
setUpListPreference(preference, mSite.getContentSettingPermission(i)); // ContentSettingException can not be embargoed.
setUpListPreference(preference, mSite.getContentSettingPermission(i),
false /* isEmbargoed */);
} }
return; return;
} }
...@@ -362,17 +364,23 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -362,17 +364,23 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
if (i == PermissionInfo.Type.GEOLOCATION) { if (i == PermissionInfo.Type.GEOLOCATION) {
setUpLocationPreference(preference); setUpLocationPreference(preference);
} else if (i == PermissionInfo.Type.NOTIFICATION) { } else if (i == PermissionInfo.Type.NOTIFICATION) {
setUpNotificationsPreference(preference); setUpNotificationsPreference(
preference, isPermissionEmbargoed(PermissionInfo.Type.NOTIFICATION));
} else { } else {
setUpListPreference(preference, setUpListPreference(preference,
mSite.getPermission( mSite.getPermission(
getSiteSettingsClient().getBrowserContextHandle(), i)); getSiteSettingsClient().getBrowserContextHandle(), i),
isPermissionEmbargoed(i));
} }
return; return;
} }
} }
} }
private boolean isPermissionEmbargoed(@PermissionInfo.Type int type) {
return mSite.getPermissionInfo(type) != null && mSite.getPermissionInfo(type).isEmbargoed();
}
private void setUpClearDataPreference(ClearWebsiteStorage preference) { private void setUpClearDataPreference(ClearWebsiteStorage preference) {
long usage = mSite.getTotalUsage(); long usage = mSite.getTotalUsage();
if (usage > 0) { if (usage > 0) {
...@@ -452,7 +460,7 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -452,7 +460,7 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
}); });
} }
private void setUpNotificationsPreference(Preference preference) { private void setUpNotificationsPreference(Preference preference, boolean isEmbargoed) {
WebappSettingsClient client = getSiteSettingsClient().getWebappSettingsClient(); WebappSettingsClient client = getSiteSettingsClient().getWebappSettingsClient();
Origin origin = Origin.create(mSite.getAddress().getOrigin()); Origin origin = Origin.create(mSite.getAddress().getOrigin());
if (origin != null) { if (origin != null) {
...@@ -482,14 +490,15 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -482,14 +490,15 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
getPreferenceScreen().removePreference(preference); getPreferenceScreen().removePreference(preference);
return; return;
} }
String overrideSummary; String overrideSummary;
if (isPermissionControlledByDSE(ContentSettingsType.NOTIFICATIONS)) { if (isPermissionControlledByDSE(ContentSettingsType.NOTIFICATIONS)) {
overrideSummary = getString(value != null && value == ContentSettingValues.ALLOW overrideSummary = getString(value != null && value == ContentSettingValues.ALLOW
? R.string.website_settings_permissions_allow_dse ? R.string.website_settings_permissions_allow_dse
: R.string.website_settings_permissions_block_dse); : R.string.website_settings_permissions_block_dse);
} else { } else {
overrideSummary = getString(ContentSettingsResources.getSiteSummary(value)); overrideSummary = isEmbargoed
? getString(R.string.automatically_blocked)
: getString(ContentSettingsResources.getSiteSummary(value));
} }
// On Android O this preference is read-only, so we replace the existing pref with a // On Android O this preference is read-only, so we replace the existing pref with a
...@@ -503,7 +512,6 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -503,7 +512,6 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
return true; return true;
}); });
} else { } else {
setUpListPreference(preference, value);
if (isPermissionControlledByDSE(ContentSettingsType.NOTIFICATIONS) && value != null) { if (isPermissionControlledByDSE(ContentSettingsType.NOTIFICATIONS) && value != null) {
updatePreferenceForDSESetting(preference); updatePreferenceForDSESetting(preference);
} }
...@@ -512,14 +520,9 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -512,14 +520,9 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
// This is implemented as a public utility function to better facilitate testing. // This is implemented as a public utility function to better facilitate testing.
public void launchOsChannelSettingsFromPreference(Preference preference) { public void launchOsChannelSettingsFromPreference(Preference preference) {
final boolean blockedByEmbargo =
(WebsitePreferenceBridgeJni.get().isNotificationEmbargoedForOrigin(
getSiteSettingsClient().getBrowserContextHandle(),
mSite.getAddress().getOrigin()));
// There is no notification channel if the origin is merely embargoed. Create it // There is no notification channel if the origin is merely embargoed. Create it
// just-in-time if the user tries to change to setting. // just-in-time if the user tries to change to setting.
if (blockedByEmbargo) { if (isPermissionEmbargoed(PermissionInfo.Type.NOTIFICATION)) {
mSite.setPermission(getSiteSettingsClient().getBrowserContextHandle(), mSite.setPermission(getSiteSettingsClient().getBrowserContextHandle(),
PermissionInfo.Type.NOTIFICATION, ContentSettingValues.BLOCK); PermissionInfo.Type.NOTIFICATION, ContentSettingValues.BLOCK);
} }
...@@ -567,7 +570,7 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -567,7 +570,7 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
findPreference(PERMISSION_PREFERENCE_KEYS[PermissionInfo.Type.NOTIFICATION findPreference(PERMISSION_PREFERENCE_KEYS[PermissionInfo.Type.NOTIFICATION
+ ContentSettingException.Type.NUM_ENTRIES]); + ContentSettingException.Type.NUM_ENTRIES]);
if (notificationsPreference != null) { if (notificationsPreference != null) {
setUpNotificationsPreference(notificationsPreference); setUpNotificationsPreference(notificationsPreference, false /* isEmbargoed */);
} }
// To ensure UMA receives notification revocations, we detect if the setting has changed // To ensure UMA receives notification revocations, we detect if the setting has changed
...@@ -745,8 +748,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -745,8 +748,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
* @param preference The ListPreference to initialize. * @param preference The ListPreference to initialize.
* @param value The value to initialize it to. * @param value The value to initialize it to.
*/ */
private void setUpListPreference( private void setUpListPreference(Preference preference,
Preference preference, @ContentSettingValues @Nullable Integer value) { @ContentSettingValues @Nullable Integer value, boolean isEmbargoed) {
if (value == null) { if (value == null) {
getPreferenceScreen().removePreference(preference); getPreferenceScreen().removePreference(preference);
return; return;
...@@ -764,12 +767,12 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -764,12 +767,12 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
getString(ContentSettingsResources.getSiteSummary(ContentSettingValues.BLOCK)); getString(ContentSettingsResources.getSiteSummary(ContentSettingValues.BLOCK));
listPreference.setEntryValues(keys); listPreference.setEntryValues(keys);
listPreference.setEntries(descriptions); listPreference.setEntries(descriptions);
listPreference.setOnPreferenceChangeListener(this);
listPreference.setSummary(isEmbargoed ? getString(R.string.automatically_blocked) : "%s");
// TODO(crbug.com/735110): Figure out if this is the correct thing to do - here we are // TODO(crbug.com/735110): Figure out if this is the correct thing to do - here we are
// effectively treating non-ALLOW values as BLOCK. // effectively treating non-ALLOW values as BLOCK.
int index = (value == ContentSettingValues.ALLOW ? 0 : 1); int index = (value == ContentSettingValues.ALLOW ? 0 : 1);
listPreference.setValueIndex(index); listPreference.setValueIndex(index);
listPreference.setOnPreferenceChangeListener(this);
listPreference.setSummary("%s");
} }
/** /**
...@@ -803,7 +806,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -803,7 +806,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
@Nullable @Nullable
Integer permission = mSite.getPermission( Integer permission = mSite.getPermission(
getSiteSettingsClient().getBrowserContextHandle(), PermissionInfo.Type.GEOLOCATION); getSiteSettingsClient().getBrowserContextHandle(), PermissionInfo.Type.GEOLOCATION);
setUpListPreference(preference, permission); setUpListPreference(
preference, permission, isPermissionEmbargoed(PermissionInfo.Type.GEOLOCATION));
if (isPermissionControlledByDSE(ContentSettingsType.GEOLOCATION) && permission != null) { if (isPermissionControlledByDSE(ContentSettingsType.GEOLOCATION) && permission != null) {
updatePreferenceForDSESetting(preference); updatePreferenceForDSESetting(preference);
} }
...@@ -823,7 +827,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -823,7 +827,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
? ContentSettingValues.ALLOW ? ContentSettingValues.ALLOW
: ContentSettingValues.BLOCK; : ContentSettingValues.BLOCK;
} }
setUpListPreference(preference, currentValue); // Not possible to embargo SOUND.
setUpListPreference(preference, currentValue, false /* isEmbargoed */);
} }
private void setUpJavascriptPreference(Preference preference) { private void setUpJavascriptPreference(Preference preference) {
...@@ -839,7 +844,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -839,7 +844,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
ContentSettingsType.JAVASCRIPT)) { ContentSettingsType.JAVASCRIPT)) {
currentValue = ContentSettingValues.BLOCK; currentValue = ContentSettingValues.BLOCK;
} }
setUpListPreference(preference, currentValue); // Not possible to embargo JAVASCRIPT.
setUpListPreference(preference, currentValue, false /* isEmbargoed */);
} }
/** /**
...@@ -852,7 +858,7 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -852,7 +858,7 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
private void setUpAdsPreference(Preference preference) { private void setUpAdsPreference(Preference preference) {
// Do not show the setting if the category is not enabled. // Do not show the setting if the category is not enabled.
if (!SiteSettingsCategory.adsCategoryEnabled()) { if (!SiteSettingsCategory.adsCategoryEnabled()) {
setUpListPreference(preference, null); setUpListPreference(preference, null, false);
return; return;
} }
// If the ad blocker is activated, then this site will have ads blocked unless there is an // If the ad blocker is activated, then this site will have ads blocked unless there is an
...@@ -867,7 +873,7 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -867,7 +873,7 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
// If the site is not considered a candidate for blocking, do the standard thing and remove // If the site is not considered a candidate for blocking, do the standard thing and remove
// the preference. // the preference.
if (permission == null && !activated) { if (permission == null && !activated) {
setUpListPreference(preference, null); setUpListPreference(preference, null, false);
return; return;
} }
...@@ -880,7 +886,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -880,7 +886,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
? ContentSettingValues.ALLOW ? ContentSettingValues.ALLOW
: ContentSettingValues.BLOCK; : ContentSettingValues.BLOCK;
} }
setUpListPreference(preference, permission); // Not possible to embargo ADS.
setUpListPreference(preference, permission, false /* isEmbargoed */);
// The subresource filter permission has a custom BLOCK string. // The subresource filter permission has a custom BLOCK string.
ListPreference listPreference = (ListPreference) preference; ListPreference listPreference = (ListPreference) preference;
...@@ -935,6 +942,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment ...@@ -935,6 +942,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
@ContentSettingValues @ContentSettingValues
int permission = ContentSetting.fromString((String) newValue); int permission = ContentSetting.fromString((String) newValue);
// Embargoed permission preserves summary. Refresh it manually.
preference.setSummary("%s");
BrowserContextHandle browserContextHandle = BrowserContextHandle browserContextHandle =
getSiteSettingsClient().getBrowserContextHandle(); getSiteSettingsClient().getBrowserContextHandle();
for (int i = 0; i < PERMISSION_PREFERENCE_KEYS.length; i++) { for (int i = 0; i < PERMISSION_PREFERENCE_KEYS.length; i++) {
......
...@@ -77,7 +77,7 @@ public class WebsitePreferenceBridge { ...@@ -77,7 +77,7 @@ public class WebsitePreferenceBridge {
} }
private static void insertInfoIntoList(@PermissionInfo.Type int type, private static void insertInfoIntoList(@PermissionInfo.Type int type,
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
if (type == PermissionInfo.Type.CAMERA || type == PermissionInfo.Type.MICROPHONE) { if (type == PermissionInfo.Type.CAMERA || type == PermissionInfo.Type.MICROPHONE) {
for (PermissionInfo info : list) { for (PermissionInfo info : list) {
if (info.getOrigin().equals(origin) && info.getEmbedder().equals(embedder)) { if (info.getOrigin().equals(origin) && info.getEmbedder().equals(embedder)) {
...@@ -85,67 +85,69 @@ public class WebsitePreferenceBridge { ...@@ -85,67 +85,69 @@ public class WebsitePreferenceBridge {
} }
} }
} }
list.add(new PermissionInfo(type, origin, embedder, false)); list.add(new PermissionInfo(type, origin, embedder, false, isEmbargoed));
} }
@CalledByNative @CalledByNative
private static void insertArInfoIntoList( private static void insertArInfoIntoList(
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
insertInfoIntoList(PermissionInfo.Type.AUGMENTED_REALITY, list, origin, embedder); insertInfoIntoList(
PermissionInfo.Type.AUGMENTED_REALITY, list, origin, embedder, isEmbargoed);
} }
@CalledByNative @CalledByNative
private static void insertCameraInfoIntoList( private static void insertCameraInfoIntoList(
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
insertInfoIntoList(PermissionInfo.Type.CAMERA, list, origin, embedder); insertInfoIntoList(PermissionInfo.Type.CAMERA, list, origin, embedder, isEmbargoed);
} }
@CalledByNative @CalledByNative
private static void insertClipboardInfoIntoList( private static void insertClipboardInfoIntoList(
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
insertInfoIntoList(PermissionInfo.Type.CLIPBOARD, list, origin, embedder); insertInfoIntoList(PermissionInfo.Type.CLIPBOARD, list, origin, embedder, isEmbargoed);
} }
@CalledByNative @CalledByNative
private static void insertGeolocationInfoIntoList( private static void insertGeolocationInfoIntoList(
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
insertInfoIntoList(PermissionInfo.Type.GEOLOCATION, list, origin, embedder); insertInfoIntoList(PermissionInfo.Type.GEOLOCATION, list, origin, embedder, isEmbargoed);
} }
@CalledByNative @CalledByNative
private static void insertMicrophoneInfoIntoList( private static void insertMicrophoneInfoIntoList(
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
insertInfoIntoList(PermissionInfo.Type.MICROPHONE, list, origin, embedder); insertInfoIntoList(PermissionInfo.Type.MICROPHONE, list, origin, embedder, isEmbargoed);
} }
@CalledByNative @CalledByNative
private static void insertMidiInfoIntoList( private static void insertMidiInfoIntoList(
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
insertInfoIntoList(PermissionInfo.Type.MIDI, list, origin, embedder); insertInfoIntoList(PermissionInfo.Type.MIDI, list, origin, embedder, isEmbargoed);
} }
@CalledByNative @CalledByNative
private static void insertNfcInfoIntoList( private static void insertNfcInfoIntoList(
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
insertInfoIntoList(PermissionInfo.Type.NFC, list, origin, embedder); insertInfoIntoList(PermissionInfo.Type.NFC, list, origin, embedder, isEmbargoed);
} }
@CalledByNative @CalledByNative
private static void insertNotificationIntoList( private static void insertNotificationIntoList(
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
insertInfoIntoList(PermissionInfo.Type.NOTIFICATION, list, origin, embedder); insertInfoIntoList(PermissionInfo.Type.NOTIFICATION, list, origin, embedder, isEmbargoed);
} }
@CalledByNative @CalledByNative
private static void insertProtectedMediaIdentifierInfoIntoList( private static void insertProtectedMediaIdentifierInfoIntoList(
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
insertInfoIntoList(PermissionInfo.Type.PROTECTED_MEDIA_IDENTIFIER, list, origin, embedder); insertInfoIntoList(PermissionInfo.Type.PROTECTED_MEDIA_IDENTIFIER, list, origin, embedder,
isEmbargoed);
} }
@CalledByNative @CalledByNative
private static void insertSensorsInfoIntoList( private static void insertSensorsInfoIntoList(
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
insertInfoIntoList(PermissionInfo.Type.SENSORS, list, origin, embedder); insertInfoIntoList(PermissionInfo.Type.SENSORS, list, origin, embedder, isEmbargoed);
} }
@CalledByNative @CalledByNative
...@@ -156,8 +158,9 @@ public class WebsitePreferenceBridge { ...@@ -156,8 +158,9 @@ public class WebsitePreferenceBridge {
@CalledByNative @CalledByNative
private static void insertVrInfoIntoList( private static void insertVrInfoIntoList(
ArrayList<PermissionInfo> list, String origin, String embedder) { ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) {
insertInfoIntoList(PermissionInfo.Type.VIRTUAL_REALITY, list, origin, embedder); insertInfoIntoList(
PermissionInfo.Type.VIRTUAL_REALITY, list, origin, embedder, isEmbargoed);
} }
@CalledByNative @CalledByNative
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include <jni.h>
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include <vector> #include <vector>
...@@ -125,7 +126,8 @@ typedef void (*InfoListInsertionFunction)( ...@@ -125,7 +126,8 @@ typedef void (*InfoListInsertionFunction)(
JNIEnv*, JNIEnv*,
const base::android::JavaRef<jobject>&, const base::android::JavaRef<jobject>&,
const base::android::JavaRef<jstring>&, const base::android::JavaRef<jstring>&,
const base::android::JavaRef<jstring>&); const base::android::JavaRef<jstring>&,
jboolean);
void GetOrigins(JNIEnv* env, void GetOrigins(JNIEnv* env,
const JavaParamRef<jobject>& jbrowser_context_handle, const JavaParamRef<jobject>& jbrowser_context_handle,
...@@ -166,7 +168,8 @@ void GetOrigins(JNIEnv* env, ...@@ -166,7 +168,8 @@ void GetOrigins(JNIEnv* env,
jembedder = ConvertUTF8ToJavaString(env, embedder); jembedder = ConvertUTF8ToJavaString(env, embedder);
seen_origins.push_back(origin); seen_origins.push_back(origin);
insertionFunc(env, list, ConvertOriginToJavaString(env, origin), jembedder); insertionFunc(env, list, ConvertOriginToJavaString(env, origin), jembedder,
/*is_embargoed=*/false);
} }
// Add any origins which have a default content setting value (thus skipped // Add any origins which have a default content setting value (thus skipped
...@@ -188,7 +191,7 @@ void GetOrigins(JNIEnv* env, ...@@ -188,7 +191,7 @@ void GetOrigins(JNIEnv* env,
.content_setting == CONTENT_SETTING_BLOCK) { .content_setting == CONTENT_SETTING_BLOCK) {
seen_origins.push_back(origin); seen_origins.push_back(origin);
insertionFunc(env, list, ConvertOriginToJavaString(env, origin), insertionFunc(env, list, ConvertOriginToJavaString(env, origin),
jembedder); jembedder, /*is_embargoed=*/true);
} }
} }
} }
......
...@@ -378,6 +378,9 @@ ...@@ -378,6 +378,9 @@
<message name="IDS_MENU_HELP" desc="Menu item for opening the help page. [CHAR-LIMIT=27]"> <message name="IDS_MENU_HELP" desc="Menu item for opening the help page. [CHAR-LIMIT=27]">
Help &amp; feedback Help &amp; feedback
</message> </message>
<message name="IDS_AUTOMATICALLY_BLOCKED" desc="Description displayed next to an origin when it was placed under embargo by Chrome. This indicates to the user that the origin is blocked automatically instead of being the result of the user's decision.">
Automatically blocked
</message>
<!-- Downloads UI --> <!-- Downloads UI -->
<message name="IDS_DOWNLOAD_NOTIFICATION_CANCEL_BUTTON" desc="Text on the button that cancels a download."> <message name="IDS_DOWNLOAD_NOTIFICATION_CANCEL_BUTTON" desc="Text on the button that cancels a download.">
......
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