Chromium Code Reviews| 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 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 &kNTPOfflinePagesFeature, | 53 &kNTPOfflinePagesFeature, |
| 54 &kNTPSuggestionsStandaloneUIFeature, | 54 &kNTPSuggestionsStandaloneUIFeature, |
| 55 &kPhysicalWebFeature, | 55 &kPhysicalWebFeature, |
| 56 &kPhysicalWebIgnoreOtherClientsFeature, | 56 &kPhysicalWebIgnoreOtherClientsFeature, |
| 57 &kSpecialLocaleFeature, | 57 &kSpecialLocaleFeature, |
| 58 &kSpecialLocaleWrapper, | 58 &kSpecialLocaleWrapper, |
| 59 &kTabsInCBD, | 59 &kTabsInCBD, |
| 60 &kTabReparenting, | 60 &kTabReparenting, |
| 61 &kWebPaymentsModifiers, | 61 &kWebPaymentsModifiers, |
| 62 &kWebPaymentsSingleAppUiSkip, | 62 &kWebPaymentsSingleAppUiSkip, |
| 63 &kWebVRCardboardSupport, | |
| 63 &ntp_snippets::kIncreasedVisibility, | 64 &ntp_snippets::kIncreasedVisibility, |
| 64 &ntp_snippets::kForeignSessionsSuggestionsFeature, | 65 &ntp_snippets::kForeignSessionsSuggestionsFeature, |
| 65 &ntp_snippets::kOfflineBadgeFeature, | 66 &ntp_snippets::kOfflineBadgeFeature, |
| 66 &ntp_snippets::kSaveToOfflineFeature, | 67 &ntp_snippets::kSaveToOfflineFeature, |
| 67 &ntp_snippets::kSectionDismissalFeature, | 68 &ntp_snippets::kSectionDismissalFeature, |
| 68 &offline_pages::kBackgroundLoaderForDownloadsFeature, | 69 &offline_pages::kBackgroundLoaderForDownloadsFeature, |
| 69 &offline_pages::kOfflinePagesCTFeature, // See crbug.com/620421. | 70 &offline_pages::kOfflinePagesCTFeature, // See crbug.com/620421. |
| 70 &offline_pages::kOfflinePagesSharingFeature, | 71 &offline_pages::kOfflinePagesSharingFeature, |
| 71 &password_manager::features::kViewPasswords, | 72 &password_manager::features::kViewPasswords, |
| 72 }; | 73 }; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 | 138 |
| 138 const base::Feature kUserMediaScreenCapturing{ | 139 const base::Feature kUserMediaScreenCapturing{ |
| 139 "UserMediaScreenCapturing", base::FEATURE_DISABLED_BY_DEFAULT}; | 140 "UserMediaScreenCapturing", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 140 | 141 |
| 141 const base::Feature kWebPaymentsModifiers{"WebPaymentsModifiers", | 142 const base::Feature kWebPaymentsModifiers{"WebPaymentsModifiers", |
| 142 base::FEATURE_DISABLED_BY_DEFAULT}; | 143 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 143 | 144 |
| 144 const base::Feature kWebPaymentsSingleAppUiSkip{ | 145 const base::Feature kWebPaymentsSingleAppUiSkip{ |
| 145 "WebPaymentsSingleAppUiSkip", base::FEATURE_ENABLED_BY_DEFAULT}; | 146 "WebPaymentsSingleAppUiSkip", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 146 | 147 |
| 148 const base::Feature kWebVRCardboardSupport{ | |
| 149 "WebVRCardboardSupport", base::FEATURE_ENABLED_BY_DEFAULT}; | |
| 150 | |
| 147 static jboolean IsEnabled(JNIEnv* env, | 151 static jboolean IsEnabled(JNIEnv* env, |
| 148 const JavaParamRef<jclass>& clazz, | 152 const JavaParamRef<jclass>& clazz, |
| 149 const JavaParamRef<jstring>& jfeature_name) { | 153 const JavaParamRef<jstring>& jfeature_name) { |
| 150 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); | 154 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); |
| 151 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { | 155 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { |
| 152 if (kFeaturesExposedToJava[i]->name == feature_name) | 156 if (kFeaturesExposedToJava[i]->name == feature_name) |
| 153 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); | 157 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); |
| 154 } | 158 } |
| 155 // Features queried via this API must be present in |kFeaturesExposedToJava|. | 159 // Features queried via this API must be present in |kFeaturesExposedToJava|. |
| 156 NOTREACHED(); | 160 NOTREACHED(); |
| 157 return false; | 161 return false; |
| 158 } | 162 } |
| 159 | 163 |
| 164 static jlong GetFeature(JNIEnv* env, | |
|
Ted C
2017/01/31 18:24:30
as a general practice, we really, really do not wa
amp
2017/01/31 18:41:43
Duly noted. I was trying to work out how to keep
| |
| 165 const JavaParamRef<jclass>& clazz, | |
| 166 const JavaParamRef<jstring>& jfeature_name) { | |
| 167 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); | |
| 168 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { | |
| 169 if (kFeaturesExposedToJava[i]->name == feature_name) | |
| 170 return reinterpret_cast<intptr_t>(kFeaturesExposedToJava[i]); | |
| 171 } | |
| 172 // Features queried via this API must be present in |kFeaturesExposedToJava|. | |
| 173 NOTREACHED(); | |
| 174 return 0l; | |
| 175 } | |
| 176 | |
| 160 bool RegisterChromeFeatureListJni(JNIEnv* env) { | 177 bool RegisterChromeFeatureListJni(JNIEnv* env) { |
| 161 return RegisterNativesImpl(env); | 178 return RegisterNativesImpl(env); |
| 162 } | 179 } |
| 163 | 180 |
| 164 } // namespace android | 181 } // namespace android |
| 165 } // namespace chrome | 182 } // namespace chrome |
| OLD | NEW |