OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.preferences.website; | 5 package org.chromium.chrome.browser.preferences.website; |
6 | 6 |
7 import org.chromium.base.annotations.CalledByNative; | 7 import org.chromium.base.annotations.CalledByNative; |
8 import org.chromium.chrome.browser.preferences.PrefServiceBridge; | 8 import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
| 9 import org.chromium.content_public.browser.WebContents; |
9 | 10 |
10 import java.util.ArrayList; | 11 import java.util.ArrayList; |
11 import java.util.HashMap; | 12 import java.util.HashMap; |
12 import java.util.List; | 13 import java.util.List; |
13 | 14 |
14 /** | 15 /** |
15 * Utility class that interacts with native to retrieve and set website settings
. | 16 * Utility class that interacts with native to retrieve and set website settings
. |
16 */ | 17 */ |
17 public abstract class WebsitePreferenceBridge { | 18 public abstract class WebsitePreferenceBridge { |
18 private static final String LOG_TAG = "WebsiteSettingsUtils"; | 19 private static final String LOG_TAG = "WebsiteSettingsUtils"; |
(...skipping 16 matching lines...) Expand all Loading... |
35 | 36 |
36 /** | 37 /** |
37 * Interface for an object that listens to storage info is cleared callback. | 38 * Interface for an object that listens to storage info is cleared callback. |
38 */ | 39 */ |
39 public interface StorageInfoClearedCallback { | 40 public interface StorageInfoClearedCallback { |
40 @CalledByNative("StorageInfoClearedCallback") | 41 @CalledByNative("StorageInfoClearedCallback") |
41 public void onStorageInfoCleared(); | 42 public void onStorageInfoCleared(); |
42 } | 43 } |
43 | 44 |
44 /** | 45 /** |
| 46 * @return the list of all origins that have keygen permissions in non-incog
nito mode. |
| 47 */ |
| 48 @SuppressWarnings("unchecked") |
| 49 public static List<KeygenInfo> getKeygenInfo() { |
| 50 ArrayList<KeygenInfo> list = new ArrayList<KeygenInfo>(); |
| 51 nativeGetKeygenOrigins(list); |
| 52 return list; |
| 53 } |
| 54 |
| 55 @CalledByNative |
| 56 private static void insertKeygenInfoIntoList( |
| 57 ArrayList<KeygenInfo> list, String origin, String embedder) { |
| 58 list.add(new KeygenInfo(origin, embedder, false)); |
| 59 } |
| 60 |
| 61 /** |
| 62 * @return whether we've blocked key generation in the current tab. |
| 63 */ |
| 64 @SuppressWarnings("unchecked") |
| 65 public static boolean getKeygenBlocked(WebContents webContents) { |
| 66 return nativeGetKeygenBlocked(webContents); |
| 67 } |
| 68 |
| 69 /** |
45 * @return the list of all origins that have geolocation permissions in non-
incognito mode. | 70 * @return the list of all origins that have geolocation permissions in non-
incognito mode. |
46 */ | 71 */ |
47 @SuppressWarnings("unchecked") | 72 @SuppressWarnings("unchecked") |
48 public static List<GeolocationInfo> getGeolocationInfo() { | 73 public static List<GeolocationInfo> getGeolocationInfo() { |
49 // Location can be managed by the custodian of a supervised account or b
y enterprise policy. | 74 // Location can be managed by the custodian of a supervised account or b
y enterprise policy. |
50 boolean managedOnly = !PrefServiceBridge.getInstance().isAllowLocationUs
erModifiable(); | 75 boolean managedOnly = !PrefServiceBridge.getInstance().isAllowLocationUs
erModifiable(); |
51 ArrayList<GeolocationInfo> list = new ArrayList<GeolocationInfo>(); | 76 ArrayList<GeolocationInfo> list = new ArrayList<GeolocationInfo>(); |
52 nativeGetGeolocationOrigins(list, managedOnly); | 77 nativeGetGeolocationOrigins(list, managedOnly); |
53 return list; | 78 return list; |
54 } | 79 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 private static void insertFullscreenInfoIntoList( | 265 private static void insertFullscreenInfoIntoList( |
241 ArrayList<FullscreenInfo> list, String origin, String embedder) { | 266 ArrayList<FullscreenInfo> list, String origin, String embedder) { |
242 list.add(new FullscreenInfo(origin, embedder, false)); | 267 list.add(new FullscreenInfo(origin, embedder, false)); |
243 } | 268 } |
244 | 269 |
245 private static native void nativeGetGeolocationOrigins(Object list, boolean
managedOnly); | 270 private static native void nativeGetGeolocationOrigins(Object list, boolean
managedOnly); |
246 static native int nativeGetGeolocationSettingForOrigin( | 271 static native int nativeGetGeolocationSettingForOrigin( |
247 String origin, String embedder, boolean isIncognito); | 272 String origin, String embedder, boolean isIncognito); |
248 public static native void nativeSetGeolocationSettingForOrigin( | 273 public static native void nativeSetGeolocationSettingForOrigin( |
249 String origin, String embedder, int value, boolean isIncognito); | 274 String origin, String embedder, int value, boolean isIncognito); |
| 275 private static native void nativeGetKeygenOrigins(Object list); |
| 276 static native int nativeGetKeygenSettingForOrigin( |
| 277 String origin, String embedder, boolean isIncognito); |
| 278 static native void nativeSetKeygenSettingForOrigin( |
| 279 String origin, String embedder, int value, boolean isIncognito); |
| 280 private static native boolean nativeGetKeygenBlocked(Object webContents); |
250 private static native void nativeGetMidiOrigins(Object list); | 281 private static native void nativeGetMidiOrigins(Object list); |
251 static native int nativeGetMidiSettingForOrigin( | 282 static native int nativeGetMidiSettingForOrigin( |
252 String origin, String embedder, boolean isIncognito); | 283 String origin, String embedder, boolean isIncognito); |
253 static native void nativeSetMidiSettingForOrigin( | 284 static native void nativeSetMidiSettingForOrigin( |
254 String origin, String embedder, int value, boolean isIncognito); | 285 String origin, String embedder, int value, boolean isIncognito); |
255 private static native void nativeGetPushNotificationOrigins(Object list); | 286 private static native void nativeGetPushNotificationOrigins(Object list); |
256 static native int nativeGetPushNotificationSettingForOrigin( | 287 static native int nativeGetPushNotificationSettingForOrigin( |
257 String origin, String embedder, boolean isIncognito); | 288 String origin, String embedder, boolean isIncognito); |
258 static native void nativeSetPushNotificationSettingForOrigin( | 289 static native void nativeSetPushNotificationSettingForOrigin( |
259 String origin, String embedder, int value, boolean isIncognito); | 290 String origin, String embedder, int value, boolean isIncognito); |
(...skipping 23 matching lines...) Expand all Loading... |
283 private static native void nativeFetchLocalStorageInfo(Object callback); | 314 private static native void nativeFetchLocalStorageInfo(Object callback); |
284 private static native void nativeFetchStorageInfo(Object callback); | 315 private static native void nativeFetchStorageInfo(Object callback); |
285 static native boolean nativeIsContentSettingsPatternValid(String pattern); | 316 static native boolean nativeIsContentSettingsPatternValid(String pattern); |
286 static native boolean nativeUrlMatchesContentSettingsPattern(String url, Str
ing pattern); | 317 static native boolean nativeUrlMatchesContentSettingsPattern(String url, Str
ing pattern); |
287 private static native void nativeGetFullscreenOrigins(Object list, boolean m
anagedOnly); | 318 private static native void nativeGetFullscreenOrigins(Object list, boolean m
anagedOnly); |
288 static native int nativeGetFullscreenSettingForOrigin( | 319 static native int nativeGetFullscreenSettingForOrigin( |
289 String origin, String embedder, boolean isIncognito); | 320 String origin, String embedder, boolean isIncognito); |
290 static native void nativeSetFullscreenSettingForOrigin( | 321 static native void nativeSetFullscreenSettingForOrigin( |
291 String origin, String embedder, int value, boolean isIncognito); | 322 String origin, String embedder, int value, boolean isIncognito); |
292 } | 323 } |
OLD | NEW |