Commit 632104a8 authored by Ehimare Okoyomon's avatar Ehimare Okoyomon Committed by Commit Bot

[Android] Refactor WebsitePermissionsFetcher methods.

Add utility function and enum to get a WebsitePermissionsType from a
ContentSettingsType because they can take on different objects. Then use
these additions to simplify WebsitePermissionsFetcher logic.

Bug: 1077766
Change-Id: Ifd69d3a32df1193e295835d7c0fd2ce292e31570
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2421498
Commit-Queue: Ehimare Okoyomon <eokoyomon@chromium.org>
Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812060}
parent 5fe8fd2f
......@@ -569,9 +569,9 @@ public class WebsitePermissionsFetcherTest {
ArrayList<ChosenObjectInfo> chosenObjectInfos =
new ArrayList<>(site.getChosenObjectInfo());
Assert.assertEquals(2, chosenObjectInfos.size());
Assert.assertEquals(ContentSettingsType.USB_CHOOSER_DATA,
chosenObjectInfos.get(0).getContentSettingsType());
Assert.assertEquals(ContentSettingsType.BLUETOOTH_CHOOSER_DATA,
chosenObjectInfos.get(0).getContentSettingsType());
Assert.assertEquals(ContentSettingsType.USB_CHOOSER_DATA,
chosenObjectInfos.get(1).getContentSettingsType());
});
}
......
......@@ -46,10 +46,9 @@ public class SiteSettingsCategory {
Type.USE_STORAGE})
@Retention(RetentionPolicy.SOURCE)
public @interface Type {
// Values used to address array index - should be enumerated from 0 and can't have gaps.
// All updates here must also be reflected in {@link #preferenceKey(int)
// preferenceKey} and {@link #contentSettingsType(int) contentSettingsType}.
int ALL_SITES = 0; // Always first as it should appear in the UI at the top.
int ALL_SITES = 0;
int ADS = 1;
int AUGMENTED_REALITY = 2;
int AUTOMATIC_DOWNLOADS = 3;
......@@ -71,7 +70,7 @@ public class SiteSettingsCategory {
int USB = 19;
int BLUETOOTH = 20;
int VIRTUAL_REALITY = 21;
int USE_STORAGE = 22; // Always last as it should appear in the UI at the bottom.
int USE_STORAGE = 22;
/**
* Number of handled categories used for calculating array sizes.
*/
......
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