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 #include "chrome/browser/android/chrome_feature_list.h" | 5 #include "chrome/browser/android/chrome_feature_list.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
12 #include "base/feature_list.h" | 12 #include "base/feature_list.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "chrome/common/chrome_features.h" | 14 #include "chrome/common/chrome_features.h" |
15 #include "components/offline_pages/offline_page_feature.h" | 15 #include "components/offline_pages/offline_page_feature.h" |
16 #include "content/public/common/content_features.h" | 16 #include "content/public/common/content_features.h" |
17 #include "jni/ChromeFeatureList_jni.h" | 17 #include "jni/ChromeFeatureList_jni.h" |
18 | 18 |
19 using base::android::ConvertJavaStringToUTF8; | 19 using base::android::ConvertJavaStringToUTF8; |
20 | 20 |
21 namespace chrome { | 21 namespace chrome { |
22 namespace android { | 22 namespace android { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Array of features exposed through the Java ChromeFeatureList API. Entries in | 26 // Array of features exposed through the Java ChromeFeatureList API. Entries in |
27 // this array may either refer to features defined in this file (above) or in | 27 // this array may either refer to features defined in the header of this file or |
28 // other locations in the code base (e.g. chrome/, components/, etc). | 28 // in other locations in the code base (e.g. chrome/, components/, etc). |
29 const base::Feature* kFeaturesExposedToJava[] = { | 29 const base::Feature* kFeaturesExposedToJava[] = { |
30 &features::kCredentialManagementAPI, | 30 &features::kCredentialManagementAPI, |
31 &features::kSimplifiedFullscreenUI, | 31 &features::kSimplifiedFullscreenUI, |
| 32 &kAndroidPayIntegrationV1, |
32 &kImportantSitesInCBD, | 33 &kImportantSitesInCBD, |
33 &kMediaStyleNotification, | 34 &kMediaStyleNotification, |
34 &kNTPFakeOmniboxTextFeature, | 35 &kNTPFakeOmniboxTextFeature, |
35 &kNTPMaterialDesign, | 36 &kNTPMaterialDesign, |
36 &kNTPOfflinePagesFeature, | 37 &kNTPOfflinePagesFeature, |
37 &kNTPSnippetsFeature, | 38 &kNTPSnippetsFeature, |
38 &kNTPToolbarFeature, | 39 &kNTPToolbarFeature, |
39 &kPhysicalWebFeature, | 40 &kPhysicalWebFeature, |
40 &kSystemDownloadManager, | 41 &kSystemDownloadManager, |
41 &offline_pages::kOfflinePagesBackgroundLoadingFeature, | 42 &offline_pages::kOfflinePagesBackgroundLoadingFeature, |
(...skipping 20 matching lines...) Expand all Loading... |
62 }; | 63 }; |
63 | 64 |
64 const base::Feature kNTPToolbarFeature { | 65 const base::Feature kNTPToolbarFeature { |
65 "NTPToolbar", base::FEATURE_ENABLED_BY_DEFAULT | 66 "NTPToolbar", base::FEATURE_ENABLED_BY_DEFAULT |
66 }; | 67 }; |
67 | 68 |
68 const base::Feature kNTPFakeOmniboxTextFeature { | 69 const base::Feature kNTPFakeOmniboxTextFeature { |
69 "NTPFakeOmniboxText", base::FEATURE_DISABLED_BY_DEFAULT | 70 "NTPFakeOmniboxText", base::FEATURE_DISABLED_BY_DEFAULT |
70 }; | 71 }; |
71 | 72 |
| 73 const base::Feature kAndroidPayIntegrationV1 { |
| 74 "AndroidPayIntegrationV1", base::FEATURE_ENABLED_BY_DEFAULT |
| 75 }; |
| 76 |
72 const base::Feature kPhysicalWebFeature { | 77 const base::Feature kPhysicalWebFeature { |
73 "PhysicalWeb", base::FEATURE_ENABLED_BY_DEFAULT | 78 "PhysicalWeb", base::FEATURE_ENABLED_BY_DEFAULT |
74 }; | 79 }; |
75 | 80 |
76 const base::Feature kSystemDownloadManager { | 81 const base::Feature kSystemDownloadManager { |
77 "SystemDownloadManager", base::FEATURE_ENABLED_BY_DEFAULT | 82 "SystemDownloadManager", base::FEATURE_ENABLED_BY_DEFAULT |
78 }; | 83 }; |
79 | 84 |
80 static jboolean IsEnabled(JNIEnv* env, | 85 static jboolean IsEnabled(JNIEnv* env, |
81 const JavaParamRef<jclass>& clazz, | 86 const JavaParamRef<jclass>& clazz, |
82 const JavaParamRef<jstring>& jfeature_name) { | 87 const JavaParamRef<jstring>& jfeature_name) { |
83 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); | 88 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); |
84 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { | 89 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { |
85 if (kFeaturesExposedToJava[i]->name == feature_name) | 90 if (kFeaturesExposedToJava[i]->name == feature_name) |
86 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); | 91 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); |
87 } | 92 } |
88 // Features queried via this API must be present in |kFeaturesExposedToJava|. | 93 // Features queried via this API must be present in |kFeaturesExposedToJava|. |
89 NOTREACHED(); | 94 NOTREACHED(); |
90 return false; | 95 return false; |
91 } | 96 } |
92 | 97 |
93 bool RegisterChromeFeatureListJni(JNIEnv* env) { | 98 bool RegisterChromeFeatureListJni(JNIEnv* env) { |
94 return RegisterNativesImpl(env); | 99 return RegisterNativesImpl(env); |
95 } | 100 } |
96 | 101 |
97 } // namespace android | 102 } // namespace android |
98 } // namespace chrome | 103 } // namespace chrome |
OLD | NEW |