• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.chromium.base;
6 
7 import org.jni_zero.JNINamespace;
8 import org.jni_zero.NativeMethods;
9 
10 /** Java accessor for base::Features listed in {@link BaseFeatures} */
11 @JNINamespace("base::android")
12 public final class BaseFeatureMap extends FeatureMap {
13     private static final BaseFeatureMap sInstance = new BaseFeatureMap();
14 
15     // Do not instantiate this class.
BaseFeatureMap()16     private BaseFeatureMap() {}
17 
18     /**
19      * @return the singleton DeviceFeatureMap.
20      */
getInstance()21     public static BaseFeatureMap getInstance() {
22         return sInstance;
23     }
24 
25     /** Convenience method to call {@link #isEnabledInNative(String)} statically. */
isEnabled(String featureName)26     public static boolean isEnabled(String featureName) {
27         return getInstance().isEnabledInNative(featureName);
28     }
29 
30     @Override
getNativeMap()31     protected long getNativeMap() {
32         return BaseFeatureMapJni.get().getNativeMap();
33     }
34 
35     @NativeMethods
36     public interface Natives {
getNativeMap()37         long getNativeMap();
38     }
39 }
40